-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.js
More file actions
43 lines (36 loc) · 1.25 KB
/
start.js
File metadata and controls
43 lines (36 loc) · 1.25 KB
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
36
37
38
39
40
41
42
43
#!/usr/bin/env node
const { spawn } = require('child_process');
const path = require('path');
console.log('🚀 Code Fix Quick Start');
console.log('=======================\n');
// Check if node_modules exists
const fs = require('fs');
if (!fs.existsSync('node_modules')) {
console.log('📦 Installing dependencies...');
const install = spawn('npm', ['install'], { stdio: 'inherit' });
install.on('close', (code) => {
if (code === 0) {
console.log('✅ Dependencies installed successfully!\n');
startServer();
} else {
console.log('❌ Failed to install dependencies');
process.exit(1);
}
});
} else {
console.log('✅ Dependencies already installed\n');
startServer();
}
function startServer() {
console.log('🚀 Starting Code Fix server...\n');
const server = spawn('npm', ['run', 'dev'], { stdio: 'inherit' });
server.on('close', (code) => {
console.log(`\n📊 Server exited with code ${code}`);
});
// Handle Ctrl+C gracefully
process.on('SIGINT', () => {
console.log('\n\n👋 Shutting down Code Fix server...');
server.kill('SIGINT');
process.exit(0);
});
}