-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild
More file actions
83 lines (78 loc) · 1.61 KB
/
build
File metadata and controls
83 lines (78 loc) · 1.61 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env zx
const { fs } = require('zx')
if (await fs.pathExists('dist')) {
await $`rm -r dist`
}
await $`mkdir dist`
const nodeExe = os.platform() === 'win32' ? 'node.exe' : 'node'
const esBuildPath = './node_modules/esbuild/bin/esbuild'
const builds = [
{
src: './src/index.mjs',
format: 'esm',
target: './dist/x-widget-all.mjs'
},
{
src: './src/index.mjs',
format: 'cjs',
target: './dist/x-widget-all.js'
},
{
src: './src/index.mjs',
format: 'esm',
target: './dist/x-widget-all.min.mjs'
},
{
src: './src/index.mjs',
format: 'cjs',
target: './dist/x-widget-all.min.js'
},
{
src: './src/x-widget.mjs',
format: 'esm',
target: './dist/x-widget.mjs'
},
{
src: './src/x-widget.mjs',
format: 'cjs',
target: './dist/x-widget.js'
},
{
src: './src/x-widget.mjs',
format: 'esm',
target: './dist/x-widget.min.mjs'
},
{
src: './src/x-widget.mjs',
format: 'cjs',
target: './dist/x-widget.min.js'
},
{
src: './src/x-widget-data.mjs',
format: 'esm',
target: './dist/x-widget-data.mjs'
},
{
src: './src/x-widget-data.mjs',
format: 'cjs',
target: './dist/x-widget-data.js'
},
{
src: './src/x-widget-data.mjs',
format: 'esm',
target: './dist/x-widget-data.min.mjs'
},
{
src: './src/x-widget-data.mjs',
format: 'cjs',
target: './dist/x-widget-data.min.js'
}
]
await Promise.all(
builds.map(
(build) =>
$`esbuild ${build.src} --bundle --format=${build.format} ${
build.target.includes('.min.') ? '--minify' : ''
} >${build.target}`
)
)