Skip to content

Commit a4d1abf

Browse files
Added gulp buildscript
1 parent 619bec6 commit a4d1abf

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

gulpfile.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
var gulp = require('gulp');
2+
var uglify = require('gulp-uglify');
3+
var pump = require('pump');
4+
var rename = require('gulp-rename');
5+
var del = require('del');
6+
var bump = require('gulp-bump');
7+
8+
gulp.task('clean', function () {
9+
return del([
10+
'dist/',
11+
]);
12+
});
13+
14+
gulp.task('compress', function (cb) {
15+
pump([
16+
gulp.src('src/*.js'),
17+
uglify(),
18+
rename('chartjs-plugin-trendline.min.js'),
19+
gulp.dest('dist/')
20+
],
21+
cb
22+
);
23+
});
24+
25+
gulp.task('bump-minor', function(){
26+
return gulp.src(['./package.json', './src/chartjs-plugin-trendline.js'], {base: './'})
27+
.pipe(bump({type:'minor'}))
28+
.pipe(gulp.dest('./'));
29+
});
30+
31+
gulp.task('bump-patch', function(){
32+
return gulp.src(['./package.json', './src/chartjs-plugin-trendline.js'], {base: './'})
33+
.pipe(bump({type:'patch'}))
34+
.pipe(gulp.dest('./'));
35+
});
36+
37+
gulp.task('default', gulp.series('clean', 'compress'));

package.json

+10-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Trendline for Chart.js",
55
"main": "src/chartjs-plugin-trendline.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"build": "gulp"
88
},
99
"repository": {
1010
"type": "git",
@@ -15,5 +15,13 @@
1515
"bugs": {
1616
"url": "https://github.com/Makanz/chartjs-plugin-trendline/issues"
1717
},
18-
"homepage": "https://github.com/Makanz/chartjs-plugin-trendline#readme"
18+
"homepage": "https://github.com/Makanz/chartjs-plugin-trendline#readme",
19+
"devDependencies": {
20+
"del": "^3.0.0",
21+
"gulp": "^4.0.0",
22+
"gulp-bump": "^3.1.3",
23+
"gulp-rename": "^1.4.0",
24+
"gulp-uglify": "^3.0.1",
25+
"pump": "^3.0.0"
26+
}
1927
}

0 commit comments

Comments
 (0)