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 6c6211534 Clean up old scripts.
6c6211534 is described below

commit 6c6211534acde57bf3c43539d3c4ee9a8bf504db
Author: James Bognar <[email protected]>
AuthorDate: Wed Sep 24 10:07:02 2025 -0400

    Clean up old scripts.
---
 juneau-docs-poc/convert-example-headers.js     | 153 ------------------------
 juneau-docs-poc/improve-markdown-formatting.js | 156 -------------------------
 juneau-docs-poc/process-links.js               | 105 -----------------
 juneau-docs-poc/replace-version-numbers.js     | 139 ----------------------
 4 files changed, 553 deletions(-)

diff --git a/juneau-docs-poc/convert-example-headers.js 
b/juneau-docs-poc/convert-example-headers.js
deleted file mode 100644
index 0df2a0b9f..000000000
--- a/juneau-docs-poc/convert-example-headers.js
+++ /dev/null
@@ -1,153 +0,0 @@
-#!/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 fs = require('fs');
-const path = require('path');
-
-function convertExampleHeaders(content) {
-    let lines = content.split('\n');
-    let converted = [];
-    
-    for (let i = 0; i < lines.length; i++) {
-        const currentLine = lines[i];
-        const nextLine = i < lines.length - 1 ? lines[i + 1] : '';
-        
-        // Check for ### Example: or ### Examples: headers
-        if (currentLine.match(/^### Examples?:?\s*$/)) {
-            const isPlural = currentLine.includes('Examples');
-            const exampleType = isPlural ? 'Examples' : 'Example';
-            
-            // Convert to admonition
-            converted.push(`:::tip ${exampleType}`);
-            converted.push('');
-            
-            // Skip the next line if it's blank (common pattern)
-            if (nextLine.trim() === '') {
-                i++; // Skip the blank line
-            }
-            
-            // Look ahead to find the end of this example section
-            let j = i + 1;
-            let foundCodeBlocks = 0;
-            let inCodeBlock = false;
-            let exampleContent = [];
-            
-            while (j < lines.length) {
-                const line = lines[j];
-                
-                // Track code blocks
-                if (line.trim().startsWith('```')) {
-                    if (!inCodeBlock) {
-                        foundCodeBlocks++;
-                        inCodeBlock = true;
-                    } else {
-                        inCodeBlock = false;
-                    }
-                }
-                
-                // Stop when we hit another header or significant structural 
element
-                if (line.match(/^#{1,6}\s+/) && !inCodeBlock) {
-                    break;
-                }
-                
-                // Stop when we hit another admonition
-                if (line.match(/^:::(note|tip|info|caution|danger)/) && 
!inCodeBlock) {
-                    break;
-                }
-                
-                // For single examples, stop after the first complete code 
block
-                if (!isPlural && foundCodeBlocks >= 2 && !inCodeBlock) {
-                    // Check if the next non-empty line is likely continuing 
the example
-                    let nextNonEmpty = j + 1;
-                    while (nextNonEmpty < lines.length && 
lines[nextNonEmpty].trim() === '') {
-                        nextNonEmpty++;
-                    }
-                    
-                    if (nextNonEmpty < lines.length) {
-                        const nextContent = lines[nextNonEmpty];
-                        // If it's a header or admonition, stop here
-                        if (nextContent.match(/^#{1,6}\s+/) || 
nextContent.match(/^:::/)) {
-                            break;
-                        }
-                    }
-                }
-                
-                exampleContent.push(line);
-                j++;
-            }
-            
-            // Add the example content
-            converted.push(...exampleContent);
-            converted.push(':::');
-            converted.push('');
-            
-            // Update the main loop counter
-            i = j - 1;
-        } else {
-            converted.push(currentLine);
-        }
-    }
-    
-    return converted.join('\n');
-}
-
-function processFile(filePath) {
-    try {
-        console.log(`Processing: ${filePath}`);
-        const content = fs.readFileSync(filePath, 'utf8');
-        
-        // Check if file contains example headers to convert
-        if (content.match(/^### Examples?:?\s*$/m)) {
-            const converted = convertExampleHeaders(content);
-            fs.writeFileSync(filePath, converted, 'utf8');
-            console.log(`  ✅ Converted example headers in 
${path.basename(filePath)}`);
-        } else {
-            console.log(`  ⏭️  No example headers found in 
${path.basename(filePath)}`);
-        }
-    } catch (error) {
-        console.error(`❌ Error processing ${filePath}:`, error.message);
-    }
-}
-
-function processDirectory(directory) {
-    const files = fs.readdirSync(directory);
-    
-    for (const file of files) {
-        const filePath = path.join(directory, file);
-        const stat = fs.statSync(filePath);
-        
-        if (stat.isDirectory()) {
-            processDirectory(filePath);
-        } else if (path.extname(filePath) === '.md') {
-            processFile(filePath);
-        }
-    }
-}
-
-function main() {
-    console.log('Converting ### Example and ### Examples headers to admonition 
blocks...\n');
-    
-    const docsDir = '/Users/james.bognar/git/juneau/juneau-docs-poc/docs';
-    
-    if (fs.existsSync(docsDir)) {
-        processDirectory(docsDir);
-        console.log('\n✅ Example header conversion complete!');
-    } else {
-        console.error('❌ docs directory not found');
-    }
-}
-
-if (require.main === module) {
-    main();
-}
diff --git a/juneau-docs-poc/improve-markdown-formatting.js 
b/juneau-docs-poc/improve-markdown-formatting.js
deleted file mode 100644
index 8132a9699..000000000
--- a/juneau-docs-poc/improve-markdown-formatting.js
+++ /dev/null
@@ -1,156 +0,0 @@
-#!/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 fs = require('fs');
-const path = require('path');
-
-function improveMarkdownFormatting(content) {
-    let lines = content.split('\n');
-    let improved = [];
-    
-    for (let i = 0; i < lines.length; i++) {
-        const currentLine = lines[i];
-        const prevLine = i > 0 ? lines[i - 1] : '';
-        const nextLine = i < lines.length - 1 ? lines[i + 1] : '';
-        
-        // Add the current line
-        improved.push(currentLine);
-        
-        // Add blank lines after specific patterns for better readability
-        
-        // After headers (but not if next line is already blank)
-        if (currentLine.match(/^#{1,6}\s+/) && nextLine.trim() !== '' && 
!nextLine.match(/^#{1,6}\s+/)) {
-            improved.push('');
-        }
-        
-        // After code blocks end
-        if (currentLine.trim() === '```' && prevLine.trim() !== '' && 
nextLine.trim() !== '') {
-            improved.push('');
-        }
-        
-        // Before code blocks start (but not if previous line is already blank)
-        if (currentLine.match(/^```\w*$/) && prevLine.trim() !== '' && 
!prevLine.match(/^```/)) {
-            // Insert blank line before current line
-            improved.splice(-1, 0, '');
-        }
-        
-        // After admonition end
-        if (currentLine.trim() === ':::' && nextLine.trim() !== '') {
-            improved.push('');
-        }
-        
-        // Before admonition start (but not if previous line is already blank)
-        if (currentLine.match(/^:::(note|tip|info|caution|danger)/) && 
prevLine.trim() !== '') {
-            // Insert blank line before current line
-            improved.splice(-1, 0, '');
-        }
-        
-        // After tables (detect end of table)
-        if (currentLine.match(/^\|.*\|$/) && !nextLine.match(/^\|.*\|$/) && 
nextLine.trim() !== '') {
-            improved.push('');
-        }
-        
-        // Before tables (detect start of table)
-        if (currentLine.match(/^\|.*\|$/) && !prevLine.match(/^\|.*\|$/) && 
prevLine.trim() !== '' && !prevLine.match(/^#{1,6}\s+/)) {
-            // Insert blank line before current line
-            improved.splice(-1, 0, '');
-        }
-        
-        // After frontmatter
-        if (currentLine.trim() === '---' && i > 0 && nextLine.trim() !== '') {
-            // Check if this is the closing frontmatter delimiter
-            let frontmatterStart = -1;
-            for (let j = i - 1; j >= 0; j--) {
-                if (lines[j].trim() === '---') {
-                    frontmatterStart = j;
-                    break;
-                }
-            }
-            if (frontmatterStart === 0) {
-                improved.push('');
-            }
-        }
-        
-        // After list items that are followed by non-list content
-        if (currentLine.match(/^[\s]*[-*+]\s+/) && 
!nextLine.match(/^[\s]*[-*+]\s+/) && nextLine.trim() !== '') {
-            improved.push('');
-        }
-    }
-    
-    // Clean up multiple consecutive blank lines (limit to 2 max)
-    let final = [];
-    let blankCount = 0;
-    
-    for (const line of improved) {
-        if (line.trim() === '') {
-            blankCount++;
-            if (blankCount <= 2) {
-                final.push(line);
-            }
-        } else {
-            blankCount = 0;
-            final.push(line);
-        }
-    }
-    
-    // Remove trailing blank lines
-    while (final.length > 0 && final[final.length - 1].trim() === '') {
-        final.pop();
-    }
-    
-    return final.join('\n') + '\n';
-}
-
-function processFile(filePath) {
-    try {
-        console.log(`Processing: ${filePath}`);
-        const content = fs.readFileSync(filePath, 'utf8');
-        const improved = improveMarkdownFormatting(content);
-        fs.writeFileSync(filePath, improved, 'utf8');
-    } catch (error) {
-        console.error(`Error processing ${filePath}:`, error.message);
-    }
-}
-
-function processDirectory(directory) {
-    const files = fs.readdirSync(directory);
-    
-    for (const file of files) {
-        const filePath = path.join(directory, file);
-        const stat = fs.statSync(filePath);
-        
-        if (stat.isDirectory()) {
-            processDirectory(filePath);
-        } else if (path.extname(filePath) === '.md') {
-            processFile(filePath);
-        }
-    }
-}
-
-function main() {
-    console.log('Improving Markdown formatting for better editor 
readability...\n');
-    
-    const docsDir = '/Users/james.bognar/git/juneau/juneau-docs-poc/docs';
-    
-    if (fs.existsSync(docsDir)) {
-        processDirectory(docsDir);
-        console.log('\n✅ Markdown formatting improvements complete!');
-    } else {
-        console.error('❌ docs directory not found');
-    }
-}
-
-if (require.main === module) {
-    main();
-}
diff --git a/juneau-docs-poc/process-links.js b/juneau-docs-poc/process-links.js
deleted file mode 100755
index 5db7b9dc7..000000000
--- a/juneau-docs-poc/process-links.js
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/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.
- */
-
-
-/**
- * Simple demonstration of {@link} tag processing for Juneau documentation
- * This script shows how to convert {@link} tags to Markdown links
- */
-
-const fs = require('fs');
-const path = require('path');
-
-// Package abbreviations mapping
-const packageAbbreviations = {
-  'oaj': 'org.apache.juneau',
-  'oajr': 'org.apache.juneau.rest',
-  'oajrc': 'org.apache.juneau.rest.client',
-  'oajrs': 'org.apache.juneau.rest.server',
-  'oajrss': 'org.apache.juneau.rest.server.springboot',
-  'oajrm': 'org.apache.juneau.rest.mock',
-  'oajmc': 'org.apache.juneau.microservice.core',
-  'oajmj': 'org.apache.juneau.microservice.jetty',
-};
-
-const javadocBaseUrl = '../apidocs';
-
-function expandPackageAbbreviations(className, abbreviations) {
-  for (const [abbrev, fullPackage] of Object.entries(abbreviations)) {
-    if (className.startsWith(abbrev + '.')) {
-      return className.replace(abbrev + '.', fullPackage + '.');
-    }
-  }
-  return className;
-}
-
-function processJuneauLinks(content) {
-  // Process {@link package.Class#method method} patterns
-  content = content.replace(
-    /\{@link\s+([a-zA-Z0-9_.]+)#([a-zA-Z0-9_()]+)(?:\s+([^}]+))?\}/g,
-    (match, className, method, displayText) => {
-      const expandedClass = expandPackageAbbreviations(className, 
packageAbbreviations);
-      const classPath = expandedClass.replace(/\./g, '/');
-      const display = displayText || `${className.split('.').pop()}#${method}`;
-      return `[\`${display}\`](${javadocBaseUrl}/${classPath}.html#${method})`;
-    }
-  );
-
-  // Process {@link package.Class Class} patterns
-  content = content.replace(
-    /\{@link\s+([a-zA-Z0-9_.]+)(?:\s+([^}]+))?\}/g,
-    (match, className, displayText) => {
-      const expandedClass = expandPackageAbbreviations(className, 
packageAbbreviations);
-      const classPath = expandedClass.replace(/\./g, '/');
-      const display = displayText || className.split('.').pop() || className;
-      return `[\`${display}\`](${javadocBaseUrl}/${classPath}.html)`;
-    }
-  );
-
-  return content;
-}
-
-// Test with sample content
-const sampleContent = `
-# Apache Juneau Overview
-
-The {@link oaj.serializer.Serializer} class is the parent class of all 
serializers.
-The {@link oaj.json.JsonSerializer JsonSerializer} class can be used to 
serialize POJOs into JSON notation.
-The {@link oajr.servlet.BasicRestServlet} class is the entry point for your 
REST resources.
-REST methods are annotated with {@link oajr.annotation.RestGet @RestGet}.
-The {@link oajrc.RestClient#builder() builder()} method creates a new client 
builder.
-`;
-
-console.log('=== Original Content ===');
-console.log(sampleContent);
-
-console.log('\n=== Processed Content ===');
-const processedContent = processJuneauLinks(sampleContent);
-console.log(processedContent);
-
-// Process files if arguments provided
-if (process.argv.length > 2) {
-  const filePath = process.argv[2];
-  if (fs.existsSync(filePath)) {
-    console.log(`\n=== Processing file: ${filePath} ===`);
-    const content = fs.readFileSync(filePath, 'utf8');
-    const processed = processJuneauLinks(content);
-    
-    const outputPath = filePath.replace(/\.md$/, '.processed.md');
-    fs.writeFileSync(outputPath, processed);
-    console.log(`Processed content written to: ${outputPath}`);
-  } else {
-    console.error(`File not found: ${filePath}`);
-  }
-}
diff --git a/juneau-docs-poc/replace-version-numbers.js 
b/juneau-docs-poc/replace-version-numbers.js
deleted file mode 100644
index cdfbbc13b..000000000
--- a/juneau-docs-poc/replace-version-numbers.js
+++ /dev/null
@@ -1,139 +0,0 @@
-#!/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 fs = require('fs');
-const path = require('path');
-const glob = require('glob');
-
-// Import the component at the top of files that use it
-const IMPORT_STATEMENT = `import JuneauVersion from 
'@site/src/components/JuneauVersion';
-
-`;
-
-function processFile(filePath) {
-    try {
-        let content = fs.readFileSync(filePath, 'utf8');
-        
-        // Check if the file contains version numbers
-        if (!content.includes('9.0.1')) {
-            return false; // No changes needed
-        }
-        
-        let modified = false;
-        const originalContent = content;
-        
-        // Replace version numbers in different contexts
-        
-        // 1. In Maven dependencies
-        content = content.replace(
-            /<version>9\.0\.1<\/version>/g, 
-            '<version><JuneauVersion /></version>'
-        );
-        
-        // 2. In jar file names  
-        content = content.replace(
-            /([a-zA-Z-]+)-9\.0\.1\.jar/g,
-            '$1-<JuneauVersion />.jar'
-        );
-        
-        // 3. In OSGi module names
-        content = content.replace(
-            /([a-zA-Z.]+)_9\.0\.1\.jar/g,
-            '$1_<JuneauVersion />.jar'
-        );
-        
-        // 4. In plain text mentions (be careful not to replace in URLs or 
other contexts)
-        content = content.replace(
-            /(\s|^)9\.0\.1(\s|$|\.)/g,
-            '$1<JuneauVersion />$2'
-        );
-        
-        // If we made changes, add the import statement at the top (after 
frontmatter)
-        if (content !== originalContent) {
-            // Check if import already exists
-            if (!content.includes('import JuneauVersion')) {
-                // Find the end of frontmatter
-                const frontmatterEnd = content.indexOf('---', 3);
-                if (frontmatterEnd !== -1) {
-                    // Insert after frontmatter
-                    const beforeFrontmatter = content.substring(0, 
frontmatterEnd + 3);
-                    const afterFrontmatter = content.substring(frontmatterEnd 
+ 3);
-                    content = beforeFrontmatter + '\n\n' + IMPORT_STATEMENT + 
afterFrontmatter;
-                } else {
-                    // No frontmatter, add at the beginning
-                    content = IMPORT_STATEMENT + content;
-                }
-            }
-            modified = true;
-        }
-        
-        if (modified) {
-            fs.writeFileSync(filePath, content, 'utf8');
-            return true;
-        }
-        
-        return false;
-    } catch (error) {
-        console.error(`Error processing ${filePath}:`, error.message);
-        return false;
-    }
-}
-
-function findAndProcessFiles() {
-    const docsPattern = 
'/Users/james.bognar/git/juneau/juneau-docs-poc/docs/**/*.md';
-    
-    // Find all markdown files
-    const files = glob.sync(docsPattern);
-    
-    let processedCount = 0;
-    let totalFiles = 0;
-    
-    console.log('Replacing version numbers with <JuneauVersion /> 
component...\n');
-    
-    for (const file of files) {
-        totalFiles++;
-        console.log(`Processing: ${path.basename(file)}`);
-        
-        if (processFile(file)) {
-            console.log(`  ✅ Updated version references`);
-            processedCount++;
-        } else {
-            console.log(`  ⏭️  No version references found`);
-        }
-    }
-    
-    console.log(`\n✅ Processed ${totalFiles} files, updated ${processedCount} 
files with version references.`);
-    
-    if (processedCount > 0) {
-        console.log('\n📝 Usage in Markdown files:');
-        console.log('  - Maven dependencies: <version><JuneauVersion 
/></version>');
-        console.log('  - JAR files: juneau-marshall-<JuneauVersion />.jar');
-        console.log('  - Text: Version <JuneauVersion />');
-        console.log('\n📝 To update the version:');
-        console.log('  - Edit docusaurus.config.ts');
-        console.log('  - Change customFields.juneauVersion to the new 
version');
-        console.log('  - All references will update automatically!');
-    }
-}
-
-// Check if glob is available
-try {
-    require.resolve('glob');
-} catch (e) {
-    console.error('Error: The "glob" package is required but not installed.');
-    console.error('Please run: npm install glob');
-    process.exit(1);
-}
-
-findAndProcessFiles();

Reply via email to