Skip to content

Commit 0d3ff52

Browse files
authored
docs(website): allow release-line snapshot refresh (#461)
Signed-off-by: Roel de Cort <roel.decort@adfinis.com>
1 parent 04afc49 commit 0d3ff52

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

website/docusaurus.config.ts

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import fs from 'node:fs';
12
import {themes as prismThemes} from 'prism-react-renderer';
23
import type {Config} from '@docusaurus/types';
34
import type * as Preset from '@docusaurus/preset-classic';
@@ -11,6 +12,26 @@ const docsPluginDefaultExclude = [
1112
'**/*.test.{js,jsx,ts,tsx}',
1213
'**/__tests__/**',
1314
];
15+
const releaseLineVersionLabels = {
16+
'0.2.0': '0.2.x',
17+
'0.1.0': '0.1.x',
18+
} as const;
19+
20+
function readDocsVersions(): string[] {
21+
try {
22+
const versions = JSON.parse(fs.readFileSync(new URL('./versions.json', import.meta.url), 'utf8'));
23+
return Array.isArray(versions) ? versions : [];
24+
} catch {
25+
return [];
26+
}
27+
}
28+
29+
const docsVersions = new Set(readDocsVersions());
30+
const releaseLineVersions = Object.fromEntries(
31+
Object.entries(releaseLineVersionLabels)
32+
.filter(([version]) => docsVersions.has(version))
33+
.map(([version, label]) => [version, {label}]),
34+
);
1435

1536
const config: Config = {
1637
title: 'OpenBao Operator',
@@ -65,12 +86,7 @@ const config: Config = {
6586
label: 'next',
6687
path: 'next',
6788
},
68-
'0.2.0': {
69-
label: '0.2.x',
70-
},
71-
'0.1.0': {
72-
label: '0.1.x',
73-
},
89+
...releaseLineVersions,
7490
},
7591
},
7692
blog: false,

0 commit comments

Comments
 (0)