-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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(tsdocs): add integration with api-extractor/documenter #2834
Conversation
2f3f2ad
to
cfeaf26
Compare
81f2171
to
89e18cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for taking a stab at replacing strong-tools with api-extractor!
What's the best way for reviewing the new version of API docs that will be generated with this new tooling?
Are there breaking changes to be aware of? For example, what is the format of anchors and URLs in general? Will we need to update our hand-written docs in docs/site
to use the new URL format?
packages/tsdocs/README.md
Outdated
### Generate api docs as markdown files | ||
|
||
```sh | ||
npm run generate-apidocs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this may work inside loopback-next monorepo, I don't think it will work for people installing @loopback/tsdocs
into their own projects. I see that the packages is marked as private: true
, which means it's not intended for usage outside of loopback-next monorepo. Can you please mention this in package's README too?
If this package is private, how do you envision to generate API docs for experimental packages in loopback-labs? Wouldn't it better if @loopback/tsdocs
was a generic tool that can be used in any monorepo? Maybe not, I am just asking.
|
b61c686
to
a91888b
Compare
Please follow the following instructions to try out new apidocs: cd loopback-next
git checkout ms-apidocs
npm i
npm run build
npm run tsdocs
cd docs
node ./bin/copy-readmes.js
npm pack Preview with cd loopback.io
npm i
npm i <docs/loopback/loopback-docs-1.16.0.tgz>
npm start |
397b119
to
500f76f
Compare
@raymondfeng how about the format of links - are there any breaking changes?
|
IIUC, this pull request is entirely reworking the way how API documentation works in LB4 and moves it from http://apidocs.loopback.io to https://loopback.io/doc/en/lb4. I love that ❤️ Having said that, moving API docs is not only about adding markdown files and a new sidebar. Obviously, we need to fix all places in our current documentation that are pointing to http://apidocs.loopback.io and change them to point to the new API doc location. Another place to change is the top header/navbar shown by https://loopbac.io/doc: I am not asking to make those changes right now, but we should have a good understanding of what else needs to be done and a list of follow-up tasks to make those change happen.
+1 to detect API changes. However, I don't understand why we need to directories for that? Isn't it enough to use
Fair enough.
Thank you for the detailed instruction! I'll try to find some time later this week to play with this. In general and at high level, I am strongly in favor of moving to api-extractor, even if it will require few follow-up pull requests to clean things up. @strongloop/loopback-maintainers I would like to get few more opinions on the proposed change please. Follow the instructions provided by Raymond above, look around the new API docs, look for unusual or suspicious things.
Is it really necessary to keep these generated markdown files in So far, we are generating API docs files as part of the release process. I would like to preserve that behavior. I understand that we need the generated markdown files for Jekyll to render the docs. I believe this can be solved by adding a new build step to |
I think this pull request would be easier to review if this commit was left out. Since those reports are auto-generated, they will be easy to commit in a follow-up pull request. |
api-extractor uses |
The links will be changed to |
I removed commits for generated docs. |
@bajtos I'm thinking about the following steps to roll out this feature:
|
IIUC, Please note that |
IMO, seeing diffs in generated apidocs md files for a PR is probably a good side effect. It helps reviewers easily find out if there are api changes. |
I tried on https://microsoft.github.io/tsdoc/ and it turned out the
Without |
See #2933 |
5304d47
to
1c1d976
Compare
👍
Parameter documentation seems ok now. There is still not documentation for class constructors and their parameters though. |
It's probably an issue with api-extractor/documenter. I'll investigate. But it should not hold up this PR. |
Constructor support - microsoft/rushstack#1295 Another PR to make it easier to troubleshoot unknown tags: hhttps://github.com/microsoft/rushstack/pull/1296 The project maintainers don't seem to be very responsive. Based on their disclaimer at https://github.com/microsoft/web-build-tools/tree/master/apps/api-documenter, we might to fork it to make enhancements. |
cf643d1
to
0af199b
Compare
As microsoft/rushstack#1295 is merged and released, |
@bajtos PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as the initial implementation to be improved as we learn more about its limitations.
Please get few more approvals from other team members in @strongloop/loopback-maintainers before landing.
As I commented elsewhere, we should find a way how to programmatically check tsdoc comments for conformity with api-extractor format, so that npm test
fails if any of the tsdoc comments are not valid. I think that's best left out of this pull request though.
// This file is licensed under the MIT License. | ||
// License text available at https://opensource.org/licenses/MIT | ||
Object.defineProperty(exports, '__esModule', {value: true}); | ||
const pkg2_1 = require('pkg2'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough.
Please capture this information in developer documentation. For example, you can create packages/tsdocs/fixtures/monorepo/README.md
to explain what is in this fixture. Ideally, this documentation should also explain the process for updating the fixture files, should we need to do so in the future.
The PR description says |
@raymondfeng BTW, did you follow all steps listed in Adding a new package? |
9afabaa
to
36f4d15
Compare
I added README and made it possible to rebuild the monorepo. |
Should files with |
This is part of the fixture for a mock-up monorepo to test out apidocs generation. We commit such files to avoid build steps/costs. |
@@ -41,6 +41,7 @@ | |||
"version": "npm run update-packages && git add greenkeeper.json \"**/package-lock.json\" && npm run update-template-deps && npm run apidocs", | |||
"outdated": "npm outdated --depth 0 && lerna exec --no-bail \"npm outdated --depth 0\"", | |||
"apidocs": "node bin/run-lerna run build:apidocs", | |||
"tsdocs": "lerna run --scope @loopback/tsdocs build:tsdocs", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need command apidocs
at the above line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We keep existing strong-docs based apidocs for now. The PR will allow new styles to be seen on loopback.io. Once we are happy with the new approach, we'll remove strong-docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool 🚢 LGTM
I run the preview of website and it looks great. One thing to improve(we can do it in following PRs):
Types like Registry
doesn't point to their definitions, which our current doc does, e.g. clicking ApplicationConfig it scrolls to its definition.
See #2507
Checklist
👉 Read and sign the CLA (Contributor License Agreement) 👈
npm test
passes on your machinepackages/cli
were updatedexamples/*
were updated👉 Check out how to submit a PR 👈