-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ts
More file actions
33 lines (31 loc) · 767 Bytes
/
build.ts
File metadata and controls
33 lines (31 loc) · 767 Bytes
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
import { type } from 'node:os';
import type { Build } from 'bun';
let target: Build.CompileTarget;
switch (type()) {
case 'Linux':
target = 'bun-linux-x64-modern';
break;
case 'Darwin':
target = 'bun-darwin-x64-modern';
break;
case 'Windows_NT':
target = 'bun-windows-x64-modern';
break;
default:
throw Error('Build target could not be determined');
}
console.log(
(
await Bun.build({
entrypoints: ['src/index.ts'],
outdir: './out',
target: 'bun',
minify: true,
sourcemap: 'inline',
compile: {
target,
outfile: 'fixFileExt',
},
})
).logs.join('\n'),
);