forked from jstroem/ng-input-currency
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
79 lines (69 loc) · 1.85 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
71
72
73
74
75
76
77
78
79
var gulp = require('gulp');
var browserify = require('browserify');
var karma = require('karma').server;
var coveralls = require('gulp-coveralls');
var run = require('run-sequence');
var watch = require('gulp-watch');
var shell = require('gulp-shell');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var gutil = require('gulp-util');
var rename = require('gulp-rename');
var conf = {
'js': 'src/**/*.js',
'src': 'src/',
'dest': 'dist/',
'file': 'ng-input-currency.js'
};
gulp.task('coveralls', function () {
gulp.src('coverage/**/lcov.info').pipe(coveralls());
});
gulp.task('test', function (done) {
karma.start({
configFile: __dirname + '/karma.conf.js'
}, function (exitCode) {
if (exitCode === 0)
done();
else
process.exit(exitCode);
});
});
gulp.task('publish', shell.task([
'npm version patch',
'npm publish'
]));
gulp.task('build:src', function() {
var b = browserify({
entries: conf.src + conf.file,
debug: true
});
return b.bundle()
.pipe(source(conf.file))
.pipe(buffer())
.pipe(gulp.dest(conf.dest))
.pipe(sourcemaps.init({loadMaps: true}))
// Add transformation tasks to the pipeline here.
.pipe(uglify())
.on('error', gutil.log)
.pipe(rename({ extname: '.min.js' }))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(conf.dest));
});
gulp.task('build', function(){
return run('build:src', 'test', 'coveralls');
});
gulp.task('watch:test', function(done){
karma.start({
autoWatch: true,
configFile: __dirname + '/karma.conf.js',
singleRun: false
}, done);
});
gulp.task('watch:build', function() {
watch(conf.js, function(){
gulp.start('build:src');
});
});
gulp.task('watch', ['watch:build','watch:test']);