-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathparallel-compile.js
More file actions
52 lines (44 loc) · 1.32 KB
/
Copy pathparallel-compile.js
File metadata and controls
52 lines (44 loc) · 1.32 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
49
50
51
52
const { spawn } = require('child_process');
const path = require('path');
console.log('Starting parallel compilation...');
// Create promises for each compilation process
const compileMain = new Promise((resolve, reject) => {
const proc = spawn('dotnet', ['fable', 'src/Main', '-s'], {
shell: true,
stdio: 'inherit'
});
proc.on('close', (code) => {
if (code === 0) {
console.log('✓ Main compilation completed');
resolve();
} else {
reject(new Error(`Main compilation failed with code ${code}`));
}
});
proc.on('error', reject);
});
const compileRenderer = new Promise((resolve, reject) => {
const proc = spawn('dotnet', ['fable', 'src/Renderer', '-s', '--define', 'PRODUCTION'], {
shell: true,
stdio: 'inherit'
});
proc.on('close', (code) => {
if (code === 0) {
console.log('✓ Renderer compilation completed');
resolve();
} else {
reject(new Error(`Renderer compilation failed with code ${code}`));
}
});
proc.on('error', reject);
});
// Wait for both compilations to complete
Promise.all([compileMain, compileRenderer])
.then(() => {
console.log('✓ All compilations completed successfully');
process.exit(0);
})
.catch((error) => {
console.error('✗ Compilation failed:', error.message);
process.exit(1);
});