feat: 修改为bun,优化代码

This commit is contained in:
2025-05-20 00:36:32 +08:00
parent 3de5754f24
commit 1f4404fa5c
32 changed files with 618 additions and 1035 deletions

37
bun.config.mjs Normal file
View File

@@ -0,0 +1,37 @@
// @ts-check
import { resolvePath } from '@kevisual/use-config/env';
import { execSync } from 'node:child_process';
const entry = 'src/index.ts';
const naming = 'app';
const external = ['sequelize', 'pg', 'sqlite3', 'ioredis', 'pm2'];
/**
* @type {import('bun').BuildConfig}
*/
await Bun.build({
target: 'node',
format: 'esm',
entrypoints: [resolvePath(entry, { meta: import.meta })],
outdir: resolvePath('./dist', { meta: import.meta }),
naming: {
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' });
await Bun.build({
target: 'node',
format: 'esm',
entrypoints: [resolvePath('./src/run.ts', { meta: import.meta })],
outdir: resolvePath('./dist', { meta: import.meta }),
naming: {
entry: `${'run'}.js`,
},
external,
env: 'KEVISUAL_*',
});