-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdev.js
More file actions
35 lines (27 loc) · 753 Bytes
/
dev.js
File metadata and controls
35 lines (27 loc) · 753 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
#!/usr/bin/env node
/**
* Development script to build and run the CLI with arguments forwarding
*/
const { spawn } = require("child_process");
const { execSync } = require("child_process");
// Build the project first
console.log("Building project...");
try {
execSync("npm run build", { stdio: "inherit" });
} catch (error) {
console.error("Build failed");
process.exit(1);
}
// Get all arguments after 'node dev.js'
const args = process.argv.slice(2);
// Run the built CLI with forwarded arguments
const child = spawn("node", ["dist/index.js", ...args], {
stdio: "inherit",
});
child.on("close", (code) => {
process.exit(code);
});
child.on("error", (error) => {
console.error("Error running CLI:", error);
process.exit(1);
});