Thread viewer for Bluesky
at master 42 lines 934 B view raw
1import { parseArgs } from 'util'; 2import { SveltePlugin } from 'bun-plugin-svelte'; 3 4function buildOptions(devMode) { 5 return { 6 conditions: devMode ? [] : ['production'], 7 entrypoints: ['src/skythread.js'], 8 outdir: 'dist', 9 format: 'iife', 10 minify: true, 11 sourcemap: true, 12 plugins: [ 13 SveltePlugin({ 14 // When `true`, this plugin will generate development-only checks and other niceties. 15 // When `false`, this plugin will generate production-ready code 16 development: devMode, 17 }) 18 ] 19 }; 20} 21 22async function runBuild(devMode) { 23 let options = buildOptions(devMode); 24 return await Bun.build(options); 25} 26 27if (import.meta.main) { 28 let { values: options } = parseArgs({ 29 args: Bun.argv, 30 options: { 31 dev: { 32 type: 'boolean' 33 } 34 }, 35 strict: true, 36 allowPositionals: true 37 }); 38 39 await runBuild(options.dev); 40} 41 42export { buildOptions, runBuild };