Skip to content

Commit 7e001d3

Browse files
committed
feat(server): added jshint error checking before livereload occurs
helps prevent livereload crashes when common errors are introduced. closes #42
1 parent 45b3018 commit 7e001d3

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

Diff for: app/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ Generator.prototype._injectDependencies = function _injectDependencies() {
436436

437437
Generator.prototype.serverFiles = function () {
438438
this.template('../../templates/express/server.js', 'server.js');
439+
this.copy('../../templates/express/jshintrc', 'lib/.jshintrc');
439440
this.template('../../templates/express/api.js', 'lib/controllers/api.js');
440441
this.template('../../templates/express/index.js', 'lib/controllers/index.js');
441442
this.template('../../templates/express/config/express.js', 'lib/config/express.js');

Diff for: templates/common/Gruntfile.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ module.exports = function (grunt) {
9595
'server.js',
9696
'lib/{,*//*}*.{js,json}'
9797
],
98-
tasks: ['express:dev'],
98+
tasks: ['newer:jshint:server', 'express:dev'],
9999
options: {
100100
livereload: true,
101101
nospawn: true //Without this option specified express won't be reloaded
@@ -109,6 +109,12 @@ module.exports = function (grunt) {
109109
jshintrc: '.jshintrc',
110110
reporter: require('jshint-stylish')
111111
},
112+
server: {
113+
options: {
114+
jshintrc: 'lib/.jshintrc'
115+
},
116+
src: [ 'lib/{,*/}*.js']
117+
},
112118
all: [<% if (!coffee) { %>
113119
'<%%= yeoman.app %>/scripts/{,*/}*.js'<% } %>
114120
]<% if (!coffee) { %>,

Diff for: templates/express/jshintrc

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"node": true,
3+
"browser": true,
4+
"esnext": true,
5+
"bitwise": true,
6+
"camelcase": true,
7+
"curly": true,
8+
"eqeqeq": true,
9+
"immed": true,
10+
"indent": 2,
11+
"latedef": true,
12+
"newcap": true,
13+
"noarg": true,
14+
"regexp": true,
15+
"undef": true,
16+
"strict": true,
17+
"smarttabs": true
18+
}

0 commit comments

Comments
 (0)