Skip to content

Commit a3e7562

Browse files
authored
fix(docs): improve handling of nightly versions in bberg Docusaurus config (#19013)
Fixes nightly doc releases
2 parents 07bfac8 + 7ced943 commit a3e7562

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

barretenberg/docs/docusaurus.config.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const path = require("path");
1111
const fs = require("fs");
1212
const macros = require("./src/katex-macros.js");
1313
const versions = require("./versions.json");
14+
const nightlyVersion = versions.find((v) => v.includes("nightly"));
1415

1516
// To redirect /api to the static/api directory in dev mode (netlify handles it in prod)
1617
function apiPlugin(context: any, options: any) {
@@ -90,11 +91,15 @@ const config: Config = {
9091
includeCurrentVersion: process.env.ENV === "dev",
9192
// There should be 2 versions, nightly and stable
9293
// The stable version is second in the list
93-
lastVersion: versions[1],
94+
// Fall back to versions[0] if only one version exists (e.g., during release builds)
95+
lastVersion: versions[1] ?? versions[0],
9496
versions: {
95-
[versions[0]]: {
96-
...(versions[0].includes("nightly") && { path: "nightly" }),
97-
},
97+
...(nightlyVersion && versions[1] && {
98+
[nightlyVersion]: {
99+
path: "nightly",
100+
banner: "unreleased",
101+
},
102+
}),
98103
...(process.env.ENV === "dev" && {
99104
current: {
100105
label: "dev",

0 commit comments

Comments
 (0)