20 lines
619 B
TypeScript
Executable file
20 lines
619 B
TypeScript
Executable file
#!/usr/bin/env -S deno run --allow-read --allow-write
|
|
|
|
import { project_root } from "../src/lib/utils.ts";
|
|
|
|
// note : useful for watch
|
|
import {} from "../src/child.ts";
|
|
|
|
async function main() {
|
|
const input_path = `${await project_root()}/src/child.ts`;
|
|
const content = await Deno.readTextFile(input_path);
|
|
const escaped = content
|
|
.replaceAll("\\", "\\\\")
|
|
.replaceAll("$", "\\$")
|
|
.replaceAll("`", "\\`");
|
|
const src = `export const program = \`${escaped}\`;`;
|
|
const output_path = `${await project_root()}/data/generated.ts`;
|
|
await Deno.writeTextFile(output_path, src);
|
|
}
|
|
|
|
if (import.meta.main) await main();
|