-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.ts
51 lines (45 loc) · 1.15 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
import dts from "bun-plugin-dts";
import Logger from "@rabbit-company/logger";
import fs from "fs/promises";
await fs.rm("./module", { recursive: true, force: true });
await fs.rm("./dist", { recursive: true, force: true });
Logger.info("Start bulding module...");
let moduleBuild = await Bun.build({
entrypoints: ["./src/passky-api.ts"],
outdir: "./module",
target: "browser",
format: "esm",
minify: true,
banner: `/**
*
* PasskyAPI-JS 8.1.0
* https://github.com/Rabbit-Company/PasskyAPI-JS
*
*/`,
plugins: [dts({ output: { noBanner: true } })],
});
if (moduleBuild.success) {
Logger.info("Bulding module complete");
} else {
Logger.error("Bulding module failed");
}
fs.cp("./src/index.html", "./dist/index.html", {
recursive: true,
force: true,
});
Logger.info("Start bundling dist...");
let distBuild = await Bun.build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
target: "browser",
format: "esm",
minify: true,
sourcemap: "none", // Bun still generates incorrect sourcemaps
plugins: [],
});
if (distBuild.success) {
Logger.info("Bundling dist complete");
} else {
Logger.error("Bundling dist failed");
Logger.error(distBuild.logs);
}