forked from httptoolkit/brotli-wasm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
28 lines (23 loc) · 837 Bytes
/
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
const shell = require('shelljs');
if (!shell.which('wasm-pack')) {
console.error("Run npm install to install all dependencies first");
}
// Clean up any existing built content:
shell.rm('-rf', 'dist');
shell.rm('-rf', 'pkg.*');
shell.mkdir('dist');
// Create the bundler output
shell.rm('-rf', 'pkg');
shell.exec('wasm-pack build --target bundler');
shell.mv('pkg', 'pkg.bundler');
shell.rm('pkg.bundler/{LICENSE,package.json,README.md,.gitignore}');
// Create the node output
shell.rm('-rf', 'pkg');
shell.exec('wasm-pack build --target nodejs');
shell.mv('pkg', 'pkg.node');
shell.rm('pkg.node/{LICENSE,package.json,README.md,.gitignore}');
// Create the web output
shell.rm('-rf', 'pkg');
shell.exec('wasm-pack build --target web');
shell.mv('pkg', 'pkg.web');
shell.rm('pkg.web/{LICENSE,package.json,README.md,.gitignore}');