Please note: THIS CANNOT BUILD AND DEPLOY UNTIL THE LINKS (fixed in separate ticket) are merged first
Goal: fail yarn build if broken anchors exist.
From the docs, this is not configurable within docusaurus, so I had to do it separately by building a separate js script.
This adds about 1-2 minutes to the yarn build cycle and will not be picked up by yarn start. Only broken links will be. So you must always run yarn build prior to push.
To test:
cd documentation
$ git fetch --all
$ git checkout --track origin/EDU-2887
branch 'EDU-2887' set up to track 'origin/EDU-2887'.
Switched to a new branch 'EDU-2887'
$ git branch
* EDU-2887
main
$ git status
On branch EDU-2887
Your branch is up to date with 'origin/EDU-2887'.
nothing to commit, working tree clean
$ yarn build
...
If you don't have a broken anchor, please temporarily add one to test before and after.
Previous build
docs% yarn build
yarn run v1.22.22
warning ../../../../package.json: No license field
$ docusaurus build && node ./check-broken-anchors.js
(node:73287) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[INFO] [en] Creating an optimized production build...
✔ Client
Compiled successfully in 1.86s
✔ Server
[WARNING] Docusaurus found broken anchors!
Please check the pages of your site in the list below, and make sure you don't reference any anchor that does not exist.
Note: it's possible to ignore broken anchors with the 'onBrokenAnchors' Docusaurus configuration, and let the build pass.
Exhaustive list of all broken anchors found:
- Broken anchor on source page path = /cli/batch:
-> linking to /encyclopedia/workflow-message-passing#signals
- Broken anchor on source page path = /cli/operator:
-> linking to /encyclopedia/workflow-message-passing#queries
- Broken anchor on source page path = /cli/workflow:
-> linking to /encyclopedia/workflow-message-passing#queries
-> linking to /encyclopedia/workflow-message-passing#signals
- Broken anchor on source page path = /cloud/namespaces:
-> linking to /encyclopedia/workflow-message-passing#signals
[etc]
Despite this, the process ends with:
[SUCCESS] Generated static files in "build".
[INFO] Use `npm run serve` command to test your build locally.
New behavior
[cause]: Error: Docusaurus found broken anchors!
Please check the pages of your site in the list below, and make sure you don't reference any anchor that does not exist.
Note: it's possible to ignore broken anchors with the 'onBrokenAnchors' Docusaurus configuration, and let the build pass.
Exhaustive list of all broken anchors found:
Please note: THIS CANNOT BUILD AND DEPLOY UNTIL THE LINKS (fixed in separate ticket) are merged first
Goal: fail
yarn build
if broken anchors exist.From the docs, this is not configurable within docusaurus, so I had to do it separately by building a separate js script.
This adds about 1-2 minutes to the yarn build cycle and will not be picked up by yarn start. Only broken links will be. So you must always run yarn build prior to push.
To test:
If you don't have a broken anchor, please temporarily add one to test before and after.
Previous build
Despite this, the process ends with:
New behavior