specli 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/specli.js +26 -0
- package/dist/cli.js +1 -1
- package/package.json +2 -2
package/bin/specli.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
|
|
4
|
+
const isBun = typeof globalThis.Bun !== "undefined";
|
|
5
|
+
const isCompileCommand = process.argv.includes("compile");
|
|
6
|
+
|
|
7
|
+
if (!isBun && isCompileCommand) {
|
|
8
|
+
// Re-run with Bun for compile command
|
|
9
|
+
const child = spawn("bun", process.argv.slice(1), {
|
|
10
|
+
stdio: "inherit",
|
|
11
|
+
});
|
|
12
|
+
child.on("close", (code) => process.exit(code ?? 0));
|
|
13
|
+
child.on("error", (err) => {
|
|
14
|
+
if (err.code === "ENOENT") {
|
|
15
|
+
console.error("Error: The 'compile' command requires Bun.");
|
|
16
|
+
console.error("Install Bun: https://bun.sh");
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
throw err;
|
|
20
|
+
});
|
|
21
|
+
} else {
|
|
22
|
+
// Run the CLI directly
|
|
23
|
+
const root = new URL("..", import.meta.url).pathname;
|
|
24
|
+
const entry = isBun ? `${root}cli.ts` : `${root}dist/cli.js`;
|
|
25
|
+
await import(entry);
|
|
26
|
+
}
|
package/dist/cli.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "specli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"bin": {
|
|
9
|
-
"specli": "./
|
|
9
|
+
"specli": "./bin/specli.js"
|
|
10
10
|
},
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|