-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
128 lines (115 loc) · 3 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
'use strict';
let gulp = require('gulp');
let mocha = require('gulp-mocha');
let gutil = require('gulp-util');
let uglify = require('gulp-uglify');
let watch = require('gulp-watch');
let concat = require('gulp-concat');
let notify = require('gulp-notify');
let jshint = require('gulp-jshint');
let shell = require('gulp-shell');
let babel = require('gulp-babel');
let eslint = require('gulp-eslint');
let testSource = [
'server/**/*.js',
'client/**/*.js',
'!client/lib/**',
'test/**',
'*.js',
'!*.png',
'!*.html',
'!node_modules/**'
];
let tests = [
'test/**/*.test.js',
'test/server/users.test.js'
];
gulp.task('default', function(){
gulp.watch(testSource, ['mocha', 'jshint']);
});
gulp.task('mocha', function(){
return gulp.src(tests, { read: false })
.pipe(mocha({ reporter: 'nyan' }))
.on('error', gutil.log);
});
gulp.task('jshint', function() {
return gulp.src(testSource)
.pipe(jshint({
//enforcing
"undef": true,
"unused": false,
"node": true,
"esversion": 6,
"globals": {
"require" : false,
"describe" : false,
"it" : false,
"before" : false,
"beforeEach" : false,
"after" : false,
"afterEach" : false,
"nodemon" : false,
"angular" : false
},
}))
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'));
});
gulp.task('lint', function() {
return gulp.src(testSource)
.pipe(eslint({
"env": {
"browser": true,
"node": true,
"es6": true
},
"rules": {
//"no-console": 1,
"no-debugger": 1,
"no-dupe-args": 1,
"no-irregular-whitespace": 1,
"no-extra-semi": 1,
"dot-location": [1, "property"],
"max-len": [1, 80]
}
}))
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
// uncomment and fix when we have client-side up
// uglify task
gulp.task('js', function() {
// main app js file
gulp.src('./change-me/js/app.js')
.pipe(uglify())
.pipe(concat("app.min.js"))
.pipe(gulp.dest('./assets/js/'));
// create 1 vendor.js file from all vendor plugin code
gulp.src('./assets/js/vendor/**/*.js')
.pipe(uglify())
.pipe(concat("vendor.js"))
.pipe(gulp.dest('./assets/js'))
.pipe( notify({ message: "Javascript is now ugly!"}));
});
gulp.task('concat-dep', function() {
return gulp.src(['bower_components/angular-animate/angular-animate.js',
'bower_components/angular-cookies/angular-cookies.js',
'bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js'
]).pipe(concat('scripts.js'))
.pipe(gulp.dest('./client/scripts'));
});
gulp.task('build-js', function() {
return gulp.src(['']) // TODO fill me out
.pipe(concat('')) // TODO fill me out
.pipe(gulp.dest('./client/scripts'));
});
// get the server running
gulp.task('dev', function () {
nodemon({
script: 'server/server.js',
ext: 'js html',
env: { 'NODE_ENV': 'development' }
});
});
// TODO add concats
//gulp.task('default', ['dev', 'build-js'])