Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preliminary improvements to documentation, esp internal types e.g. Units #2727

Merged
merged 10 commits into from
Oct 11, 2024

Conversation

smallsaucepan
Copy link
Member

Some preliminary work to improve documentation, particularly around internal types. Summary of changes:

Publish documentation for internal types

Internal types like Units, DbscanProps have had some JSDoc fields added. This will make them exportable as first class pages on the website (with some corresponding changes to turf-www) which we can link to from other pages that reference them.

They are also included in the README.md for the package in which they're defined. Not able to link directly between README.md files yet though.

Move away from categorising functions via documenation.yml

Suggest instead we add a custom JSDoc tag to relevant functions (@turfcategory), and use this to sort each function into its relevant category on the website e.g. along -> Measurement, hexGrid -> Grids. Category is co-located with the function. Less error prone as any function not listed in documents.yml ends up in Others, rather than being omitted entirely.

Sort categories alphabetically

This is largely to keep the web site generation code slightly simpler. With the sheer number of categories, plus better search, the order of the categories isn't that important.

Updated some mismatched parameter types

JSDoc parameter types that were out of sync with what the function actually used were updated where spotted. Particularly focusing on internal types whose documentation will be improving e.g. string -> Units.

CODE CHANGES

Only code change was to MoranIndex type, which is now being exported. To date this wasn't a named type and is an optional import so shouldn't cause any backwards compatibility issues.

… sure about what is a function. Parser seems to infer the function name just fine. Adding a @turfcategory tag to functions so turf-www generation can use that to categorise functions in the side menu. Avoids issues with documentation.yml getting out of date.
…s. Minimal other changes to bring JSDoc types into line with code types. Added GeoJsonProperties to documentation.yml for type linking.
…JSDoc for internal types and constants e.g. Units. Also synced up some out of data JSDoc types with what is in the code.
Copy link
Collaborator

@twelch twelch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like where this is going, nice work

packages/turf-along/index.ts Show resolved Hide resolved
packages/turf-sample/README.md Show resolved Hide resolved
@smallsaucepan
Copy link
Member Author

Thanks for taking a look @twelch. Sadly doesn't look like I'll be able to do the @turfcategory thing as documentation lint checks for unrecognised tags. Will stick with documentation.yml instead though make its usage more robust.

…cognised tags. Instead switching the structure of documentation.yml to be more traditionally nested. We'll use this new structure from the turf-www repo to generate the website documentation in a more robust manner.
…">", and the other was the linter not liking number[][] type format.
@smallsaucepan
Copy link
Member Author

All I need to do now is figure out how I've broken the build by updating documentation 🙌

…sonRbush) causes @turf/turf last-checks to fail. Specifically defining it as rbush like it used to be, except with the @function tag rather than @name.
@smallsaucepan smallsaucepan marked this pull request as ready for review October 10, 2024 03:36
@smallsaucepan
Copy link
Member Author

Got the build fixed @twelch if you're able to take another look.

@smallsaucepan smallsaucepan merged commit e7227f5 into Turfjs:master Oct 11, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants