forked from observablehq/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
24 lines (22 loc) · 672 Bytes
/
build.js
File metadata and controls
24 lines (22 loc) · 672 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import {parseArgs} from "node:util";
import {build} from "esbuild";
import {glob} from "glob";
const {values, positionals} = parseArgs({
allowPositionals: true,
options: {
outdir: {type: "string", default: "build"},
outbase: {type: "string"},
ignore: {type: "string", multiple: true},
sourcemap: {type: "boolean"}
}
});
await build({
entryPoints: await glob(positionals, {ignore: values.ignore}),
define: {"process.env.npm_package_version": `"${process.env.npm_package_version}"`},
outdir: values.outdir,
outbase: values.outbase,
platform: "node",
sourcemap: values.sourcemap ? "linked" : false,
format: "esm",
logLevel: "info"
});