forked from clarketm/TableExport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
89 lines (75 loc) · 2.64 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
var gulp = require('gulp'),
replace = require('gulp-replace'),
bump = require("gulp-bump"),
rename = require("gulp-rename"),
del = require('del'),
css = require('gulp-clean-css'),
js = require('gulp-uglify');
gulp.task('css', ['clean'], function () {
return gulp.src('./src/stable/css/tableexport.css')
.pipe(gulp.dest('./dist/css/'))
.pipe(css())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('./dist/css/'))
.pipe(gulp.dest('./src/stable/css/'));
});
gulp.task('js', ['clean'], function () {
return gulp.src('./src/stable/js/tableexport.js')
.pipe(gulp.dest('./dist/js/'))
.pipe(js({output: {comments: /^!|@preserve|@license|@cc_on/i}}))
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('./dist/js/'))
.pipe(gulp.dest('./src/stable/js/'));
});
gulp.task('bump-all', ['bump', 'bump-js', 'bump-css', 'bump-typings', 'bump-readme']);
gulp.task('bump', function(){
return gulp.src(['./bower.json', './package.json'])
.pipe(bump())
.pipe(gulp.dest('./'));
});
gulp.task('bump-js', function () {
return gulp.src(['src/stable/js/tableexport.js'])
.pipe(replace(/(v\d+\.\d+\.)(\d+)/g, function (matches, match1, match2) {
return match1 + (Number(match2)+1);
}))
.pipe(replace(/(version: ["']\d+\.\d+\.)(\d+)/g, function (matches, match1, match2) {
return match1 + (Number(match2)+1);
}))
.pipe(gulp.dest('src/stable/js/'))
.on('end', function () {
gulp.start('js');
});
});
gulp.task('bump-css', function () {
gulp.src(['src/stable/css/tableexport.css'])
.pipe(replace(/(v\d+\.\d+\.)(\d+)/g, function (matches, match1, match2) {
return match1 + (Number(match2) + 1);
}))
.pipe(gulp.dest('src/stable/css/'))
.on('end', function () {
gulp.start('css');
});
});
gulp.task('bump-typings', function () {
gulp.src(['dist/tableexport.d.ts'])
.pipe(replace(/(v\d+\.\d+\.)(\d+)/g, function (matches, match1, match2) {
return match1 + (Number(match2) + 1);
}))
.pipe(gulp.dest('dist/'))
});
gulp.task('bump-readme', function () {
gulp.src(['gitbook/README.md', 'gitbook/READMEv3.md'])
.pipe(replace(/([/\[`]v?[124567890]\d*\.\d+\.)(\d+)/g, function (matches, match1, match2) {
return match1 + (Number(match2) + 1);
}))
.pipe(gulp.dest('gitbook/'))
});
gulp.task('clean', function () {
return del(['dist/js']);
});
gulp.task('build', ['css', 'js']);
gulp.task('default', ['build']);