You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
712 B
26 lines
712 B
import { resolve } from "node:path";
|
|
import fg from "fast-glob";
|
|
import { build } from "unbuild";
|
|
|
|
export function buildOne(dir: string, isDev: boolean = false) {
|
|
const rootDir = resolve("packages/" + dir);
|
|
|
|
const files = fg.sync(["src/**/*.ts"], { cwd: rootDir, ignore: ["**/__tests__/**/*", "**/docs/**/*"] });
|
|
|
|
return build(rootDir, false, {
|
|
rootDir: rootDir,
|
|
entries: files,
|
|
declaration: !isDev,
|
|
replace: {
|
|
__DEV__: String(isDev),
|
|
},
|
|
watch: isDev,
|
|
rollup: {
|
|
emitCJS: !isDev,
|
|
output: {
|
|
preserveModules: true,
|
|
preserveModulesRoot: "src",
|
|
},
|
|
},
|
|
});
|
|
}
|
|
|