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

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new accd422ce Fix documentation build issue.
accd422ce is described below

commit accd422ce118c053a039d46ad5824e29eadb6760
Author: James Bognar <[email protected]>
AuthorDate: Tue Sep 23 10:15:13 2025 -0400

    Fix documentation build issue.
---
 juneau-docs-poc/docusaurus.config.ts       |   5 --
 juneau-docs-poc/package.json               |   6 +-
 juneau-docs-poc/scripts/preprocess-docs.js | 114 +++++++++++++++++++++++++++++
 3 files changed, 118 insertions(+), 7 deletions(-)

diff --git a/juneau-docs-poc/docusaurus.config.ts 
b/juneau-docs-poc/docusaurus.config.ts
index dd6b93bbd..ba6bd1e3b 100644
--- a/juneau-docs-poc/docusaurus.config.ts
+++ b/juneau-docs-poc/docusaurus.config.ts
@@ -15,7 +15,6 @@ import {themes as prismThemes} from 'prism-react-renderer';
 import type {Config} from '@docusaurus/types';
 import type * as Preset from '@docusaurus/preset-classic';
 import remarkJuneauLinks from './src/plugins/remark-juneau-links';
-const remarkVersionReplacer = require('./src/plugins/remark-version-replacer');
 
 // This runs in Node.js - Don't use client-side code here (browser APIs, 
JSX...)
 
@@ -68,10 +67,6 @@ const config: Config = {
           editUrl:
             
'https://github.com/apache/juneau/tree/main/juneau-docs-poc/juneau-documentation/',
           remarkPlugins: [
-            [remarkVersionReplacer, {
-              version: '9.0.1',
-              apiDocsUrl: '../apidocs'
-            }],
             [remarkJuneauLinks, {
               packageAbbreviations: {
                 'oaj': 'org.apache.juneau',
diff --git a/juneau-docs-poc/package.json b/juneau-docs-poc/package.json
index 7ee2f3ccf..b2b47935d 100644
--- a/juneau-docs-poc/package.json
+++ b/juneau-docs-poc/package.json
@@ -4,8 +4,9 @@
   "private": true,
   "scripts": {
     "docusaurus": "docusaurus",
-    "start": "docusaurus start",
-    "build": "docusaurus build",
+    "start": "npm run preprocess && docusaurus start",
+    "build": "npm run preprocess && docusaurus build",
+    "preprocess": "node scripts/preprocess-docs.js",
     "swizzle": "docusaurus swizzle",
     "deploy": "docusaurus deploy",
     "clear": "docusaurus clear",
@@ -19,6 +20,7 @@
     "@docusaurus/preset-classic": "3.8.1",
     "@mdx-js/react": "^3.0.0",
     "clsx": "^2.0.0",
+    "glob": "^10.3.0",
     "markdown-it": "^14.1.0",
     "prism-react-renderer": "^2.3.0",
     "react": "^19.0.0",
diff --git a/juneau-docs-poc/scripts/preprocess-docs.js 
b/juneau-docs-poc/scripts/preprocess-docs.js
new file mode 100644
index 000000000..2758505df
--- /dev/null
+++ b/juneau-docs-poc/scripts/preprocess-docs.js
@@ -0,0 +1,114 @@
+#!/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.
+ */
+
+/**
+ * Preprocessor script to replace Juneau placeholders in markdown files
+ * before Docusaurus processes them.
+ * 
+ * This runs before the Docusaurus build to ensure all {{JUNEAU_VERSION}} and 
+ * {{API_DOCS}} placeholders are replaced with actual values.
+ */
+
+const fs = require('fs');
+const path = require('path');
+const glob = require('glob');
+
+// Configuration
+const JUNEAU_VERSION = '9.0.1';
+const API_DOCS = '../apidocs';
+
+console.log('🔧 Starting Juneau docs preprocessing...');
+console.log(`📋 JUNEAU_VERSION: ${JUNEAU_VERSION}`);
+console.log(`📋 API_DOCS: ${API_DOCS}`);
+
+/**
+ * Replace placeholders in a string
+ */
+function replacePlaceholders(content) {
+  return content
+    .replace(/\{\{JUNEAU_VERSION\}\}/g, JUNEAU_VERSION)
+    .replace(/\{\{API_DOCS\}\}/g, API_DOCS)
+    // Also handle potential single-brace variants
+    .replace(/\{JUNEAU_VERSION\}/g, JUNEAU_VERSION)
+    .replace(/\{API_DOCS\}/g, API_DOCS);
+}
+
+/**
+ * Process a single markdown file
+ */
+function processFile(filePath) {
+  try {
+    const content = fs.readFileSync(filePath, 'utf8');
+    
+    // Check if file contains placeholders
+    const hasPlaceholders = content.includes('{{JUNEAU_VERSION}}') || 
+                           content.includes('{{API_DOCS}}') ||
+                           content.includes('{JUNEAU_VERSION}') || 
+                           content.includes('{API_DOCS}');
+    
+    if (hasPlaceholders) {
+      const processedContent = replacePlaceholders(content);
+      
+      // Verify replacement worked
+      const stillHasPlaceholders = 
processedContent.includes('{{JUNEAU_VERSION}}') || 
+                                  processedContent.includes('{{API_DOCS}}');
+      
+      if (stillHasPlaceholders) {
+        console.log(`⚠️  WARNING: ${filePath} still has unreplaced 
placeholders`);
+      } else {
+        console.log(`✅ Processed: ${filePath}`);
+      }
+      
+      fs.writeFileSync(filePath, processedContent, 'utf8');
+      return true;
+    }
+    
+    return false;
+  } catch (error) {
+    console.error(`❌ Error processing ${filePath}:`, error.message);
+    return false;
+  }
+}
+
+/**
+ * Main preprocessing function
+ */
+function preprocessDocs() {
+  const docsDir = path.join(__dirname, '../docs');
+  
+  // Find all markdown files
+  const markdownFiles = glob.sync('**/*.md', { cwd: docsDir });
+  
+  console.log(`📁 Found ${markdownFiles.length} markdown files`);
+  
+  let processedCount = 0;
+  
+  for (const file of markdownFiles) {
+    const fullPath = path.join(docsDir, file);
+    if (processFile(fullPath)) {
+      processedCount++;
+    }
+  }
+  
+  console.log(`🎯 Preprocessed ${processedCount} files with placeholders`);
+  console.log('✅ Juneau docs preprocessing complete!');
+}
+
+// Run if called directly
+if (require.main === module) {
+  preprocessDocs();
+}
+
+module.exports = { preprocessDocs, replacePlaceholders };

Reply via email to