11# JSDoc Workflow
22
33This directory contains the custom JSDoc template, the landing-page generator,
4- and the staging script used to prepare the docs content that is published to the
5- ` gh-pages ` branch.
4+ and the staging script used to prepare the docs content that is published to
5+ GitHub Pages.
6+
7+ The published version set is curated in
8+ [ ` published-versions.json ` ] ( ./published-versions.json ) . That manifest is the
9+ source of truth for which versions appear on the live docs site. Each staging
10+ run rebuilds the whole site from scratch: every listed version is rebuilt from
11+ its Git tag and the in-development version from the current workspace. The
12+ staged tree is therefore a pure function of the manifest plus the tags — there
13+ is no ` gh-pages ` branch state to maintain or drift out of sync.
614
715## Commands
816
@@ -18,52 +26,46 @@ Output:
1826Use this to verify the docs for the version currently declared in
1927` package.json ` .
2028
21- ### ` npm run docs:gh-pages `
29+ ### ` npm run docs:publish `
2230
23- Stage the publishable docs tree under ` build/gh-pages -docs/ ` .
31+ Stage the full publishable docs tree under ` build/published -docs/ ` .
2432
2533Behavior:
2634
27- - reads the currently published version set from ` origin/gh-pages `
28- - preserves that published history
29- - regenerates docs for the current workspace version
35+ - reads the published version set from ` published-versions.json `
36+ - rebuilds every listed version from its Git tag
37+ - rebuilds the current workspace version from the working tree (always included)
3038- rebuilds the staged landing page index
3139
32- This is the normal command to use for a new release.
33-
34- If you delete ` build/ ` and rerun ` npm run docs:gh-pages ` , the staged tree will
35- still contain all currently published versions. That command recreates
36- ` build/gh-pages-docs/ ` by copying the published docs snapshot from
37- ` origin/gh-pages ` , then regenerating only the current workspace version.
40+ This is the normal command to use for a new release, and it is fully
41+ deterministic: deleting ` build/ ` and rerunning reproduces the identical tree.
3842
39- ### ` npm run docs:gh-pages:full `
43+ This does ** not** rebuild docs for every historical ` rclnodejs ` tag — only the
44+ curated subset listed in the manifest. To change which versions are published,
45+ edit ` published-versions.json ` .
4046
41- Fully rebuild the currently published docs history under
42- ` build/gh-pages-docs/ ` .
47+ The script reads the manifest next to it by default. Override the inputs only
48+ for testing:
4349
44- Behavior:
45-
46- - reads the published version set from ` origin/gh-pages `
47- - rebuilds only those published versions from tags
48- - regenerates docs for the current workspace version
49- - rebuilds the staged landing page index
50-
51- This does ** not** rebuild docs for every historical ` rclnodejs ` tag. It only
52- rebuilds the subset that is actually published online.
50+ - ` --manifest <path> ` — use a different version manifest
51+ - ` --out <dir> ` — stage into a different directory
52+ - ` --keep-worktrees ` — leave the temporary Git worktrees in place for inspection
5353
5454## New Release Example
5555
5656For a new release such as ` 1.9.0 ` :
5757
58581 . Update ` package.json ` to ` 1.9.0 ` .
59- 2 . Run ` npm run docs ` .
60- 3 . Verify the local output in ` docs/1.9.0/ ` and ` docs/index.html ` .
61- 4 . Run ` npm run docs:gh-pages ` .
62- 5 . Verify the staged output in:
63- - ` build/gh-pages-docs/docs/1.9.0/ `
64- - ` build/gh-pages-docs/docs/index.html `
65- - ` build/gh-pages-docs/.nojekyll `
66- 6 . Publish the contents of ` build/gh-pages-docs/ ` to the ` gh-pages ` branch.
59+ 2 . Add ` 1.9.0 ` to the ` versions ` array in ` published-versions.json ` .
60+ 3 . Run ` npm run docs ` .
61+ 4 . Verify the local output in ` docs/1.9.0/ ` and ` docs/index.html ` .
62+ 5 . Run ` npm run docs:publish ` .
63+ 6 . Verify the staged output in:
64+ - ` build/published-docs/docs/1.9.0/ `
65+ - ` build/published-docs/docs/index.html `
66+ - ` build/published-docs/.nojekyll `
67+ 7 . Publish the contents of ` build/published-docs/ ` to GitHub Pages (the
68+ ` deploy-docs.yml ` workflow does this automatically on a ` docs-* ` tag).
6769
6870## GitHub Actions Deployment
6971
@@ -82,11 +84,18 @@ so manual dispatches and `docs-*` tag pushes there will not run the docs build.
8284
8385### What it does
8486
85- 1 . Full checkout with all tags and the ` origin/gh-pages ` branch.
86- 2 . Runs ` npm run docs:gh-pages ` to stage the docs tree.
87+ 1 . Full checkout with all tags.
88+ 2 . Runs ` npm run docs:publish ` to stage the docs tree. This reads
89+ ` published-versions.json ` and rebuilds every listed version from its tag
90+ plus the current workspace version.
87913 . Uploads the staged output as a Pages artifact.
88924 . Deploys to GitHub Pages (skipped when ` dry_run ` is ` true ` ).
8993
94+ The workflow only needs ` contents: read ` and never writes to any branch.
95+ Because the manifest plus the Git tags fully describe the published set, the
96+ live site is always reconstructed from a fresh build — nothing can silently
97+ drop off.
98+
9099### Testing
91100
92101- Run the workflow manually with ` dry_run ` enabled first to verify the build
@@ -99,29 +108,29 @@ so manual dispatches and `docs-*` tag pushes there will not run the docs build.
99108## Manual Landing Page Rebuild
100109
101110If the staged docs tree already exists and you only want to rebuild
102- ` build/gh-pages -docs/docs/index.html ` , run ` tools/jsdoc/build-index.js ` against
111+ ` build/published -docs/docs/index.html ` , run ` tools/jsdoc/build-index.js ` against
103112that docs root and point it at the package metadata for the latest published
104113version.
105114
106115Example for published version ` 1.8.0 ` :
107116
108117``` bash
109- mkdir -p build/gh-pages -docs/.tmp
110- git show 1.8.0:package.json > build/gh-pages -docs/.tmp/package-1.8.0.json
118+ mkdir -p build/published -docs/.tmp
119+ git show 1.8.0:package.json > build/published -docs/.tmp/package-1.8.0.json
111120
112- export RCLNODEJS_DOCS_ROOT=" $PWD /build/gh-pages -docs/docs"
113- export RCLNODEJS_DOCS_INDEX_PATH=" $PWD /build/gh-pages -docs/docs/index.html"
121+ export RCLNODEJS_DOCS_ROOT=" $PWD /build/published -docs/docs"
122+ export RCLNODEJS_DOCS_INDEX_PATH=" $PWD /build/published -docs/docs/index.html"
114123export RCLNODEJS_LOCAL_INDEX_PATH=' '
115- export RCLNODEJS_PACKAGE_JSON_PATH=" $PWD /build/gh-pages -docs/.tmp/package-1.8.0.json"
124+ export RCLNODEJS_PACKAGE_JSON_PATH=" $PWD /build/published -docs/.tmp/package-1.8.0.json"
116125
117126node tools/jsdoc/build-index.js
118- rm -rf build/gh-pages -docs/.tmp
127+ rm -rf build/published -docs/.tmp
119128```
120129
121130## Notes
122131
123- - The staged publish output keeps shared assets in ` build/gh-pages -docs/docs/_static/ ` .
132+ - The staged publish output keeps shared assets in ` build/published -docs/docs/_static/ ` .
124133- ` .nojekyll ` must remain in the staged output because the published docs tree
125134 uses an underscore-prefixed directory.
126- - The live docs index is the source of truth for which versions should remain
127- published.
135+ - ` published-versions.json ` is the source of truth for which versions are
136+ published; the Git tags are the content source .
0 commit comments