-
-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathdev-cli.js
More file actions
executable file
·30 lines (23 loc) · 753 Bytes
/
dev-cli.js
File metadata and controls
executable file
·30 lines (23 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
#!/usr/bin/env node
// Development CLI wrapper that allows passing commands
import { spawn } from 'child_process';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Get command line arguments (skip 'node' and script name)
const args = process.argv.slice(2);
// Path to the dev binary
const devBin = join(__dirname, 'bin', 'dev.js');
// Spawn the dev binary with the provided arguments
const child = spawn('node', [devBin, ...args], {
stdio: 'inherit',
cwd: __dirname
});
child.on('error', (error) => {
console.error(`Error: ${error.message}`);
process.exit(1);
});
child.on('close', (code) => {
process.exit(code);
});