File size: 740 Bytes
1794757
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { mkdir, writeFile } from "node:fs/promises";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";

import { getAllSources } from "../src/lib/data-sources/registry.ts";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const outputPath = resolve(__dirname, "../backend/src/trenches_env/source_manifest.json");

const payload = {
  generatedAt: new Date().toISOString(),
  sourceCount: getAllSources().length,
  sources: getAllSources(),
};

await mkdir(dirname(outputPath), { recursive: true });
await writeFile(outputPath, `${JSON.stringify(payload, null, 2)}\n`, "utf8");

process.stdout.write(`wrote ${payload.sourceCount} sources to ${outputPath}\n`);