forked from CircuitVerse/cv-frontend-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtauri-build.js
36 lines (28 loc) · 845 Bytes
/
tauri-build.js
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
const os = require('os');
const { execSync } = require('child_process');
function runCommand(command) {
try {
const output = execSync(command, { encoding: 'utf8', stdio: 'pipe' });
if (output) {
console.log(output);
}
} catch (error) {
console.error(`Error executing command: ${command}`);
if (error.stdout) {
console.error(`Stdout: ${error.stdout}`);
}
if (error.stderr) {
console.error(`Stderr: ${error.stderr}`);
}
process.exit(1);
}
}
process.env.DESKTOP_MODE = "true";
const platform = os.platform();
console.log(`Building for ${platform === 'win32' ? 'Windows' : 'Unix-based system'}...`);
runCommand('npm run build');
if (platform === 'win32') {
runCommand('copy dist\\index-cv.html dist\\index.html');
} else {
runCommand('cp dist/index-cv.html dist/index.html');
}