-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbuild.js
More file actions
42 lines (37 loc) · 954 Bytes
/
Copy pathbuild.js
File metadata and controls
42 lines (37 loc) · 954 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
34
35
36
37
38
39
40
41
42
import { parseArgs } from 'util';
import { SveltePlugin } from 'bun-plugin-svelte';
function buildOptions(devMode) {
return {
conditions: devMode ? [] : ['production'],
entrypoints: ['src/skythread.js', 'src/highlight.ts'],
outdir: 'dist',
format: 'iife',
minify: true,
sourcemap: true,
plugins: [
SveltePlugin({
// When `true`, this plugin will generate development-only checks and other niceties.
// When `false`, this plugin will generate production-ready code
development: devMode,
})
]
};
}
async function runBuild(devMode) {
let options = buildOptions(devMode);
return await Bun.build(options);
}
if (import.meta.main) {
let { values: options } = parseArgs({
args: Bun.argv,
options: {
dev: {
type: 'boolean'
}
},
strict: true,
allowPositionals: true
});
await runBuild(options.dev);
}
export { buildOptions, runBuild };