-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
45 lines (35 loc) Β· 1.5 KB
/
build.js
File metadata and controls
45 lines (35 loc) Β· 1.5 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
44
45
#!/usr/bin/env node
const { execSync } = require('child_process');
const path = require('path');
const fs = require('fs');
console.log('π Building RefactorAI for production...');
try {
// Check if we're in the right directory
const rootDir = process.cwd();
const backendDir = path.join(rootDir, 'backend');
const frontendDir = path.join(rootDir, 'frontend');
if (!fs.existsSync(backendDir) || !fs.existsSync(frontendDir)) {
throw new Error('Please run this script from the project root directory');
}
// Install backend dependencies
console.log('π¦ Installing backend dependencies...');
execSync('npm install', { cwd: backendDir, stdio: 'inherit' });
// Install frontend dependencies and build
console.log('π¦ Installing frontend dependencies...');
execSync('npm install --include=dev', { cwd: frontendDir, stdio: 'inherit' });
console.log('ποΈ Building frontend...');
execSync('npm run build', { cwd: frontendDir, stdio: 'inherit' });
// Verify build output
const distDir = path.join(frontendDir, 'dist');
if (!fs.existsSync(distDir)) {
throw new Error('Frontend build failed - dist directory not found');
}
console.log('β
Build completed successfully!');
console.log('π Ready for deployment!');
console.log('');
console.log('To start the server:');
console.log(' cd backend && npm start');
} catch (error) {
console.error('β Build failed:', error.message);
process.exit(1);
}