Skip to content

Commit

Permalink
feat(server): added jshint error checking before livereload occurs
Browse files Browse the repository at this point in the history
helps prevent livereload crashes when common errors are introduced.

closes #42
  • Loading branch information
DaftMonk committed Dec 31, 2013
1 parent 45b3018 commit 7e001d3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ Generator.prototype._injectDependencies = function _injectDependencies() {

Generator.prototype.serverFiles = function () {
this.template('../../templates/express/server.js', 'server.js');
this.copy('../../templates/express/jshintrc', 'lib/.jshintrc');
this.template('../../templates/express/api.js', 'lib/controllers/api.js');
this.template('../../templates/express/index.js', 'lib/controllers/index.js');
this.template('../../templates/express/config/express.js', 'lib/config/express.js');
Expand Down
8 changes: 7 additions & 1 deletion templates/common/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ module.exports = function (grunt) {
'server.js',
'lib/{,*//*}*.{js,json}'
],
tasks: ['express:dev'],
tasks: ['newer:jshint:server', 'express:dev'],
options: {
livereload: true,
nospawn: true //Without this option specified express won't be reloaded
Expand All @@ -109,6 +109,12 @@ module.exports = function (grunt) {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
server: {
options: {
jshintrc: 'lib/.jshintrc'
},
src: [ 'lib/{,*/}*.js']
},
all: [<% if (!coffee) { %>
'<%%= yeoman.app %>/scripts/{,*/}*.js'<% } %>
]<% if (!coffee) { %>,
Expand Down
18 changes: 18 additions & 0 deletions templates/express/jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"node": true,
"browser": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"newcap": true,
"noarg": true,
"regexp": true,
"undef": true,
"strict": true,
"smarttabs": true
}

0 comments on commit 7e001d3

Please sign in to comment.