This commit is contained in:
2025-05-23 12:05:53 +08:00
parent 5e03ef2dd9
commit 5cce86d476
3 changed files with 27 additions and 51 deletions

View File

@@ -1,20 +1,24 @@
// @ts-check
// https://bun.sh/docs/bundler
// @ts-ignore
import pkg from './package.json';
import { resolvePath as rp } from '@kevisual/use-config/env';
// bun run src/index.ts --
import { resolvePath } from '@kevisual/use-config/env';
import { execSync } from 'node:child_process';
const entry = 'src/index.ts';
const naming = 'app';
/**
* @type {import('bun').BuildConfig}
*/
await Bun.build({
target: 'node',
format: 'esm',
entrypoints: [rp('./src/main.ts')],
outdir: rp('./dist'),
entrypoints: [resolvePath(entry, { meta: import.meta })],
outdir: resolvePath('./dist', { meta: import.meta }),
naming: {
entry: 'app.mjs',
},
define: {
VERSION: JSON.stringify(pkg.version),
entry: `${naming}.js`,
},
external: [],
env: 'KEVISUAL_*',
});
// const cmd = `dts -i src/index.ts -o app.d.ts`;
const cmd = `dts -i ${entry} -o ${naming}.d.ts`;
execSync(cmd, { stdio: 'inherit' });