@redpanda-data/docs-extensions-and-macros 4.4.0 → 4.4.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
@@ -5,6 +5,20 @@ const { Command } = require('commander');
5
5
  const path = require('path');
6
6
  const fs = require('fs');
7
7
 
8
+ function findRepoRoot(start = process.cwd()) {
9
+ let dir = start;
10
+ while (dir !== path.parse(dir).root) {
11
+ // marker could be a .git folder or package.json or anything you choose
12
+ if (fs.existsSync(path.join(dir, '.git')) ||
13
+ fs.existsSync(path.join(dir, 'package.json'))) {
14
+ return dir;
15
+ }
16
+ dir = path.dirname(dir);
17
+ }
18
+ console.error('❌ Could not find repo root (no .git or package.json in any parent)');
19
+ process.exit(1);
20
+ }
21
+
8
22
  // --------------------------------------------------------------------
9
23
  // Dependency check functions
10
24
  // --------------------------------------------------------------------
@@ -107,7 +121,7 @@ const programCli = new Command();
107
121
  programCli
108
122
  .name('doc-tools')
109
123
  .description('Redpanda Document Automation CLI')
110
- .version('1.0.0');
124
+ .version('1.0.1');
111
125
 
112
126
  // Top-level commands.
113
127
  programCli
@@ -295,6 +309,40 @@ automation
295
309
  process.exit(0);
296
310
  });
297
311
 
312
+ programCli
313
+ .command('link-readme <subdir> <targetFilename>')
314
+ .description('Symlink a README.adoc into docs/modules/<module>/pages/')
315
+ .action((subdir, targetFilename) => {
316
+ const repoRoot = findRepoRoot();
317
+ const normalized = subdir.replace(/\/+$/, '');
318
+ const moduleName = normalized.split('/')[0];
319
+
320
+ const projectDir = path.join(repoRoot, normalized);
321
+ const pagesDir = path.join(repoRoot, 'docs', 'modules', moduleName, 'pages');
322
+ const sourceFile = path.join(repoRoot, normalized, 'README.adoc');
323
+ const destLink = path.join(pagesDir, targetFilename);
324
+
325
+ if (!fs.existsSync(projectDir)) {
326
+ console.error(`❌ Project directory not found: ${projectDir}`);
327
+ process.exit(1);
328
+ }
329
+ if (!fs.existsSync(sourceFile)) {
330
+ console.error(`❌ README.adoc not found in ${normalized}`);
331
+ process.exit(1);
332
+ }
333
+
334
+ fs.mkdirSync(pagesDir, { recursive: true });
335
+ const relPath = path.relative(pagesDir, sourceFile);
336
+
337
+ try {
338
+ fs.symlinkSync(relPath, destLink);
339
+ console.log(`✔️ Linked ${relPath} → ${destLink}`);
340
+ } catch (err) {
341
+ console.error(`❌ Failed to create symlink: ${err.message}`);
342
+ process.exit(1);
343
+ }
344
+ });
345
+
298
346
  programCli
299
347
  .command('fetch')
300
348
  .description('Fetch a file or directory from GitHub and save locally')
@@ -182,7 +182,7 @@ function getDynamicReplacements(componentVersion, logger) {
182
182
  const versionNum = formatVersion(componentVersion.version || '', semver);
183
183
  const is24_3plus =
184
184
  versionNum && semver.gte(versionNum, '24.3.0') && componentVersion.title === 'Self-Managed';
185
- const useTagAttributes = isPrerelease || is24_3plus;
185
+ const useTagAttributes = isPrerelease || is24_3plus || componentVersion.title === 'Labs';
186
186
 
187
187
  // Derive Redpanda / Console versions
188
188
  const redpandaVersion = isPrerelease
@@ -22,8 +22,8 @@ const jsonpath = require('jsonpath-plus');
22
22
  const yaml = require('yaml');
23
23
  // For synchronous HTTP fetching.
24
24
  const request = require('sync-request');
25
- const computeOut = require('../extension-utils/compute-out.js');
26
- const createAsciiDocFile = require('../extension-utils/create-asciidoc-file.js');
25
+ const computeOut = require('../extensions/util/compute-out.js');
26
+ const createAsciiDocFile = require('../extensions/util/create-asciidoc-file.js');
27
27
 
28
28
  // In-memory cache for external resources (avoid repeated network calls)
29
29
  const externalCache = new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redpanda-data/docs-extensions-and-macros",
3
- "version": "4.4.0",
3
+ "version": "4.4.1",
4
4
  "description": "Antora extensions and macros developed for Redpanda documentation.",
5
5
  "keywords": [
6
6
  "antora",