-
Notifications
You must be signed in to change notification settings - Fork 66
/
gulpfile.js
72 lines (59 loc) · 1.89 KB
/
gulpfile.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
61
62
63
64
65
66
67
68
69
70
71
72
const gulp = require('gulp');
const del = require('del');
const fs = require('fs');
var exec = require('child_process').exec;
const config = {
package: {
source: './package.json'
},
baseDir: 'src',
releaseDirectory: 'dist'
};
config.package.data = JSON.parse(fs.readFileSync(config.package.source));
function buildApp(vars, env, done) {
const cmd = `yarn run build:${env} ${Object.entries(vars).map(([k, v]) => `--env.${k}=${v}`).join(' ')}`;
exec(cmd, function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
done(err);
})
}
function clean() {
return del([
config.releaseDirectory + '/*',
config.releaseDirectory
]);
}
function buildOfficialProd(done) {
buildApp({
network: 'mainnet',
decompileUrl: 'https://nodes.wavesnodes.com/utils/script/decompile'
}, 'prod', done);
}
function buildOfficialTestnet(done) {
buildApp({
network: 'testnet',
decompileUrl: 'https://testnode1.wavesnodes.com/utils/script/decompile'
}, 'prod', done);
}
function buildOfficialStagenet(done) {
buildApp({
network: 'stagenet',
decompileUrl: 'https://nodes-stagenet.wavesnodes.com/utils/script/decompile'
}, 'prod', done);
}
function buildOfficialStaging(done) {
buildApp({network: 'mainnet'}, 'dev', done);
}
function buildDevnet(done) {
buildApp({network: 'devnet'}, 'prod', done);
}
function buildCustom(done) {
buildApp({network: 'custom'}, 'prod', done);
}
exports.buildOfficialProd = gulp.series(clean, buildOfficialProd);
exports.buildOfficialStaging = gulp.series(clean, buildOfficialStaging);
exports.buildOfficialStagenet = gulp.series(clean, buildOfficialStagenet);
exports.buildOfficialTestnet = gulp.series(clean, buildOfficialTestnet);
exports.buildDevnet = gulp.series(clean, buildDevnet);
exports.buildCustom = gulp.series(clean, buildCustom);