-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.babel.js
50 lines (41 loc) · 1.2 KB
/
gulpfile.babel.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
import gulp from 'gulp';
import yaml from 'gulp-yaml';
import rename from 'gulp-rename';
import merge from 'gulp-merge-json';
import babel from 'gulp-babel';
import copy from 'gulp-copy';
gulp.task('generation', function() {
const status = gulp
.src('./data/status/*.yml')
.pipe(yaml({ space: 2 }))
.pipe(rename(function (path) {
// Rename <status>.yml to <status>/tree.json
path.dirname += '/' + path.basename;
path.basename = 'tree';
}))
.pipe(gulp.dest('./src/status/'));
const taxes = gulp
.src('./data/taxes/*.yml')
.pipe(yaml({ space: 2 }))
.pipe(merge({
fileName: 'taxes.json',
edit: function(json) {
// Exclude special keys form the output (__defs__)
['__defs__'].forEach(exclude => json[exclude] = undefined);
return json;
}
}))
.pipe(gulp.dest('./src/taxes/'));
return [ status, taxes ];
});
gulp.task('compilation', [ 'generation' ], function () {
const es6 = gulp
.src('src/**/*.js')
.pipe(babel())
.pipe(gulp.dest('dist'));
const json = gulp
.src('src/**/*.json')
.pipe(gulp.dest('dist'));
return [ es6, json ];
});
gulp.task('default', [ 'generation', 'compilation' ]);