forked from ErikSchierboom/knockout-paging
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
51 lines (43 loc) · 1.35 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
var gulp = require('gulp'),
plugins = require('gulp-load-plugins')(),
mochaPhantomJS = require('gulp-mocha-phantomjs');
function updateVersion(importance) {
return gulp.src(['./package.json', './bower.json'])
.pipe(plugins.bump({ type: importance }))
.pipe(gulp.dest('./'));
}
gulp.task('patch', function() { return updateVersion('patch'); });
gulp.task('feature', function() { return updateVersion('minor'); });
gulp.task('release', function() { return updateVersion('major'); });
gulp.task('webserver', function () {
return gulp.src('.')
.pipe(plugins.webserver({
port: 4054,
open: 'spec/runner.html',
livereload: {
enable: true,
port: 4055
}
}));
});
gulp.task('test', function () {
return gulp
.src('spec/runner.html')
.pipe(mochaPhantomJS());
});
gulp.task('js', function () {
var pkg = require('./package.json');
gulp.src("./index.js")
.pipe(plugins.replace('{{ version }}', pkg.version))
.pipe(plugins.rename('knockout-paging.js'))
.pipe(gulp.dest('./dist'))
.pipe(plugins.uglify())
.pipe(plugins.rename('knockout-paging.min.js'))
.pipe(gulp.dest('./dist'));
});
gulp.task('watch', ['js'], function () {
gulp.watch(['index.js', 'spec/*'], ['js']);
});
gulp.task('live', ['watch', 'webserver']);
gulp.task('ci', ['js', 'test']);
gulp.task('default', ['live']);