Repository navigation
Expand file tree
/
Copy pathbuild-binary.js
More file actions
62 lines (53 loc) · 1.6 KB
/
Copy pathbuild-binary.js
File metadata and controls
62 lines (53 loc) · 1.6 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
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env node
const { execSync } = require('child_process');
const path = require('path');
const fs = require('fs');
console.log('=== Behavior3Editor Binary Build Script ===\n');
const baseDir = __dirname;
const bowerPath = path.join(baseDir, 'bower_components');
const buildPath = path.join(baseDir, 'build');
const distPath = path.join(baseDir, 'dist');
try {
console.log('Step 1: Checking bower dependencies...');
if (!fs.existsSync(bowerPath)) {
console.log(' Installing bower components...');
execSync('npx bower install --allow-root', {
cwd: baseDir,
stdio: 'inherit',
shell: true
});
} else {
console.log(' ✓ Bower components already exist');
}
console.log('\nStep 2: Building web assets...');
execSync('npx gulp build', {
cwd: baseDir,
stdio: 'inherit',
shell: true
});
console.log('\nStep 3: Packaging for desktop (Electron)...');
execSync('npx gulp dist', {
cwd: baseDir,
stdio: 'inherit',
shell: true
});
console.log('\n✅ Build complete!');
console.log(`Output location: ${distPath}`);
if (fs.existsSync(distPath)) {
const files = fs.readdirSync(distPath);
console.log('\nGenerated files:');
files.forEach(f => {
const fullPath = path.join(distPath, f);
const stat = fs.statSync(fullPath);
if (stat.isDirectory()) {
console.log(` 📁 ${f}/`);
} else {
const size = (stat.size / 1024 / 1024).toFixed(1);
console.log(` 📦 ${f} (${size}MB)`);
}
});
}
} catch (error) {
console.error('\n❌ Build failed:', error.message);
process.exit(1);
}