-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.ts
executable file
·38 lines (32 loc) · 880 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
// @ts-nocheck
import { build, $ } from "bun";
import { readdirSync } from "node:fs";
import { log } from "node:console";
const baseOptions = {
entrypoints: ["./lib/index.ts"],
outdir: "./build",
minify: {
whitespace: true,
syntax: true,
identifiers: true,
},
target: "browser",
format: "esm",
},
logger = (env) => log(`${env} build complete🏗`);
await $`rm -rf build && echo 'Cleaned build/ directory'`;
// library bundle minified
await build({
...baseOptions,
naming: "browser/huetiful.min.js",
}).then(logger("Browser ESM (minified) entire library"));
// node bundle
await build({
...baseOptions,
minify: false,
target: "node",
external: ["culori"],
naming: "node/huetiful.esm.js",
}).then(logger("Node"));
await $`bun tsup --format=esm ./lib/index.ts --dts-only --outDir=./build`;
await $`du -sh build/*`;