31 lines
788 B
JavaScript
31 lines
788 B
JavaScript
// @ts-check
|
|
import { resolvePath, getDevInputs } from '@kevisual/use-config/env';
|
|
import { execSync } from 'node:child_process';
|
|
import glob from 'fast-glob';
|
|
|
|
const files = await glob('src/*.ts');
|
|
const inputs = getDevInputs(files);
|
|
const external = ['@kevisual/router'];
|
|
for (let input of inputs) {
|
|
const entry = input.path;
|
|
const naming = input.naming;
|
|
/**
|
|
* @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: external,
|
|
env: 'KEVISUAL_*',
|
|
});
|
|
|
|
const cmd = `dts -i ${entry} -o ${naming}.d.ts`;
|
|
execSync(cmd, { stdio: 'inherit' });
|
|
}
|