-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
50 lines (44 loc) · 1.4 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
var gulp = require('gulp'),
gulpConfig = require('./config/gulp.config'),
karma = require('karma').server,
karmaConf = require('./config/karma.config'),
concat = require('gulp-concat'),
ngAnnotate = require('gulp-ng-annotate'),
wrap = require('gulp-wrap'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename')
bump = require('gulp-bump');
gulp.task('default', ['build']);
gulp.task('build', function() {
return gulp.src(gulpConfig.srcFiles)
.pipe(concat('ng-cordova-ionic.js'))
.pipe(ngAnnotate())
.pipe(wrap("(function(){\n'use strict';\n\n<%= contents %>\n})();"))
.pipe(gulp.dest(gulpConfig.dist))
.pipe(gulp.dest(gulpConfig.demo))
.pipe(uglify())
.pipe(rename({
extname: '.min.js'
}))
.pipe(gulp.dest(gulpConfig.dist));
});
gulp.task('karma', function(done) {
karmaConf.singleRun = true;
karma.start(karmaConf, done);
});
gulp.task('karma-watch', function(done) {
karmaConf.singleRun = false;
karma.start(karmaConf, done);
});
gulp.task('watch', ['build'], function() {
gulp.watch([gulpConfig.srcFiles, gulpConfig.testFiles], ['build']);
});
gulp.task('bump', function () {
var type = gulp.env.major && 'major' ||
gulp.env.minor && 'minor' ||
gulp.env.patch && 'patch' ||
gulp.env.prerelease && 'prerelease';
gulp.src(['./bower.json', './package.json'])
.pipe(bump({type: type || 'patch'}))
.pipe(gulp.dest('./'));
});