Skip to content

build, doc: use new api doc tooling #57343

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

flakey5
Copy link
Member

@flakey5 flakey5 commented Mar 6, 2025

Switches over to using the new doc generation tooling. For more background on this, please see #52343

Currently a draft just to get feedback on the approach to this integration.

cc @nodejs/web-infra

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/nodejs-website
  • @nodejs/web-infra

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. doc Issues and PRs related to the documentations. needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory. windows Issues and PRs related to the Windows platform. labels Mar 6, 2025
@flakey5 flakey5 marked this pull request as draft March 6, 2025 06:24
@flakey5 flakey5 force-pushed the flakey5/20250305/api-docs-tooling branch from 77ede22 to 3423c21 Compare March 6, 2025 06:29
@flakey5 flakey5 force-pushed the flakey5/20250305/api-docs-tooling branch from 3423c21 to 451f8a7 Compare March 6, 2025 06:31
Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

@flakey5 I guess you also need to check our GitHub Action Workflows, and also other mentions of these files within the source.

Like within the Contributor Docs, there is a file that describes how the legacy API doc tooling works, and I believe there are other references also.

@flakey5 flakey5 force-pushed the flakey5/20250305/api-docs-tooling branch 3 times, most recently from cf2609b to a3ce99d Compare March 10, 2025 22:04
@flakey5 flakey5 marked this pull request as ready for review March 10, 2025 22:05
@flakey5
Copy link
Member Author

flakey5 commented Mar 10, 2025

lint-js-and-md is failing because of the linting errors since it exits with a non-zero status code if there's anything wrong with the docs. I think we should skip the REPLACEME checks for normal ci runs.

It also looks like synopsis.md fails the introduced_in check because it's not under the top-level header, should it be enforced that introduced_in goes under the top-level header or should we change it to just check that it exists somewhere in the file (like it was doing previously)?

@flakey5
Copy link
Member Author

flakey5 commented Mar 10, 2025

Also not sure what's going on with lint-addon-docs? cc @araujogui

@ovflowd
Copy link
Member

ovflowd commented Mar 10, 2025

lint-js-and-md is failing because of the linting errors since it exits with a non-zero status code if there's anything wrong with the docs. I think we should skip the REPLACEME checks for normal ci runs.

It also looks like synopsis.md fails the introduced_in check because it's not under the top-level header, should it be enforced that introduced_in goes under the top-level header or should we change it to just check that it exists somewhere in the file (like it was doing previously)?

REPLACEME shouldn't error, imo, just give a warning. Our linter should have warn and error levels.

And yes introduced_in must be top level!

Copy link

codecov bot commented Mar 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.97%. Comparing base (049664b) to head (6b0cd66).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #57343      +/-   ##
==========================================
- Coverage   90.06%   89.97%   -0.09%     
==========================================
  Files         645      643       -2     
  Lines      189130   188695     -435     
  Branches    37094    36945     -149     
==========================================
- Hits       170339   169783     -556     
- Misses      11511    11680     +169     
+ Partials     7280     7232      -48     

see 45 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@araujogui
Copy link
Member

lint-js-and-md is failing because of the linting errors since it exits with a non-zero status code if there's anything wrong with the docs. I think we should skip the REPLACEME checks for normal ci runs.

It also looks like synopsis.md fails the introduced_in check because it's not under the top-level header, should it be enforced that introduced_in goes under the top-level header or should we change it to just check that it exists somewhere in the file (like it was doing previously)?

Actually, the linter only returns 1 if there's an error-level issue, and I don't think that's the case here.

image

@araujogui
Copy link
Member

Also not sure what's going on with lint-addon-docs? cc @araujogui

I’m not sure either, but I’ll check it out.

@ovflowd
Copy link
Member

ovflowd commented Mar 12, 2025

@flakey5:

3:1-3:9   warning Use "the Node.js" instead of "Node.js'" prohibited-strings remark-lint
4:46-4:50 warning Use "Node.js" instead of "Node"         prohibited-strings remark-lint

On the README.md file you updated (tools/doc/README.md) after updating those can you run make format-md (?)

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

This is the result of many months of arduous work between many awesome folks, including @flakey5 @AugustinMauroy @araujogui @ovflowd @avivkeller and others.

I'm so proud of what we are achieving here and this is a huge step towards a modern tooling and a revamped API docs within Node.js

Approving, as I believe this is ready!

@ovflowd
Copy link
Member

ovflowd commented Mar 13, 2025

cc @nodejs/collaborators can we have another approval here? 🙏

Copy link
Member

@lpinca lpinca left a comment

Choose a reason for hiding this comment

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

RSLGTM because it is hard to review and outside of my comfort zone.

@flakey5
Copy link
Member Author

flakey5 commented May 28, 2025

Hmmm -c $(call available-node, -p 'url.pathToFileURL("CHANGELOG.md")') \ is causing this to be thrown: /bin/sh: 4: Syntax error: "then" unexpected (expecting "fi")

@aduh95
Copy link
Contributor

aduh95 commented May 28, 2025

Hmmm -c $(call available-node, -p 'url.pathToFileURL("CHANGELOG.md")') \ is causing this to be thrown: /bin/sh: 4: Syntax error: "then" unexpected (expecting "fi")

The fix would be to have the tooling take a path rather than a URL

flakey5 added a commit to nodejs/api-docs-tooling that referenced this pull request May 31, 2025
flakey5 added a commit to nodejs/api-docs-tooling that referenced this pull request May 31, 2025
flakey5 added a commit to nodejs/api-docs-tooling that referenced this pull request May 31, 2025
avivkeller pushed a commit to nodejs/api-docs-tooling that referenced this pull request Jun 1, 2025
@flakey5 flakey5 force-pushed the flakey5/20250305/api-docs-tooling branch from 09e8384 to 0702f56 Compare June 6, 2025 23:33
@flakey5 flakey5 requested a review from aduh95 June 6, 2025 23:35
@ovflowd
Copy link
Member

ovflowd commented Jun 7, 2025

cc @aduh95 are we good to merge?

@ovflowd
Copy link
Member

ovflowd commented Jun 7, 2025

(or is something still failing?)

@flakey5
Copy link
Member Author

flakey5 commented Jun 14, 2025

cc @aduh95 are we good to merge?

bump 😄

@aduh95
Copy link
Contributor

aduh95 commented Jun 18, 2025

I'm getting the following error when I try to generate several files:

Error: EEXIST: file already exists, mkdir '/Users/duhamean/Documents/node/out/doc/api/assets'
    at async mkdir (node:internal/fs/promises:857:10)
    at async mkDirAndCopy (node:internal/fs/cp/cp:308:3)
    at async Object.generate (file:///Users/duhamean/Documents/node/tools/doc/node_modules/@node-core/api-docs-tooling/src/generators/legacy-html/index.mjs:180:7)
Makefile:827: warning: pattern recipe did not update peer target 'out/doc/api/http2.json'.
make[1]: *** [Makefile:827: out/doc/api/embedding.html] Error 1

@ovflowd
Copy link
Member

ovflowd commented Jun 18, 2025

I'm getting the following error when I try to generate several files:

Error: EEXIST: file already exists, mkdir '/Users/duhamean/Documents/node/out/doc/api/assets'
    at async mkdir (node:internal/fs/promises:857:10)
    at async mkDirAndCopy (node:internal/fs/cp/cp:308:3)
    at async Object.generate (file:///Users/duhamean/Documents/node/tools/doc/node_modules/@node-core/api-docs-tooling/src/generators/legacy-html/index.mjs:180:7)
Makefile:827: warning: pattern recipe did not update peer target 'out/doc/api/http2.json'.
make[1]: *** [Makefile:827: out/doc/api/embedding.html] Error 1

@flakey5 any idea here? Is this trying to generate all the files at the same time? Individual file generation should still work, no?

@flakey5
Copy link
Member Author

flakey5 commented Jun 22, 2025

any idea here? Is this trying to generate all the files at the same time? Individual file generation should still work, no?

What's the command being used?

@ovflowd
Copy link
Member

ovflowd commented Jun 22, 2025

any idea here? Is this trying to generate all the files at the same time? Individual file generation should still work, no?

What's the command being used?

☝️ @aduh95

@aduh95
Copy link
Contributor

aduh95 commented Jun 22, 2025

any idea here? Is this trying to generate all the files at the same time? Individual file generation should still work, no?

What's the command being used?

make docclean out/doc/api/addons.html out/doc/api/assert.html out/doc/api/async_context.html out/doc/api/async_hooks.html out/doc/api/buffer.html out/doc/api/child_process.html out/doc/api/cli.html out/doc/api/cluster.html out/doc/api/console.html out/doc/api/corepack.html out/doc/api/crypto.html out/doc/api/debugger.html out/doc/api/deprecations.html out/doc/api/dgram.html out/doc/api/diagnostics_channel.html out/doc/api/dns.html out/doc/api/documentation.html out/doc/api/domain.html out/doc/api/embedding.html out/doc/api/errors.html out/doc/api/esm.html out/doc/api/events.html out/doc/api/fs.html out/doc/api/globals.html out/doc/api/http.html out/doc/api/http2.html out/doc/api/https.html out/doc/api/index.html out/doc/api/inspector.html out/doc/api/intl.html out/doc/api/module.html out/doc/api/modules.html out/doc/api/n-api.html out/doc/api/net.html out/doc/api/os.html out/doc/api/packages.html out/doc/api/path.html out/doc/api/perf_hooks.html out/doc/api/permissions.html out/doc/api/process.html out/doc/api/punycode.html out/doc/api/querystring.html out/doc/api/quic.html out/doc/api/readline.html out/doc/api/repl.html out/doc/api/report.html out/doc/api/single-executable-applications.html out/doc/api/sqlite.html out/doc/api/stream.html out/doc/api/string_decoder.html out/doc/api/synopsis.html out/doc/api/test.html out/doc/api/timers.html out/doc/api/tls.html out/doc/api/tracing.html out/doc/api/tty.html out/doc/api/typescript.html out/doc/api/url.html out/doc/api/util.html out/doc/api/v8.html out/doc/api/vm.html out/doc/api/wasi.html out/doc/api/webcrypto.html out/doc/api/webstreams.html out/doc/api/worker_threads.html out/doc/api/zlib.html out/doc/api/addons.json out/doc/api/assert.json out/doc/api/async_context.json out/doc/api/async_hooks.json out/doc/api/buffer.json out/doc/api/child_process.json out/doc/api/cli.json out/doc/api/cluster.json out/doc/api/console.json out/doc/api/corepack.json out/doc/api/crypto.json out/doc/api/debugger.json out/doc/api/deprecations.json out/doc/api/dgram.json out/doc/api/diagnostics_channel.json out/doc/api/dns.json out/doc/api/documentation.json out/doc/api/domain.json out/doc/api/embedding.json out/doc/api/errors.json out/doc/api/esm.json out/doc/api/events.json out/doc/api/fs.json out/doc/api/globals.json out/doc/api/http.json out/doc/api/http2.json out/doc/api/https.json out/doc/api/index.json out/doc/api/inspector.json out/doc/api/intl.json out/doc/api/module.json out/doc/api/modules.json out/doc/api/n-api.json out/doc/api/net.json out/doc/api/os.json out/doc/api/packages.json out/doc/api/path.json out/doc/api/perf_hooks.json out/doc/api/permissions.json out/doc/api/process.json out/doc/api/punycode.json out/doc/api/querystring.json out/doc/api/quic.json out/doc/api/readline.json out/doc/api/repl.json out/doc/api/report.json out/doc/api/single-executable-applications.json out/doc/api/sqlite.json out/doc/api/stream.json out/doc/api/string_decoder.json out/doc/api/synopsis.json out/doc/api/test.json out/doc/api/timers.json out/doc/api/tls.json out/doc/api/tracing.json out/doc/api/tty.json out/doc/api/typescript.json out/doc/api/url.json out/doc/api/util.json out/doc/api/v8.json out/doc/api/vm.json out/doc/api/wasi.json out/doc/api/webcrypto.json out/doc/api/webstreams.json out/doc/api/worker_threads.json out/doc/api/zlib.json -j12

@avivkeller
Copy link
Member

avivkeller commented Jun 22, 2025

Shouldn't opts be passed here, which'll include the force used in the cp call in api-docs-tooling?

@flakey5 flakey5 force-pushed the flakey5/20250305/api-docs-tooling branch 2 times, most recently from c3830e2 to 6d3ef92 Compare June 28, 2025 06:52
@aduh95
Copy link
Contributor

aduh95 commented Jun 28, 2025

It looks like CI's failing on a missing fi

@avivkeller
Copy link
Member

@aduh95 We’ve drastically improved performance, so I hope we’ve resolved all your concerns 😃

@ovflowd
Copy link
Member

ovflowd commented Jul 4, 2025

@aduh95 We’ve drastically improved performance, so I hope we’ve resolved all your concerns 😃

Shouldn't we update the version being used here on the package.json?

@aduh95
Copy link
Contributor

aduh95 commented Jul 4, 2025

@aduh95 We’ve drastically improved performance, so I hope we’ve resolved all your concerns 😃

Shouldn't we update the version being used here on the package.json?

I think that's indeed needed as I'm still getting Error: EEXIST: file already exists, mkdir '…/out/doc/api/assets' on 0194b0e when running make docclean docserve -j.
Also there are conflicts to solve.

Switches over to using the new doc generation tooling.
For more background on this, please see nodejs#52343

Signed-off-by: flakey5 <[email protected]>

Co-authored-by: Claudio W <[email protected]>
Co-authored-by: avivkeller <[email protected]>
Co-authored-by: Antoine du Hamel <[email protected]>
@flakey5 flakey5 force-pushed the flakey5/20250305/api-docs-tooling branch from 0194b0e to 6b0cd66 Compare July 12, 2025 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. doc Issues and PRs related to the documentations. needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging this pull request may close these issues.