forked from ForkMaps/cryptonote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
60 lines (51 loc) · 1.26 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
/**
* Gulp tasks.
*/
const gulp = require('gulp'),
addsrc = require('gulp-add-src'),
concat = require('gulp-concat'),
del = require('del'),
jsonConcat = require('gulp-json-concat'),
packageInfo = require('./package.json'),
path = require('path'),
runSequence = require('run-sequence');
const dir = {
dist: 'dist',
src: 'src'
};
// Default build output.
let outputDir = dir.dist;
// Combine src/coins/*.json files.
gulp.task('combine-coins', function () {
return gulp.src(dir.src + '/coins/**/*.json')
.pipe(jsonConcat('coins.json',function(data){
return new Buffer(JSON.stringify(data));
}))
.pipe(gulp.dest(outputDir));
});
// Copy coin images.
gulp.task('copy-images', function () {
return gulp.src(dir.src + '/images/**/*', {base: dir.src})
.pipe(gulp.dest(outputDir));
});
// Cleanup task.
gulp.task('clean', function (cb) {
return del([outputDir], {force: true}, cb);
});
// Build Task
gulp.task('build', function (cb) {
runSequence(
'clean',
['combine-coins', 'copy-images'],
cb
);
});
// Prod
gulp.task('build-prod', function (cb) {
outputDir = dir.dist;
runSequence('build', cb);
});
// Default task
gulp.task('default', function(cb) {
runSequence('build', cb);
});