2024-05-14 09:00:05 +02:00
|
|
|
import dts from "bun-plugin-dts";
|
|
|
|
|
import ora from "ora";
|
|
|
|
|
|
2024-06-07 09:31:49 +02:00
|
|
|
for (const pkg of ["federation", "client"]) {
|
|
|
|
|
const subSpinner = ora(`Building ${pkg} module`).start();
|
2024-05-14 09:00:05 +02:00
|
|
|
|
2024-06-07 09:31:49 +02:00
|
|
|
await Bun.build({
|
|
|
|
|
entrypoints: [`${pkg}/index.ts`],
|
|
|
|
|
outdir: `${pkg}/dist`,
|
|
|
|
|
format: "esm",
|
|
|
|
|
minify: true,
|
|
|
|
|
sourcemap: "external",
|
|
|
|
|
splitting: true,
|
|
|
|
|
target: "browser",
|
|
|
|
|
plugins: [dts()],
|
|
|
|
|
}).then((output) => {
|
|
|
|
|
if (!output.success) {
|
|
|
|
|
subSpinner.fail(`Failed to build ${pkg} module`);
|
|
|
|
|
console.error(output.logs);
|
|
|
|
|
process.exit(1);
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-05-14 09:00:05 +02:00
|
|
|
|
2024-06-07 09:31:49 +02:00
|
|
|
subSpinner.succeed(`Built ${pkg} module`);
|
|
|
|
|
}
|