/ scripts / generate-bundle-catalog.mjs
generate-bundle-catalog.mjs
 1  import fs from "node:fs/promises";
 2  import path from "node:path";
 3  import { fileURLToPath } from "node:url";
 4  
 5  const scriptPath = fileURLToPath(import.meta.url);
 6  const scriptDir = path.dirname(scriptPath);
 7  const rootDir = path.resolve(scriptDir, "..");
 8  const manifestPath = path.join(rootDir, "load-manifest.json");
 9  
10  const manifest = JSON.parse(await fs.readFile(manifestPath, "utf8"));
11  
12  function printGroup(title, entries) {
13    if (!entries || Object.keys(entries).length === 0) {
14      return;
15    }
16  
17    console.log(`# ${title}`);
18  
19    for (const [name, config] of Object.entries(entries)) {
20      const description = config.description ?? "(no description)";
21      console.log(`${name} | ${description}`);
22    }
23  
24    console.log("");
25  }
26  
27  printGroup("defaults", manifest.defaults);
28  printGroup("taskTypes", manifest.taskTypes);
29  printGroup("checkpoints", manifest.checkpoints);
30  printGroup("optionalInspirations", manifest.optionalInspirations);