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

Mobx docs #4666

Merged
merged 53 commits into from
Mar 16, 2021
Merged

Mobx docs #4666

merged 53 commits into from
Mar 16, 2021

Conversation

rowanwins
Copy link
Contributor

@rowanwins rowanwins commented Aug 25, 2020

What this PR does

Fixes #4502

This PR does various docs things for the next branch.

  • Automate the table-of-contents in mkdocs.yml
  • Automate the lists on the catalog-items.md and catalog-groups.md pages
  • Automate the table-of-contents in mkdocs.yml
  • Generate docs from model traits, as well as allowing some jsdoc comments to be retrieved for general description and examples

Sample

Learnings

  • I'm using documentation.js as it has a node API for retrieving jsdoc style stuff from files.

    • however the json it returns can be pretty fiddily to work with
  • I ran into issues with reading jsdoc from lib/Models so ended up throwing things in lib/Traits which seems to kinda be working

  • I went for a table-based layout for scan-ability given the large number of traits most models have.

Things to do

  • Harden up process for with documentationjs for examples and general description.
  • Add more examples and general descriptions for other models.
    • At the moment I've done Cesium 3D Tiles and WMS just as samples
  • Better understand and update the release process. basically npm run publish-doc needs updating I think...

Checklist

  • No unit tests required
  • I've updated CHANGES.md with what I changed.

@tephenavies
Copy link
Member

tephenavies commented Sep 14, 2020

My only hesitation with this PR is that it mixes Traits with JSDoc. Maybe we should put examples in code somewhere? As JSON. We could then include them in tests (having all of our examples automatically tested would be cool) or in the catalog editor.

@soyarsauce
Copy link
Contributor

@steve9164 @rowanwins Yes avoiding the examples in jsdoc would be good, I wouldn't want it to stop things though. Having the examples as JSON is better for sure to allow for including them in tests among other things.

Re: catalog editor, the JSON example would be less useful given you aren't typically editing it via JSON, but could be useful for it yes.

# Conflicts:
#	.gitignore
#	lib/ModelMixins/Cesium3dTilesMixin.ts
#	lib/Traits/WebMapServiceCatalogItemTraits.ts
@soyarsauce
Copy link
Contributor

Also minor regression due to putting HTML in traits (it's treated as markdown in the editor)

Previous (next)

image

mobx-docs

image

@tephenavies
Copy link
Member

tephenavies commented Sep 23, 2020

Hmmm, after re-discovering these JSDoc-derived docs https://docs.terria.io/reference/ I no longer mind adding JSDoc back into the build process as it'd be good to have these reference docs once we have more things JSDoc'd and as Wing pointed out the catalog editor has no real use for example JSON.

I think it's alright as is, apart from the <br/> changes, which we should revert if possible .

doc/connecting-to-data/catalog-groups.md Outdated Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
buildprocess/webpack-docs.config.js Outdated Show resolved Hide resolved
doc/connecting-to-data/catalog-type-details/3d-tiles.md Outdated Show resolved Hide resolved
gulpfile.js Outdated Show resolved Hide resolved
package.json Outdated
@@ -194,6 +195,8 @@
"start": "terriajs-server --port 3002",
"dev": "webpack-dev-server --inline --config buildprocess/webpack.config.dev.js --host 0.0.0.0",
"hot": "webpack-dev-server --inline --config buildprocess/webpack.config.hot.js --hot --host 0.0.0.0",
"build-docs": "webpack --config buildprocess/webpack-docs.config.js && node modeldocs/generateDocs.js",
Copy link
Member

Choose a reason for hiding this comment

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

This should probably be part of a gulp task that gets called by gulp docs. I think there's a bit too much complexity to the whole doc generation thing to have it all in npm scripts

doc/connecting-to-data/catalog-type-details/3d-tiles.md Outdated Show resolved Hide resolved

## Properties

"type": "undefined"
Copy link
Member

Choose a reason for hiding this comment

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

Looks like this type has been ascertained incorrectly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems to be something to do with WPS but haven't quite worked out what yet....

mkdocs.yml Outdated
@@ -0,0 +1,81 @@
site_name: TerriaJS
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer to keep this file in doc/. What's the reason to pull it out to the root?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if this is due to a version change in mkdocs or something

If I keep doc/mkdocs.yml and set it to

....
docs_dir: /
site_dir: ./../wwwroot/doc/guide
...

If I try and run mkdocs build I get something like

ERROR   -  Config value: 'site_dir'. Error: The 'site_dir' should not be within the 'docs_dir' as this leads to the build directory being copied into itself and duplicate nested files in the 'site_dir'.(site_dir: '/Users/win167/Documents/Code/TerriaMapMobx/packages/terriajs/wwwroot/doc/guide', docs_dir: '/')

Short answer is I can't make it work 🤷‍♂️

Copy link
Member

Choose a reason for hiding this comment

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

Ahh ok. Actually I should probably merge my mkdocs update on master into this PR before we continue. I think it solves that issue.

@tephenavies tephenavies mentioned this pull request Sep 29, 2020
9 tasks
Sergio Conde Gomez and others added 2 commits October 1, 2020 11:33
@tephenavies
Copy link
Member

@rowanwins Any chance you can advance this?

@tephenavies
Copy link
Member

Switched all build outputs to be in build. If any markdown file is generated, it's output is written into build/doc, after /doc markdown files are copied there.

@zoran995
Copy link
Contributor

zoran995 commented Dec 7, 2020

Should we document the usage of search providers (i.e. proper config to set them in TerriaMap), I am working on Esri geocoder support

@zoran995
Copy link
Contributor

zoran995 commented Dec 7, 2020

Also, can we add the required next to the required parameters in doc?
RasterLayerTraits.ts#L69-L73 is split into multiple rows in docs

@tephenavies
Copy link
Member

Ignore the license/cla check. The author of that code accepted the CLA when the PR was merged, but must have changed their GitHub settings since so the commits are not associated. We still have the name in our CLA register though, and their contribution still falls under the CLA they signed.

doc/customizing/skinning.md Outdated Show resolved Hide resolved
requirements.txt Show resolved Hide resolved
lib/Traits/DiscretelyTimeVaryingTraits.ts Outdated Show resolved Hide resolved
lib/Traits/TimeVaryingTraits.ts Outdated Show resolved Hide resolved
lib/Traits/TimeVaryingTraits.ts Outdated Show resolved Hide resolved
buildprocess/webpack-docs.config.js Show resolved Hide resolved
@draugnim
Copy link

I was not able to build the docs with 'npm run build-docs '. The error was:

Error: ENOENT: no such file or directory, open 'doc/connecting-to-data/catalog-type-details/esri-group.md' at Object.openSync (fs.js:457:3) at Object.writeFileSync (fs.js:1282:35) at processArray (webpack:///./buildprocess/generateDocs.js?:211:47) at async generateDocs (webpack:///./buildprocess/generateDocs.js?:269:7) { errno: -4058, syscall: 'open', code: 'ENOENT', path: 'doc/connecting-to-data/catalog-type-details/esri-group.md' }

I manually created the 'doc/connecting-to-data/catalog-type-details' folder and the build passed.

@tephenavies
Copy link
Member

Hi @draugnim. Thanks for letting me know. npm run build-docs is an old script for building docs (introduced in this PR but replaced by gulp docs/npm run gulp docs). I'll remove it to avoid confusion.

@draugnim
Copy link

draugnim commented Jan 19, 2021

I first tried with that function but it failed with

YDYRCatalogFunctionJob ydyr-job
YDYRCatalogFunctionJob is not an Item, Group or Function
../lib/Traits/YDYRCatalogFunctionJobTraits.ts:
[]
[08:27:31] 'userGuide' errored after 2.44 s
[08:27:31] Error in plugin "user-doc"
Message:
    Mkdocs exited with an error.
Details:
    domainThrown: true

and than I used the npm run build-docs

@tephenavies
Copy link
Member

tephenavies commented Jan 21, 2021

@draugnim Are you using python 3 (I recommend 3.7, but I think 3.6 or 3.8+ should work)? And with all of the dependencies in requirements.txt installed? Mkdocs which we use to build our markdown docs into a website requires Python.

@draugnim
Copy link

@steve9164 thanks for the info. I installed python 3.7 and all the dependencies as you suggested but still i got the following error:

[11:47:56] 'build-for-doc-generation' errored after 55 s
[11:47:56] TypeError: cosmiconfig_1.cosmiconfigSync is not a function
    at new ForkTsCheckerWebpackPlugin (C:\Srdjan\Programming\promap\packages\prointer-gis\node_modules\fork-ts-checker-webpack-plugin\lib\ForkTsCheckerWebpackPlugin.js:28:44)
    at configureWebpack (C:\Srdjan\Programming\promap\packages\prointer-gis\buildprocess\configureWebpack.js:273:9)
    at module.exports (C:\Srdjan\Programming\promap\packages\prointer-gis\buildprocess\webpack-docs.config.js:32:10)
    at buildForDocGeneration (C:\Srdjan\Programming\promap\packages\prointer-gis\gulpfile.js:142:73)
    at build-for-doc-generation (C:\Srdjan\Programming\promap\node_modules\undertaker\lib\set-task.js:13:15)
    at bound (domain.js:426:14)
    at runBound (domain.js:439:12)
    at asyncRunner (C:\Srdjan\Programming\promap\node_modules\async-done\index.js:55:18)
    at processTicksAndRejections (internal/process/task_queues.js:79:11)
[11:47:56] 'user-guide' errored after 55 s
[11:47:56] 'docs' errored after 55 s

I figured that cosmiconfig v5 is beeing used but the code in \node_modules\fork-ts-checker-webpack-plugin\lib\ForkTsCheckerWebpackPlugin.js is written for cosmiconfig v6.

In package.json fork-ts-checker-webpack-plugin version 5.0.7 is referenced.

I manually installed cosmiconfig v6 and was able to build the docs then with npm run gulp docs

@tephenavies tephenavies linked an issue Feb 1, 2021 that may be closed by this pull request
4 tasks
@tephenavies tephenavies merged commit db89751 into next Mar 16, 2021
@tephenavies tephenavies deleted the mobx-docs branch March 16, 2021 13:47
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.

Make auto-generated docs for TerriaJS version 8
8 participants