@redpanda-data/docs-extensions-and-macros 4.9.1 → 4.10.0
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');
|
|
@@ -1540,5 +1540,47 @@ automation
|
|
|
1540
1540
|
}
|
|
1541
1541
|
});
|
|
1542
1542
|
|
|
1543
|
+
automation
|
|
1544
|
+
.command('bundle-openapi')
|
|
1545
|
+
.description('Bundle Redpanda OpenAPI fragments for admin and connect APIs into complete OpenAPI 3.1 documents')
|
|
1546
|
+
.requiredOption('-t, --tag <tag>', 'Git tag to check out (e.g., v24.3.2 or 24.3.2 or dev)')
|
|
1547
|
+
.option('--repo <url>', 'Repository URL', 'https://github.com/redpanda-data/redpanda.git')
|
|
1548
|
+
.addOption(new Option('-s, --surface <surface>', 'Which API surface(s) to bundle').choices(['admin', 'connect', 'both']).makeOptionMandatory())
|
|
1549
|
+
.option('--out-admin <path>', 'Output path for admin API', 'admin/redpanda-admin-api.yaml')
|
|
1550
|
+
.option('--out-connect <path>', 'Output path for connect API', 'connect/redpanda-connect-api.yaml')
|
|
1551
|
+
.option('--admin-major <string>', 'Admin API major version', 'v2.0.0')
|
|
1552
|
+
.option('--use-admin-major-version', 'Use admin major version for info.version instead of git tag', false)
|
|
1553
|
+
.option('--quiet', 'Suppress logs', false)
|
|
1554
|
+
.action(async (options) => {
|
|
1555
|
+
// Verify dependencies
|
|
1556
|
+
requireCmd('git', 'Install Git: https://git-scm.com/downloads');
|
|
1557
|
+
requireCmd('buf', 'buf should be automatically available after npm install');
|
|
1558
|
+
|
|
1559
|
+
// Check for OpenAPI bundler using the existing detectBundler function
|
|
1560
|
+
try {
|
|
1561
|
+
const { detectBundler } = require('../tools/bundle-openapi.js');
|
|
1562
|
+
detectBundler(true); // quiet mode to avoid duplicate output
|
|
1563
|
+
} catch (err) {
|
|
1564
|
+
fail(err.message);
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
try {
|
|
1568
|
+
const { bundleOpenAPI } = require('../tools/bundle-openapi.js');
|
|
1569
|
+
await bundleOpenAPI({
|
|
1570
|
+
tag: options.tag,
|
|
1571
|
+
repo: options.repo,
|
|
1572
|
+
surface: options.surface,
|
|
1573
|
+
outAdmin: options.outAdmin,
|
|
1574
|
+
outConnect: options.outConnect,
|
|
1575
|
+
adminMajor: options.adminMajor,
|
|
1576
|
+
useAdminMajorVersion: options.useAdminMajorVersion,
|
|
1577
|
+
quiet: options.quiet
|
|
1578
|
+
});
|
|
1579
|
+
} catch (err) {
|
|
1580
|
+
console.error(`❌ ${err.message}`);
|
|
1581
|
+
process.exit(err.message.includes('Validation failed') ? 2 : 1);
|
|
1582
|
+
}
|
|
1583
|
+
});
|
|
1584
|
+
|
|
1543
1585
|
programCli.addCommand(automation);
|
|
1544
1586
|
programCli.parse(process.argv);
|