Skip to content

Commit 454bcb4

Browse files
authored
chore(docs): prune docs snapshots that are never built, and bound the directory (#13608)
1 parent d91f1b3 commit 454bcb4

2,004 files changed

Lines changed: 20 additions & 247191 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,21 @@ yarn cut_version <VERSION>
101101

102102
For example: `yarn cut_version v1.0.0-beta.20`
103103

104-
This script does three things:
104+
This script does four things:
105105

106106
1. Removes the new version from `versions.json` (since `yarn version::stables` will have added it
107107
from the GitHub release, but the versioned docs snapshot doesn't exist yet).
108108
2. Builds the docs (running preprocessing to resolve `#include_code` directives and generate the
109109
Nargo CLI reference).
110110
3. Runs `yarn docusaurus docs:version <VERSION>` to snapshot the current docs into
111111
`versioned_docs/version-<VERSION>/` and create a matching sidebar in `versioned_sidebars/`.
112+
4. Deletes any snapshot older than the newest `VERSIONS_TO_KEEP` (see `scripts/cut_version.sh`),
113+
keeping `versioned_docs/` bounded. Only the versions listed in `versions.json` are ever built
114+
and served — `scripts/setStable.ts` caps that list at `NUMBER_OF_VERSIONS_TO_SHOW` — so older
115+
snapshots are dead weight in the repository. `VERSIONS_TO_KEEP` is deliberately larger than
116+
`NUMBER_OF_VERSIONS_TO_SHOW`, so raising the number of served versions does not immediately
117+
require re-cutting a snapshot that has already been deleted. Docs for deleted versions remain
118+
available at their published URLs and in git history.
112119

113120
After this, the new version will appear in the version dropdown on the site.
114121

docs/scripts/cut_version.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,15 @@ yarn build
1414

1515
# Finally cut the actual new docs version.
1616
yarn docusaurus docs:version $VERSION
17+
18+
# Docusaurus only builds the versions listed in `versions.json`, which `scripts/setStable.ts`
19+
# caps at NUMBER_OF_VERSIONS_TO_SHOW. Snapshots older than that are never built, routed or
20+
# linked, so drop them here instead of carrying one more directory per release forever.
21+
# Keep more than are served so that raising NUMBER_OF_VERSIONS_TO_SHOW does not immediately
22+
# require re-cutting docs that were already deleted.
23+
VERSIONS_TO_KEEP=8
24+
25+
ls -1 versioned_docs | sort -rV | tail -n +$((VERSIONS_TO_KEEP + 1)) | while read -r dir; do
26+
echo "Pruning docs snapshot that is no longer served: $dir"
27+
rm -rf "versioned_docs/$dir" "versioned_sidebars/${dir}-sidebars.json"
28+
done

docs/versioned_docs/version-v1.0.0-beta.10/explainers/explainer-oracle.md

Lines changed: 0 additions & 57 deletions
This file was deleted.

docs/versioned_docs/version-v1.0.0-beta.10/explainers/explainer-recursion.md

Lines changed: 0 additions & 176 deletions
This file was deleted.

0 commit comments

Comments
 (0)