-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-fullstack.js
More file actions
48 lines (37 loc) Β· 1.46 KB
/
test-fullstack.js
File metadata and controls
48 lines (37 loc) Β· 1.46 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
46
47
48
#!/usr/bin/env node
import { exec } from 'child_process';
import { promisify } from 'util';
import process from 'process';
const execAsync = promisify(exec);
console.log('π Testing full-stack build locally...\n');
async function testBuild() {
try {
console.log('π¦ Building frontend...');
await execAsync('npm run build');
console.log('β
Frontend build completed\n');
console.log('π¦ Installing server dependencies...');
await execAsync('cd server && npm install');
console.log('β
Server dependencies installed\n');
console.log('π― Testing production build locally...');
console.log('Setting NODE_ENV=production...');
// Start server with production environment
const serverProcess = exec('cross-env NODE_ENV=production npm run server:start');
serverProcess.stdout.on('data', (data) => {
console.log(data.toString());
});
serverProcess.stderr.on('data', (data) => {
console.error(data.toString());
});
// Wait a bit for server to start
setTimeout(() => {
console.log('\nπ Server should be running at: http://localhost:3002');
console.log('π± Frontend should be served from: http://localhost:3002');
console.log('π API endpoints available at: http://localhost:3002/api/*');
console.log('\nPress Ctrl+C to stop the server');
}, 2000);
} catch (error) {
console.error('β Error during build test:', error.message);
process.exit(1);
}
}
testBuild();