@redpanda-data/docs-extensions-and-macros 4.4.1 → 4.4.2
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 +9 -7
- package/package.json +1 -1
package/bin/doc-tools.js
CHANGED
|
@@ -309,25 +309,27 @@ automation
|
|
|
309
309
|
process.exit(0);
|
|
310
310
|
});
|
|
311
311
|
|
|
312
|
-
programCli
|
|
313
|
-
.command('link-readme
|
|
312
|
+
programCli
|
|
313
|
+
.command('link-readme')
|
|
314
314
|
.description('Symlink a README.adoc into docs/modules/<module>/pages/')
|
|
315
|
-
.
|
|
315
|
+
.requiredOption('-s, --subdir <subdir>', 'Relative path to the lab project subdirectory')
|
|
316
|
+
.requiredOption('-t, --target <filename>', 'Name of the target AsciiDoc file in pages/')
|
|
317
|
+
.action((options) => {
|
|
316
318
|
const repoRoot = findRepoRoot();
|
|
317
|
-
const normalized = subdir.replace(/\/+$/, '');
|
|
319
|
+
const normalized = options.subdir.replace(/\/+$/, '');
|
|
318
320
|
const moduleName = normalized.split('/')[0];
|
|
319
321
|
|
|
320
322
|
const projectDir = path.join(repoRoot, normalized);
|
|
321
323
|
const pagesDir = path.join(repoRoot, 'docs', 'modules', moduleName, 'pages');
|
|
322
|
-
const sourceFile = path.join(
|
|
323
|
-
const destLink = path.join(pagesDir,
|
|
324
|
+
const sourceFile = path.join(projectDir, 'README.adoc');
|
|
325
|
+
const destLink = path.join(pagesDir, options.target);
|
|
324
326
|
|
|
325
327
|
if (!fs.existsSync(projectDir)) {
|
|
326
328
|
console.error(`❌ Project directory not found: ${projectDir}`);
|
|
327
329
|
process.exit(1);
|
|
328
330
|
}
|
|
329
331
|
if (!fs.existsSync(sourceFile)) {
|
|
330
|
-
console.error(`❌ README.adoc not found in ${
|
|
332
|
+
console.error(`❌ README.adoc not found in ${projectDir}`);
|
|
331
333
|
process.exit(1);
|
|
332
334
|
}
|
|
333
335
|
|