-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.mjs
39 lines (35 loc) · 952 Bytes
/
build.mjs
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
import { esbuildDecorators } from '@aurora-launcher/esbuild-decorators';
import { context } from 'esbuild';
import minimist from 'minimist';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { _, watch, ...args } = minimist(process.argv.slice(2));
if (!watch) {
console.log('Build...');
console.time('Build successfully');
}
const ctx = await context({
entryPoints: ['src/main/index.ts'],
bundle: true,
sourcemap: true,
platform: 'node',
target: 'node20',
format: 'cjs',
outdir: 'build/main',
external: ['electron'],
keepNames: true,
loader: {
'.png': 'file',
//TODO Secure auth
'.pem': 'base64',
},
plugins: [esbuildDecorators()],
...args,
}).catch(() => process.exit(1));
if (watch) {
console.log('Watching...');
await ctx.watch();
} else {
await ctx.rebuild();
await ctx.dispose();
console.timeEnd('Build successfully');
}