forked from Psychedelic/plug-coinflip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
30 lines (24 loc) · 762 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
29
30
const { execSync } = require('child_process');
function buildWasm(pkg) {
const underscoredName = pkg.replace(/-/g, '_');
const buildCommand = [
'cargo',
'build',
'--target',
'wasm32-unknown-unknown',
'--release',
'--package',
pkg,
];
console.log(`Building ${underscoredName}.wasm`);
execSync(buildCommand.join(' '));
const optCommand = [
'ic-cdk-optimizer',
`target/wasm32-unknown-unknown/release/${underscoredName}.wasm`,
'-o',
`target/wasm32-unknown-unknown/release/${underscoredName}-opt.wasm`,
];
console.log(`Running ic-cdk-optimizer on ${underscoredName}.wasm`);
execSync(optCommand.join(' '));
}
buildWasm('plug_coin_flip');