This is an automated email from the ASF dual-hosted git repository.

400Ping pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/mahout.git


The following commit(s) were added to refs/heads/main by this push:
     new dccc97dba feat: add local docs versioning validation (#1427)
dccc97dba is described below

commit dccc97dbad6ca6c611caad25f82d96f64591f682
Author: Vic Wen <[email protected]>
AuthorDate: Thu Jul 2 19:06:54 2026 +0800

    feat: add local docs versioning validation (#1427)
---
 website/README.md               |  6 ++++-
 website/package.json            |  2 +-
 website/scripts/version-docs.js | 58 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/website/README.md b/website/README.md
index 2955edbdd..8a36da761 100644
--- a/website/README.md
+++ b/website/README.md
@@ -175,16 +175,20 @@ served as `latest` at `/docs`; the editable current docs 
are served at `/docs/ne
 When releasing, snapshot the current docs:
 
 ```bash
-npm run docusaurus docs:version <release-version>
+npm run version -- <release-version>
 ```
 
 This creates:
 - `versioned_docs/version-<release-version>/` - Frozen snapshot
 - Updates `versions.json`
+- Validates the generated versioned docs with a production Docusaurus build
 
 `docusaurus.config.ts` reads `versions.json` automatically, so release updates
 should not require editing the Docusaurus version configuration.
 
+The command runs the documentation sync first, so generated Python API 
reference
+pages are included in the version snapshot before the local build validation.
+
 ## Blog Posts
 
 Blog posts live in `website/blog/`:
diff --git a/website/package.json b/website/package.json
index 386a65944..95ccdb28e 100644
--- a/website/package.json
+++ b/website/package.json
@@ -17,7 +17,7 @@
     "write-translations": "docusaurus write-translations",
     "write-heading-ids": "docusaurus write-heading-ids",
     "typecheck": "tsc",
-    "version": "docusaurus docs:version"
+    "version": "node scripts/version-docs.js"
   },
   "dependencies": {
     "@docusaurus/core": "3.10.1",
diff --git a/website/scripts/version-docs.js b/website/scripts/version-docs.js
new file mode 100644
index 000000000..9f57688ea
--- /dev/null
+++ b/website/scripts/version-docs.js
@@ -0,0 +1,58 @@
+#!/usr/bin/env node
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+const { spawnSync } = require('child_process');
+
+function usage() {
+  console.error('Usage: npm run version -- <release-version>');
+  console.error('');
+  console.error('Example: npm run version -- 0.7');
+}
+
+function run(command, args) {
+  const result = spawnSync(command, args, {
+    cwd: process.cwd(),
+    stdio: 'inherit',
+    shell: process.platform === 'win32',
+  });
+
+  if (result.error) {
+    throw result.error;
+  }
+
+  if (result.status !== 0) {
+    process.exit(result.status);
+  }
+}
+
+function main() {
+  const version = process.argv[2];
+
+  if (!version || version.startsWith('-')) {
+    usage();
+    process.exit(1);
+  }
+
+  console.log(`Preparing versioned docs for ${version}...`);
+  run('npm', ['run', 'sync']);
+  run('npm', ['run', 'docusaurus', '--', 'docs:version', version]);
+  run('npm', ['run', 'build']);
+}
+
+main();

Reply via email to