-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbin.ts
More file actions
32 lines (26 loc) · 853 Bytes
/
bin.ts
File metadata and controls
32 lines (26 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env node
import { argv } from "node:process";
import { build } from "./commands/build.ts";
import { dev } from "./commands/dev.ts";
import { format } from "./commands/format.ts";
import { init } from "./commands/init.ts";
import { lint } from "./commands/lint.ts";
import { sync } from "./commands/sync.ts";
import { test } from "./commands/test.ts";
const commands = { build, dev, format, init, lint, sync, test };
async function main() {
const [command, ...args] = argv.slice(2);
if (!command) {
console.log(`No command provided. Available commands: ${Object.keys(commands).join(", ")}\n`);
return;
}
const run = commands[command as keyof typeof commands];
if (!run) {
console.log(
`Unknown command: ${command}. Available commands: ${Object.keys(commands).join(", ")}`,
);
return;
}
await run({ args });
}
main();