forked from ionic-team/ng-cordova
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
70 lines (60 loc) · 2.08 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
var gulp = require('gulp'),
buildConfig = require('./config/build.config'),
concat = require('gulp-concat'),
argv = require('minimist')(process.argv.slice(2)),
footer = require('gulp-footer'),
header = require('gulp-header'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
karma = require('karma').server,
karmaConf = require('./config/karma.conf.js'),
rename = require('gulp-rename'),
shell = require('gulp-shell'),
prettify = require('gulp-prettify');
gulp.task('default', ['build']);
gulp.task('build', function () {
gulp.src(buildConfig.mockFiles)
.pipe(concat('ng-cordova-mocks.js'))
.pipe(header(buildConfig.closureStart))
.pipe(footer(buildConfig.closureEnd))
.pipe(header(buildConfig.banner))
.pipe(gulp.dest(buildConfig.dist))
.pipe(uglify())
.pipe(rename({
extname: '.min.js'
}))
.pipe(gulp.dest(buildConfig.dist));
return gulp.src(buildConfig.pluginFiles)
.pipe(concat('ng-cordova.js'))
.pipe(header(buildConfig.closureStart))
.pipe(footer(buildConfig.closureEnd))
.pipe(header(buildConfig.banner))
.pipe(gulp.dest(buildConfig.dist))
.pipe(gulp.dest(buildConfig.demo.ngCordova))
.pipe(uglify())
.pipe(rename({extname: '.min.js'}))
.pipe(gulp.dest(buildConfig.dist))
.pipe(gulp.dest(buildConfig.demo.ngCordova));
});
gulp.task('karma', function (done) {
karmaConf.singleRun = true;
argv.browsers && (karmaConf.browsers = argv.browsers.trim().split(','));
argv.reporters && (karmaConf.reporters = argv.reporters.trim().split(','));
karma.start(karmaConf, done);
});
gulp.task('lint', function () {
return gulp.src('./src/plugins/*.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});
gulp.task('karma-watch', function (done) {
console.log(karmaConf);
karmaConf.singleRun = false;
karma.start(karmaConf, done);
});
gulp.task('watch', ['build'], function () {
gulp.watch(['src/**/*.js', 'test/**/*.js'], ['build']);
});
gulp.task('run-demo', ['watch'], shell.task([
'cd demo && ionic run ios -l -c --target="iPhone (Retina 4-inch)"'
]));