Skip to content

Commit a213f8b

Browse files
committed
docs: add archived release version mapping
1 parent 781c6f2 commit a213f8b

8 files changed

Lines changed: 600 additions & 48 deletions

File tree

README.md

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ hugegraph-doc/
5959

6060
## Documentation Versions
6161

62-
The source tree keeps only current documentation and version metadata. Docusaurus release snapshots are generated before `npm run start` and `npm run build` from Docusaurus-native Markdown sources. A version entry may set `sourceRef` to read from a Git branch or tag; when it is omitted, the current working tree is used.
62+
The source tree keeps only current documentation and version metadata. Docusaurus release snapshots are generated before `npm run start` and `npm run build` from the configured Git source refs. A version entry may set `sourceRef` to read from a Git branch or tag; when it is omitted, the current working tree is used.
6363

6464
Version semantics:
6565

@@ -68,6 +68,19 @@ Version semantics:
6868
| `stable` | `/docs/`, `/cn/docs/` | Latest stable release documentation and the default navbar target |
6969
| `current` / `next` | `/docs/next/`, `/cn/docs/next/` | Unreleased development documentation with an unreleased banner |
7070

71+
Release-branch mapping is explicit:
72+
73+
| Source branch | Docusaurus version / route segment | UI label |
74+
|---------------|------------------------------------|----------|
75+
| `release-1.5.0` | `docusaurus-1.5.0` | `1.5.0` |
76+
| `release-1.3.0` | `docusaurus-1.3.0` | `1.3.0` |
77+
| `release-1.2.0` | `docusaurus-1.2.0` | `1.2.0` |
78+
| `release-1.0.0` | `docusaurus-1.0.0` | `1.0.0` |
79+
| `release-0.11` | `docusaurus-0.11` | `0.11` |
80+
| `release-0.10` | `docusaurus-0.10` | `0.10` |
81+
82+
The source branch prefix is never shown in the UI. The archived release branches listed above were authored before this Docusaurus migration, so any import repair for those snapshots is isolated under `legacyCompatibility` in `src/data/versions.json`. That compatibility layer is only for adapting those historical branches to a previewable Docusaurus build; it is not part of the normal documentation authoring or version generation pipeline. Future Docusaurus-native release branches should keep the standard `content/{en,cn}/docs` layout and should not require those adapters.
83+
7184
Generate the Docusaurus version files locally:
7285

7386
```bash
@@ -82,12 +95,14 @@ List configured versions:
8295
npm run docs:versions:list
8396
```
8497

85-
To update the stable release source:
98+
To update a release source:
8699

87-
1. Update the stable entry in `src/data/versions.json`, especially `label`, `githubTagUrl`, and `sourceRef` if the stable docs should come from a branch or tag.
88-
2. Make sure the source ref contains Docusaurus-native docs and is fetched locally. CI uses `fetch-depth: 0`, so tags and release branches are available there.
100+
1. Update the entry in `src/data/versions.json`, especially `label`, `docusaurusVersion`, `path`, `cnPath`, `githubTagUrl`, and `sourceRef`.
101+
2. Make sure the source ref is fetched locally. CI uses `fetch-depth: 0`, so tags and release branches are available there.
89102
3. Run `npm run docs:versions:prepare`, then `npm run build`.
90103

104+
Only archived pre-Docusaurus branches should use `legacyCompatibility` fields such as `sourcePaths`, `sourceIncludes`, `sourceOverlays`, `indexFrom`, or Markdown normalization. These fields document deliberate compatibility work for old snapshots, not guidance for new documentation.
105+
91106
Do not use `latest` ambiguously in docs navigation. Use `stable` for the latest released documentation and `next` for unreleased documentation.
92107

93108
## Team and User Data
@@ -220,13 +235,26 @@ hugegraph-doc/
220235

221236
### 文档版本
222237

223-
源码分支只保留当前文档和版本元数据。Docusaurus 需要的版本快照会在 `npm run start``npm run build` 前,从 Docusaurus 原生 Markdown 源生成。版本条目可以通过 `sourceRef` 指向 Git 分支或标签;未设置时使用当前工作区文档。
238+
源码分支只保留当前文档和版本元数据。Docusaurus 需要的版本快照会在 `npm run start``npm run build` 前,从配置的 Git source ref 生成。版本条目可以通过 `sourceRef` 指向 Git 分支或标签;未设置时使用当前工作区文档。
224239

225240
| 版本 | 路由 | 含义 |
226241
|------|------|------|
227242
| `stable` | `/docs/`, `/cn/docs/` | 最新稳定版本文档,也是导航栏默认入口 |
228243
| `current` / `next` | `/docs/next/`, `/cn/docs/next/` | 未发布开发中文档,并展示 unreleased 提示 |
229244

245+
发布分支映射规则是显式配置的:
246+
247+
| 源分支 | Docusaurus 版本 / 路由段 | UI 展示 |
248+
|--------|--------------------------|---------|
249+
| `release-1.5.0` | `docusaurus-1.5.0` | `1.5.0` |
250+
| `release-1.3.0` | `docusaurus-1.3.0` | `1.3.0` |
251+
| `release-1.2.0` | `docusaurus-1.2.0` | `1.2.0` |
252+
| `release-1.0.0` | `docusaurus-1.0.0` | `1.0.0` |
253+
| `release-0.11` | `docusaurus-0.11` | `0.11` |
254+
| `release-0.10` | `docusaurus-0.10` | `0.10` |
255+
256+
UI 不展示源分支的 `release-` 前缀。上表中的归档 release 分支是在这次 Docusaurus 迁移之前编写的,所以为了让这些历史快照可以被 Docusaurus 预览,相关导入修补都被限制在 `src/data/versions.json``legacyCompatibility` 下。这一层只用于适配这些旧分支,不属于正常的文档编写或版本生成流水线。未来 Docusaurus 原生的发布分支应保持标准的 `content/{en,cn}/docs` 目录,不应依赖这些适配项。
257+
230258
本地生成 Docusaurus 版本文件:
231259

232260
```bash
@@ -235,7 +263,9 @@ npm run docs:versions:prepare
235263

236264
该命令会生成 `versioned_docs/``versioned_sidebars/``versions.json``docs-cn_versioned_docs/``docs-cn_versioned_sidebars/``docs-cn_versions.json`。这些是构建输入,不作为源码提交。
237265

238-
更新 stable 版本时,请修改 `src/data/versions.json` 中的 `label``githubTagUrl`,如果 stable 文档来自单独分支或标签,再设置 `sourceRef`。该 ref 必须已经使用 Docusaurus 原生路径整理好,并且本地已经 fetch,然后运行 `npm run docs:versions:prepare``npm run build`
266+
更新发布版本时,请修改 `src/data/versions.json` 中的 `label``docusaurusVersion``path``cnPath``githubTagUrl``sourceRef`。该 ref 需要已经 fetch 到本地,然后运行 `npm run docs:versions:prepare``npm run build`
267+
268+
只有归档的 pre-Docusaurus 分支才应该使用 `legacyCompatibility` 下的 `sourcePaths``sourceIncludes``sourceOverlays``indexFrom` 或 Markdown normalization。这些字段用于记录旧快照的兼容目的,不是新文档的开发规范。
239269

240270
不要在导航中模糊使用 `latest``stable` 表示最新已发布版本,`next` 表示未发布开发中文档。
241271

docusaurus.config.js

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,40 @@ const apacheLinks = [
1515
const docsExclude = ['**/_*/**', '**/SUMMARY.md', '**/*.test.{js,jsx,ts,tsx}', '**/__tests__/**'];
1616

1717
const currentDocsVersion = docsVersions.find((version) => version.status === 'next');
18-
const stableDocsVersion = docsVersions.find((version) => version.id === 'stable');
18+
const releaseDocsVersions = docsVersions.filter((version) => version.status !== 'next');
19+
20+
function docsRoutePath(version) {
21+
if (version.id === 'stable') {
22+
return '';
23+
}
24+
return version.docusaurusVersion || version.id;
25+
}
26+
27+
function docsVersionConfig(version) {
28+
return {
29+
label: version.label,
30+
path: docsRoutePath(version),
31+
banner: version.status === 'archived' ? 'unmaintained' : 'none',
32+
badge: true,
33+
};
34+
}
1935

2036
const docsVersionOptions = {
2137
lastVersion: 'stable',
2238
includeCurrentVersion: true,
23-
versions: {
24-
current: {
25-
label: currentDocsVersion.label,
26-
path: 'next',
27-
banner: 'unreleased',
28-
badge: true,
29-
noIndex: true,
30-
},
31-
stable: {
32-
label: stableDocsVersion.label,
33-
path: '',
34-
banner: 'none',
35-
badge: true,
36-
},
37-
},
39+
versions: Object.fromEntries([
40+
[
41+
'current',
42+
{
43+
label: currentDocsVersion.label,
44+
path: 'next',
45+
banner: 'unreleased',
46+
badge: true,
47+
noIndex: true,
48+
},
49+
],
50+
...releaseDocsVersions.map((version) => [version.docusaurusVersion || version.id, docsVersionConfig(version)]),
51+
]),
3852
};
3953

4054
const docsCnVersionOptions = {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"description": "Apache HugeGraph documentation website built with Docusaurus.",
66
"scripts": {
77
"start": "npm run docs:versions:prepare && docusaurus start --host 0.0.0.0",
8-
"build": "npm run docs:versions:prepare && npm run check:content-visibility && docusaurus build",
8+
"build": "npm run docs:versions:prepare && npm run check:content-visibility && DOCUSAURUS_SSR_CONCURRENCY=1 DOCUSAURUS_SSG_WORKER_THREAD_COUNT=1 TERSER_PARALLEL=false NODE_OPTIONS=--max-old-space-size=8192 docusaurus build",
99
"serve": "docusaurus serve --host 0.0.0.0",
1010
"clear": "docusaurus clear",
1111
"docs:version": "node scripts/version-docs.mjs",

scripts/list-docs-versions.mjs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,26 @@ const releaseVersions = metadata
1717
console.log('HugeGraph documentation versions');
1818
console.log('');
1919
for (const version of metadata) {
20+
const docusaurusVersion = version.docusaurusVersion || version.id;
2021
console.log(`- ${version.label} [${version.status}]`);
22+
console.log(` Docusaurus version: ${docusaurusVersion}`);
2123
console.log(` EN: ${version.path}`);
2224
console.log(` CN: ${version.cnPath}`);
2325
if (version.releaseDate) {
2426
console.log(` Released: ${version.releaseDate}`);
2527
}
2628
if (version.githubTagUrl) {
27-
console.log(` Tag: ${version.githubTagUrl}`);
29+
console.log(` Source URL: ${version.githubTagUrl}`);
2830
}
2931
if (version.sourceRef) {
3032
console.log(` Source ref: ${version.sourceRef}`);
3133
}
34+
if (version.sourceRef && docusaurusVersion !== version.sourceRef) {
35+
console.log(` Mapping: ${version.sourceRef} -> ${docusaurusVersion} -> ${version.label}`);
36+
}
37+
if (version.legacyCompatibility?.enabled) {
38+
console.log(' Legacy compatibility: enabled for archived-branch import only');
39+
}
3240
}
3341
console.log('');
3442
console.log(`Generated Docusaurus release versions: ${releaseVersions.join(', ') || '(none)'}`);

0 commit comments

Comments
 (0)