-
Notifications
You must be signed in to change notification settings - Fork 15
/
Gulpfile.js
100 lines (88 loc) · 2.71 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
clean = require('gulp-clean'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
karma = require('gulp-karma'),
bump = require('gulp-bump'),
shell = require('gulp-shell'),
ngmin = require('gulp-ngmin'),
coveralls = require('gulp-coveralls');
var componentName = 'hoodie.angularjs';
var paths = {
dist: './',
src: 'src/**/*.js',
test: 'test/**/*.js',
testfiles: [
'bower_components/jquery/dist/jquery.js',
'bower_components/hoodie/dist/hoodie.js',
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'src/**/*.js',
'test/**/*.js'
]
};
gulp.task('clean', function () {
return gulp.src(paths.dist + componentName + '*.js', {read: false})
.pipe(clean());
});
gulp.task('jshint', function () {
return gulp.src(['Gulpfile.js', paths.src, paths.test])
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('scripts', [], function () {
return gulp.src(paths.src)
.pipe(ngmin())
.pipe(concat(componentName + '.js'))
.pipe(gulp.dest(paths.dist))
.pipe(uglify())
.pipe(concat(componentName + '.min.js'))
.pipe(gulp.dest(paths.dist));
});
gulp.task('karma:dev', function () {
return gulp.src(paths.testfiles)
.pipe(karma({
configFile: 'karma.conf.js',
singleRun: true,
browsers: ['PhantomJS']
}));
});
// This is only for coveralls.io and get called by travis
// Thanks @boennemann for the support!
gulp.task('coveralls', function() {
return gulp.src('test/coverage/**/lcov.info')
.pipe(coveralls());
});
gulp.task('bump-major', function () {
return gulp.src(['./bower.json', './package.json'])
.pipe(bump({type: 'major'}))
.pipe(gulp.dest('./'));
});
gulp.task('bump', function () {
return gulp.src(['./bower.json', './package.json'])
.pipe(bump())
.pipe(gulp.dest('./'));
});
gulp.task('bump-minor', function () {
return gulp.src(['./bower.json', './package.json'])
.pipe(bump({type: 'minor'}))
.pipe(gulp.dest('./'));
});
gulp.task('tag', ['build', 'bump'], function () {
return gulp.src('./bower.json')
.pipe(shell([
//'node write-changelog.js',
'git commit -am \'chore(release): v' + require('./bower.json').version + '\'',
'git tag -a v' + require('./bower.json').version + ' -m \'v' + require('./bower.json').version + '\'',
'git push origin master --tags'
]));
});
gulp.task('watch', function () {
return gulp.watch(['Gulpfile.js', paths.src, paths.test], ['jshint', 'test']);
});
// Tasks
gulp.task('default', ['dev']);
gulp.task('dev', ['test', 'watch']);
gulp.task('build', ['jshint', 'test', 'scripts']);
gulp.task('test', ['karma:dev']);