@redpanda-data/docs-extensions-and-macros 4.9.1 → 4.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/doc-tools.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const { execSync, spawnSync } = require('child_process');
4
4
  const os = require('os');
5
- const { Command } = require('commander');
5
+ const { Command, Option } = require('commander');
6
6
  const path = require('path');
7
7
  const yaml = require('yaml');
8
8
  const fs = require('fs');
@@ -1111,6 +1111,8 @@ automation
1111
1111
  } else {
1112
1112
  env.OUTPUT_JSON_DIR = path.resolve(outputDir, 'examples');
1113
1113
  env.OUTPUT_AUTOGENERATED_DIR = path.resolve(outputDir);
1114
+ // Set property files to go to properties subdirectory
1115
+ env.OUTPUT_ASCIIDOC_DIR = path.resolve(outputDir, 'pages', 'properties');
1114
1116
  }
1115
1117
 
1116
1118
  const r = spawnSync('make', args, { cwd, stdio: 'inherit', env });
@@ -1540,5 +1542,47 @@ automation
1540
1542
  }
1541
1543
  });
1542
1544
 
1545
+ automation
1546
+ .command('bundle-openapi')
1547
+ .description('Bundle Redpanda OpenAPI fragments for admin and connect APIs into complete OpenAPI 3.1 documents')
1548
+ .requiredOption('-t, --tag <tag>', 'Git tag to check out (e.g., v24.3.2 or 24.3.2 or dev)')
1549
+ .option('--repo <url>', 'Repository URL', 'https://github.com/redpanda-data/redpanda.git')
1550
+ .addOption(new Option('-s, --surface <surface>', 'Which API surface(s) to bundle').choices(['admin', 'connect', 'both']).makeOptionMandatory())
1551
+ .option('--out-admin <path>', 'Output path for admin API', 'admin/redpanda-admin-api.yaml')
1552
+ .option('--out-connect <path>', 'Output path for connect API', 'connect/redpanda-connect-api.yaml')
1553
+ .option('--admin-major <string>', 'Admin API major version', 'v2.0.0')
1554
+ .option('--use-admin-major-version', 'Use admin major version for info.version instead of git tag', false)
1555
+ .option('--quiet', 'Suppress logs', false)
1556
+ .action(async (options) => {
1557
+ // Verify dependencies
1558
+ requireCmd('git', 'Install Git: https://git-scm.com/downloads');
1559
+ requireCmd('buf', 'buf should be automatically available after npm install');
1560
+
1561
+ // Check for OpenAPI bundler using the existing detectBundler function
1562
+ try {
1563
+ const { detectBundler } = require('../tools/bundle-openapi.js');
1564
+ detectBundler(true); // quiet mode to avoid duplicate output
1565
+ } catch (err) {
1566
+ fail(err.message);
1567
+ }
1568
+
1569
+ try {
1570
+ const { bundleOpenAPI } = require('../tools/bundle-openapi.js');
1571
+ await bundleOpenAPI({
1572
+ tag: options.tag,
1573
+ repo: options.repo,
1574
+ surface: options.surface,
1575
+ outAdmin: options.outAdmin,
1576
+ outConnect: options.outConnect,
1577
+ adminMajor: options.adminMajor,
1578
+ useAdminMajorVersion: options.useAdminMajorVersion,
1579
+ quiet: options.quiet
1580
+ });
1581
+ } catch (err) {
1582
+ console.error(`❌ ${err.message}`);
1583
+ process.exit(err.message.includes('Validation failed') ? 2 : 1);
1584
+ }
1585
+ });
1586
+
1543
1587
  programCli.addCommand(automation);
1544
1588
  programCli.parse(process.argv);