-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathes_build.js
executable file
·60 lines (55 loc) · 1.36 KB
/
es_build.js
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
52
53
54
55
56
57
58
59
60
const esbuild = require("esbuild")
const fs = require('fs')
const commonOpts = {
platform: "neutral",
bundle: true,
minify: !!process.env.PUBLISH,
treeShaking: true,
metafile: true,
sourcemap: !process.env.PUBLISH,
target: ["es2020"],
}
const report = result =>
result.then(a => {
esbuild
.analyzeMetafile(a.metafile, { verbose: true })
.then(text => console.log(text))
})
const buildOne = pkg => {
let result = esbuild.build({
...commonOpts,
platform: "neutral",
entryPoints: [`lib/pkgs/${pkg}/index.js`],
entryNames: `${pkg}.es`,
outdir: `lib/pkgs/${pkg}/dist`,
})
report(result)
}
fs.rm("lib/pkgs/fset/dist", { recursive: true, force: true }, err => err && console.log(err))
// buildOne("model")
// buildOne("json")
// buildOne("html")
result = esbuild.build({
...commonOpts,
entryPoints: [
// "lib/main.css",
// "lib/css/model.css",
// "lib/css/sch-meta.css",
// "lib/css/file.css",
// "lib/css/sheet.css",
// "lib/css/html.css",
// "lib/css/json.css",
"lib/main.js",
"lib/pkgs/file/index.js",
"lib/pkgs/model/index.js",
"lib/pkgs/json/index.js",
"lib/pkgs/html/index.js",
"lib/pkgs/sheet/index.js"
],
entryNames: "[dir]/[name]",
chunkNames: "chunks/[name]-[hash]",
mainFields: ["main"],
splitting: true,
outdir: "lib/pkgs/fset/dist"
})
report(result)