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

feat: Re-Add the docs command #1107

Merged
merged 11 commits into from
Dec 6, 2022

Conversation

maschad
Copy link
Contributor

@maschad maschad commented Nov 16, 2022

Re-introducing the docs command to generate Docs for a project and publish them to gh pages

Closes #1105

@maschad maschad changed the title fix: re-introduced the docs command and updated to ESM modules fix: Re-Add the docs command Nov 16, 2022
maschad added a commit to maschad/aegir that referenced this pull request Nov 23, 2022
maschad added a commit to maschad/aegir that referenced this pull request Nov 23, 2022
maschad added a commit to maschad/aegir that referenced this pull request Nov 23, 2022
@maschad maschad force-pushed the fix/re-introduce-docs-command branch from 3bc81f2 to ddc6357 Compare November 23, 2022 16:34
maschad added a commit to maschad/aegir that referenced this pull request Nov 23, 2022
maschad added a commit to maschad/aegir that referenced this pull request Nov 23, 2022
@maschad maschad force-pushed the fix/re-introduce-docs-command branch from ddc6357 to 6aa9fd4 Compare November 23, 2022 17:54
maschad added a commit to maschad/aegir that referenced this pull request Nov 23, 2022
@maschad maschad force-pushed the fix/re-introduce-docs-command branch from 6aa9fd4 to 2b063e4 Compare November 23, 2022 20:48
maschad added a commit to maschad/aegir that referenced this pull request Nov 23, 2022
maschad added a commit to maschad/aegir that referenced this pull request Nov 23, 2022
@maschad maschad force-pushed the fix/re-introduce-docs-command branch from 2b063e4 to f8c0fb8 Compare November 23, 2022 22:13
maschad added a commit to maschad/aegir that referenced this pull request Nov 23, 2022
@maschad maschad force-pushed the fix/re-introduce-docs-command branch from f8c0fb8 to 0d9a644 Compare November 23, 2022 22:13
@achingbrain
Copy link
Member

achingbrain commented Nov 26, 2022

@maschad I hope you don't mind but I just pushed a couple of commits to get this working.

I think to land it we need to sort out the following:

  • Choose a nice theme that's readable
  • Work out how to handle monorepos without extra user config (e.g. https://github.com/libp2p/js-libp2p-peer-id)
    • the isMonorepoProject variable exported from src/utils.js will tell you if the current project is a monorepo
    • tscdoc has a "packages" strategy for monorepos but I couldn't get it to work
  • Entry points/What to document
    • it should read these out of tsconfig.json but I couldn't get it to work either
    • I hardcoded src/* as the entry point - it's the convention for aegir-managed projects but maybe we don't want that
    • At the moment it creates jsdocs for everything, including internal classes/functions which is pretty overwhelming
    • Do we want this?
    • Would it be better to instead parse the exports map out of a project's package.json and only generate docs for those files?
  • Update the check-project command to add a docs link pointing to the gh-pages site for the project to the README

@achingbrain achingbrain changed the title fix: Re-Add the docs command feat: Re-Add the docs command Nov 26, 2022
@maschad
Copy link
Contributor Author

maschad commented Nov 26, 2022

@maschad I hope you don't mind but I just pushed a couple of commits to get this working.

No problem @achingbrain any help is always appreciated!

it should read these out of tsconfig.json but I couldn't get it to work either

This had actually been my stumbling block last few days, I will continue to dig into it.

Choose a nice theme that's readable

Is there any particular criteria that you would want to consider for readability? Because I was thinking we could continue with the default theme. It may also be worth considering a Github Wiki compatible theme in case repos don't want to host using gh-pages.

tscdoc has a "packages" strategy for monorepos but I couldn't get it to work

I'll take a look.

I hardcoded src/* as the entry point - it's the convention for aegir-managed projects but maybe we don't want that

Agreed, fixing the issue mentioned above should solve this.

Do we want this?

I am assuming you are referring to ....

At the moment it creates jsdocs for everything, including internal classes/functions which is pretty overwhelming

.... I would say no, the impetus to add this feature was around documentation for configuration, so I would say it should exclude internal functions/classes.

Would it be better to instead parse the exports map out of a project's package.json and only generate docs for those files?

I think this is a good idea, I can't see an immediate use for generating docs for a module
not listed in exports since importing it would lead to a ModuleNotFound Error

Update the check-project command to add a docs link pointing to the gh-pages site for the project to the README

Good point! Will do.

@maschad
Copy link
Contributor Author

maschad commented Nov 29, 2022

Following up on this:

I think this is a good idea, I can't see an immediate use for generating docs for a module
not listed in exports since importing it would lead to a ModuleNotFound Error

I adjusted the entryPoint to default to the exports map of a project's package.json and created this issue for monorepos and this for parsing the tsconfig.json for entryPoints.

Once I confirm it works I will open the PR for review.

@maschad maschad force-pushed the fix/re-introduce-docs-command branch from 6af37e1 to 4f17bf9 Compare December 1, 2022 21:11
@maschad maschad marked this pull request as ready for review December 1, 2022 22:01
@achingbrain achingbrain merged commit 830e826 into ipfs:master Dec 6, 2022
github-actions bot pushed a commit that referenced this pull request Dec 6, 2022
## [37.6.0](v37.5.7...v37.6.0) (2022-12-06)

### Features

* Re-Add the `docs` command ([#1107](#1107)) ([830e826](830e826))
@github-actions
Copy link

github-actions bot commented Dec 6, 2022

🎉 This PR is included in version 37.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Docs command is not available
2 participants