-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env node | ||
|
||
import fs from "node:fs"; | ||
import { runClass } from "./runner"; | ||
import { parse } from "./validate"; | ||
|
||
function main() { | ||
const args = process.argv.slice(2); | ||
if (args.length === 0) { | ||
console.error("Usage: class <config-file.json>"); | ||
process.exit(1); | ||
} | ||
|
||
try { | ||
const configFile = args[0]; | ||
const configAsString = fs.readFileSync(configFile, "utf-8"); | ||
const rawConfig = JSON.parse(configAsString); | ||
const config = parse(rawConfig); | ||
const output = runClass(config); | ||
console.log(JSON.stringify(output, null, 2)); | ||
} catch (error) { | ||
console.error("Error running class:", error); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
main(); |