forked from wavesplatform/WavesExplorerLite
-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
69 lines (55 loc) · 1.76 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
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 dockerImage(done) {
exec('docker build . -t turtlenetwork/tn-explorer:' + config.package.data.version, function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
done(err);
});
}
function pushDockerImage(done){
exec('docker push turtlenetwork/tn-explorer:' + config.package.data.version, function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
done(err);
});
}
exports.buildOfficialProd = gulp.series(clean, buildOfficialProd);
exports.buildOfficialTestnet = gulp.series(clean, buildOfficialTestnet);
exports.buildOfficialDocker = gulp.series(clean,buildOfficialProd, dockerImage,pushDockerImage);