refactor(build): migrate build script to use bun build command directly
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "bun run scripts/build.ts",
|
||||
"build": "bun build ./src/index.ts --outdir ./dist --format esm --target browser --sourcemap=external --external @extism/extism --entry-naming enclave.js && bun run tsc --emitDeclarationOnly --declaration -p src/tsconfig.json --outDir dist",
|
||||
"typecheck": "tsc --noEmit -p src/tsconfig.json",
|
||||
"clean": "rm -rf dist"
|
||||
},
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import { $ } from 'bun';
|
||||
|
||||
const result = await Bun.build({
|
||||
entrypoints: ['./src/index.ts'],
|
||||
outdir: './dist',
|
||||
format: 'esm',
|
||||
target: 'browser',
|
||||
minify: false,
|
||||
sourcemap: 'external',
|
||||
external: ['@extism/extism'],
|
||||
naming: {
|
||||
entry: 'enclave.js',
|
||||
},
|
||||
});
|
||||
|
||||
if (!result.success) {
|
||||
console.error('Build failed:');
|
||||
for (const log of result.logs) {
|
||||
console.error(log);
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log('Build successful:');
|
||||
for (const output of result.outputs) {
|
||||
console.log(` ${output.path}`);
|
||||
}
|
||||
|
||||
await $`bun run tsc --emitDeclarationOnly --declaration -p src/tsconfig.json --outDir dist`;
|
||||
console.log('Type declarations generated');
|
||||
Reference in New Issue
Block a user