init
This commit is contained in:
commit
c1ff9ee63e
12 changed files with 499 additions and 0 deletions
20
data/generate.ts
Executable file
20
data/generate.ts
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/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();
|
Loading…
Add table
Add a link
Reference in a new issue