-
Notifications
You must be signed in to change notification settings - Fork 29
/
gulpfile.js
42 lines (36 loc) · 1.1 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
var gulp = require('gulp');
var KarmaServer = require('karma').Server;
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var conventionalChangelog = require('gulp-conventional-changelog');
gulp.task('default', ['watch']);
// Copy non-uglify version to "dist"
gulp.task('copy', ['test'], function () {
return gulp.src('src/*.js')
.pipe(gulp.dest('dist'));
});
// Create an uglify version to "dist" and "example"
gulp.task('uglify', ['test'], function () {
return gulp.src('src/*.js')
.pipe(uglify())
.pipe(rename('google-picker.min.js'))
.pipe(gulp.dest('dist'))
.pipe(gulp.dest('example'));
});
gulp.task('test', function (done) {
return new KarmaServer({
configFile: __dirname + '/test/karma.conf.js',
singleRun: true
}, done).start();
});
gulp.task('watch', function () {
gulp.watch('src/*.js', ['copy', 'uglify', 'test']);
gulp.watch('test/**/*.spec.js', ['test']);
});
gulp.task('changelog', function () {
return gulp.src('CHANGELOG.md', {buffer: false})
.pipe(conventionalChangelog({
preset: 'angular'
}))
.pipe(gulp.dest('.'));
});