-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ts
38 lines (34 loc) · 1003 Bytes
/
build.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import dts from "bun-plugin-dts";
import ora from "ora";
const entrypoints = {
federation: ["index.ts", "schemas.ts", "types.ts"],
client: ["index.ts", "types.ts"],
};
for (const pkg of ["federation", "client"]) {
const subSpinner = ora(`Building ${pkg} module`).start();
await Bun.build({
entrypoints: entrypoints[pkg as "federation" | "client"].map(
(entrypoint) => `${pkg}/${entrypoint}`,
),
outdir: `${pkg}/dist`,
format: "esm",
minify: false,
sourcemap: "external",
splitting: true,
target: "browser",
plugins: [
dts({
output: {
noBanner: true,
},
}),
],
}).then((output) => {
if (!output.success) {
subSpinner.fail(`Failed to build ${pkg} module`);
console.error(output.logs);
process.exit(1);
}
});
subSpinner.succeed(`Built ${pkg} module`);
}