forked from CoinSpace/CoinSpace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
31 lines (27 loc) · 804 Bytes
/
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
import { execSync } from 'node:child_process';
const { VITE_DISTRIBUTION } = process.env;
if (!['appx', 'appx-dev', 'mac', 'mas', 'mas-dev', 'snap'].includes(VITE_DISTRIBUTION)) {
console.error(`Unsupported distribution: ${VITE_DISTRIBUTION}`);
process.exit(1);
}
function forgePlatform(distribution) {
switch (distribution) {
case 'mac':
return 'darwin';
case 'mas':
case 'mas-dev':
return 'mas';
case 'appx':
case 'appx-dev':
return 'win32';
case 'snap':
return 'linux';
default:
return distribution;
}
}
console.log(`Start build (electron:${VITE_DISTRIBUTION})...`);
execSync(`npm run publish -- --platform=${forgePlatform(VITE_DISTRIBUTION)}`, {
stdio: [0, 1, 2],
});
console.log(`Done build (electron:${VITE_DISTRIBUTION})`);