mirror of
https://github.com/versia-pub/api.git
synced 2025-12-06 08:28:19 +01:00
feat(build): ✨ Build both packages at once
This commit is contained in:
parent
b08023e71e
commit
b8b5f2a4ff
18
build.ts
18
build.ts
|
|
@ -1,23 +1,25 @@
|
|||
import dts from "bun-plugin-dts";
|
||||
import ora from "ora";
|
||||
|
||||
const spinner = ora("Building...").start();
|
||||
for (const pkg of ["federation", "client"]) {
|
||||
const subSpinner = ora(`Building ${pkg} module`).start();
|
||||
|
||||
await Bun.build({
|
||||
entrypoints: ["federation/index.ts"],
|
||||
outdir: "federation/dist",
|
||||
await Bun.build({
|
||||
entrypoints: [`${pkg}/index.ts`],
|
||||
outdir: `${pkg}/dist`,
|
||||
format: "esm",
|
||||
minify: true,
|
||||
sourcemap: "external",
|
||||
splitting: true,
|
||||
target: "browser",
|
||||
plugins: [dts()],
|
||||
}).then((output) => {
|
||||
}).then((output) => {
|
||||
if (!output.success) {
|
||||
spinner.fail("Failed to build federation module");
|
||||
subSpinner.fail(`Failed to build ${pkg} module`);
|
||||
console.error(output.logs);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
spinner.succeed("Built federation module");
|
||||
subSpinner.succeed(`Built ${pkg} module`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue