Loading fedify/codegen/main.ts +9 −4 Original line number Diff line number Diff line import { loadSchemaFiles } from "./schema.ts"; import { generateClasses } from "./class.ts"; import { loadSchemaFiles } from "./schema.ts"; export async function main() { if (Deno.args.length != 2) { if (Deno.args.length < 2) { if (Deno.args.length != 3) { if (Deno.args.length < 3) { console.error("error: too few arguments"); } else { console.error("error: too many arguments"); Loading @@ -17,14 +17,19 @@ export async function main() { } const schemaDir = Deno.args[0]; const runtimePath = Deno.args[1]; const outputPath = Deno.args[2]; if (!(await Deno.stat(schemaDir)).isDirectory) { console.error("error:", schemaDir, "is not a directory"); Deno.exit(1); } const types = await loadSchemaFiles(schemaDir); const encoder = new TextEncoder(); using file = await Deno.open(outputPath, { write: true, create: true }); const writer = file.writable.getWriter(); for await (const code of generateClasses(types, runtimePath)) { await Deno.stdout.write(encoder.encode(code)); await writer.write(encoder.encode(code)); } } Loading fedify/deno.json +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ "!vocab/vocab.ts" ], "tasks": { "codegen": "deno run --allow-read --allow-write --check codegen/main.ts vocab/ ../runtime/ > vocab/.vocab.ts && deno fmt vocab/.vocab.ts && mv vocab/.vocab.ts vocab/vocab.ts && deno cache vocab/vocab.ts && deno check vocab/vocab.ts", "codegen": "GENPATH=vocab-$(deno eval \"console.log(crypto.randomUUID());\").ts && deno run --allow-read --allow-write --check codegen/main.ts vocab/ ../runtime/ vocab/$GENPATH && deno fmt vocab/$GENPATH && deno cache vocab/$GENPATH && deno check vocab/$GENPATH && mv vocab/$GENPATH vocab/vocab.ts", "cache": { "command": "deno cache mod.ts", "dependencies": [ Loading fedify/vocab/.gitignore +1 −0 Original line number Diff line number Diff line vocab.ts .vocab.ts vocab-*.ts Loading
fedify/codegen/main.ts +9 −4 Original line number Diff line number Diff line import { loadSchemaFiles } from "./schema.ts"; import { generateClasses } from "./class.ts"; import { loadSchemaFiles } from "./schema.ts"; export async function main() { if (Deno.args.length != 2) { if (Deno.args.length < 2) { if (Deno.args.length != 3) { if (Deno.args.length < 3) { console.error("error: too few arguments"); } else { console.error("error: too many arguments"); Loading @@ -17,14 +17,19 @@ export async function main() { } const schemaDir = Deno.args[0]; const runtimePath = Deno.args[1]; const outputPath = Deno.args[2]; if (!(await Deno.stat(schemaDir)).isDirectory) { console.error("error:", schemaDir, "is not a directory"); Deno.exit(1); } const types = await loadSchemaFiles(schemaDir); const encoder = new TextEncoder(); using file = await Deno.open(outputPath, { write: true, create: true }); const writer = file.writable.getWriter(); for await (const code of generateClasses(types, runtimePath)) { await Deno.stdout.write(encoder.encode(code)); await writer.write(encoder.encode(code)); } } Loading
fedify/deno.json +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ "!vocab/vocab.ts" ], "tasks": { "codegen": "deno run --allow-read --allow-write --check codegen/main.ts vocab/ ../runtime/ > vocab/.vocab.ts && deno fmt vocab/.vocab.ts && mv vocab/.vocab.ts vocab/vocab.ts && deno cache vocab/vocab.ts && deno check vocab/vocab.ts", "codegen": "GENPATH=vocab-$(deno eval \"console.log(crypto.randomUUID());\").ts && deno run --allow-read --allow-write --check codegen/main.ts vocab/ ../runtime/ vocab/$GENPATH && deno fmt vocab/$GENPATH && deno cache vocab/$GENPATH && deno check vocab/$GENPATH && mv vocab/$GENPATH vocab/vocab.ts", "cache": { "command": "deno cache mod.ts", "dependencies": [ Loading
fedify/vocab/.gitignore +1 −0 Original line number Diff line number Diff line vocab.ts .vocab.ts vocab-*.ts