forked from Wildhoney/ngDroplet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
62 lines (47 loc) · 1.64 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
(function() {
var yaml = require('js-yaml'),
fs = require('fs');
/**
* @property {Object} config
* @property {String} config.components
*/
var config = yaml.safeLoad(fs.readFileSync('.gulp.yml', 'utf8'));
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
karma = require('gulp-karma'),
jshint = require('gulp-jshint');
gulp.task('build', function gulpBuild() {
gulp.src(config.components)
.pipe(rename(config.build.development))
.pipe(gulp.dest(config.build.directory))
.pipe(gulp.dest(config.build.copy))
.pipe(rename(config.build.production))
.pipe(uglify())
.pipe(gulp.dest(config.build.directory));
});
gulp.task('karma', function gulpKarma() {
var testFiles = [
'example/js/vendor/angular/angular.js',
'example/js/vendor/angular-mocks/angular-mocks.js',
'tests/Spec.js',
config.components
];
return gulp.src(testFiles).pipe(karma({
configFile: 'karma.conf.js',
action: 'run'
})).on('error', function onError(error) {
throw error;
});
});
gulp.task('hint', function gulpHint() {
return gulp.src(config.components)
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default'));
});
gulp.task('test', ['karma', 'hint']);
gulp.task('default', ['test', 'build']);
gulp.task('watch', function watch() {
gulp.watch('components/*.js', ['build']);
});
})();