-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
60 lines (52 loc) · 1.49 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
const { src, dest } = require('gulp');
var gulpBump = require('gulp-bump');
var fs = require('fs');
var shell = require('shelljs');
const distPath = 'dist';
const tscOutDir = 'js';
function layout(layoutFile) {
let layout = JSON.parse(fs.readFileSync(layoutFile).toString());
for (let part of layout.parts) {
if (!shell.test('-e', part.destination)) {
shell.mkdir('-p', part.destination);
}
if (part.folders && part.folders.length) {
console.log('Copying folders ' + part.folders + '...')
shell.cp('-rf', part.folders, part.destination);
}
if (part.files && part.files.length) {
console.log('Copying files ' + part.files + '...')
shell.cp(part.files, part.destination);
}
}
}
function clean(cb) {
shell.rm('-rf', distPath);
shell.rm('-rf', tscOutDir);
cb();
}
exports.clean = clean;
function dist(cb) {
layout('distLayout.json');
cb();
}
exports.dist = dist;
function bump() {
return src('./package.json')
.pipe(gulpBump({key: 'version'}))
.pipe(dest('./'));
}
exports.bump = bump;
function bumpMinor() {
return src('./package.json')
.pipe(gulpBump({key: 'version', type: 'minor'}))
.pipe(dest('./'));
}
exports.bumpMinor = bumpMinor;
function bumpMajor() {
return src('./package.json')
.pipe(gulpBump({key: 'version', type: 'major'}))
.pipe(dest('./'));
}
exports.bumpMajor = bumpMajor;
exports.default = this.dist;