-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.ts
More file actions
35 lines (31 loc) · 1016 Bytes
/
cli.ts
File metadata and controls
35 lines (31 loc) · 1016 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
33
34
35
#!/usr/bin/env bun
async function main(): Promise<void> {
const bunVersion = process.versions.bun;
if (bunVersion) {
try {
const { semver } = await import("bun");
const supportedBunVersion = ">=1.3.0";
if (!semver.satisfies(bunVersion, supportedBunVersion)) {
throw new Error("Unsupported Bun version. Please upgrade Bun.");
}
} catch {
console.error("Unsupported Bun version. Please upgrade Bun.");
throw new Error("Unsupported Bun version. Please upgrade Bun.");
}
} else {
const version = parseInt(process.versions.node, 10) || 0;
const minSupportedNodeVersion = 24;
if (version < minSupportedNodeVersion) {
throw new Error("Unsupported Node version. Please upgrade Node.\n");
}
}
return import("../cli/index.js")
.then(({ cli }) => cli(process.argv))
.catch((error: unknown) => {
console.error(error);
process.exit(1);
});
}
main()
.then(() => process.exit(0))
.catch(() => process.exit(1));