-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.mjs
More file actions
45 lines (38 loc) · 1.06 KB
/
build.mjs
File metadata and controls
45 lines (38 loc) · 1.06 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
import { execFileSync } from 'node:child_process';
import { cpSync, mkdirSync } from 'node:fs';
import { resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const npx = (args) => execFileSync('npx', args, { stdio: 'inherit', cwd: __dirname });
mkdirSync('dist/src', { recursive: true });
mkdirSync('assets', { recursive: true });
npx([
'esbuild',
'src/main.ts',
'--bundle',
'--platform=node',
'--format=cjs',
'--outfile=dist/src/main.cjs',
'--external:electron',
]);
npx([
'esbuild',
'src/preload.ts',
'--bundle',
'--platform=node',
'--format=cjs',
'--outfile=dist/src/preload.cjs',
'--external:electron',
]);
npx([
'esbuild',
'src/renderer.ts',
'--bundle',
'--platform=browser',
'--format=iife',
'--outfile=assets/renderer.js',
]);
const uiDist = resolve(__dirname, '..', 'devtools-ui', 'dist');
cpSync(`${uiDist}/elm.js`, 'assets/elm.js');
cpSync(`${uiDist}/panel.css`, 'assets/panel.css');
console.log('[build] Standalone debugger built successfully.');