31 lines
663 B
TypeScript
31 lines
663 B
TypeScript
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');
|