forked from Netflix/vector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
50 lines (44 loc) · 1.28 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
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var wrench = require('wrench');
var eslint = require('gulp-eslint');
var git = require('gulp-git');
var fs = require('fs');
var options = {
src: 'src',
dist: 'dist',
tmp: '.tmp',
e2e: 'e2e',
errorHandler: function(title) {
return function(err) {
gutil.log(gutil.colors.red('[' + title + ']'), err.toString());
this.emit('end');
};
},
wiredep: {
directory: 'bower_components'
}
};
wrench.readdirSyncRecursive('./gulp').filter(function(file) {
return (/\.(js|coffee)$/i).test(file);
}).map(function(file) {
require('./gulp/' + file)(options);
});
gulp.task('version', function () {
git.exec({args : 'describe'}, function (err, stdout) {
if (err) throw err;
fs.writeFile('src/app/app.version.js','(function () { \'use strict\'; angular.module(\'vector.version\').constant(\'vectorVersion\', { \'id\': \'{version}\' }); })();'.replace('{version}', stdout.substring(0, stdout.length - 1)));
});
});
gulp.task('default', ['clean'], function () {
gulp.start('build');
});
gulp.task('eslint', function() {
gulp
.src(['src/app/**/*.js'])
.pipe(eslint())
// .pipe(eslint.format())
.pipe(eslint.formatEach('stylish', process.stderr))
;
});