forked from tweakphp/tweakphp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.js
33 lines (29 loc) · 755 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
32
33
const { buildSync } = require('esbuild')
const { copySync } = require('fs-extra')
const options = {
platform: 'node',
bundle: true,
target: 'node20',
external: ['electron'],
define: {
'process.env.NODE_ENV': `"${process.argv[2] === '--dev' ? 'development' : 'production'}"`,
'process.platform': `"${process.platform}"`,
},
loader: {
'.node': 'file',
},
}
buildSync({
entryPoints: ['src/main/main.ts'],
outfile: 'dist/main.js',
...options,
minify: process.argv[2] !== '--dev',
})
buildSync({
entryPoints: ['src/preload/preload.ts'],
outfile: 'dist/preload.js',
...options,
})
copySync('build/icon.png', 'dist/icon.png')
copySync('build/icon.icns', 'dist/icon.icns')
copySync('build/icon.ico', 'dist/icon.ico')