meltmedia / generator-express-static

A yeoman generator for the express-static site builder.
MIT License
2 stars 0 forks source link

Create Grunt Run command #9

Open kyleaclark opened 10 years ago

kyleaclark commented 10 years ago

A 'grunt run' command is useful so the developer may stay within the context of using grunt for all project commands. e.g.

/* Gruntfile.js */

exec: { run: { cmd: 'node app.js' } }

grunt.registerTask('run', [ 'exec:run' ]);

kyleaclark commented 10 years ago

I'll make a pull request for the suggested update above.

jacobheun commented 10 years ago

It may be more beneficial to just rename the nodemon watch grunt task to run rather than watch. Nodemon will start the server and monitor it, which will help to keep the grunt task list simplistic.

The code:

  /**
   * Run nodemon dev to execute app.js development mode and auto-reload node app on file changes
   */
  grunt.registerTask('watch', [
    'nodemon:dev'
  ]);

to:

  /**
   * Run nodemon dev to execute app.js development mode and auto-reload node app on file changes
   */
  grunt.registerTask('run', [
    'nodemon:dev'
  ]);
kyleaclark commented 10 years ago

I agree nodemon:dev makes node app.js mostly irrelevant. However, I included both grunt run (node app.js) and grunt watch (nodemon:dev) in the case a user wants to execute the program without watching all the files. I am not certain why there would be a case for that, so we could remove grunt watch and apply 'nodemon:dev' to grunt run -- as long as we believe node app.js is unnecessary with nodemon:dev an option. Your call.

rtorr commented 10 years ago

@kyleaclark I wonder, if just for now, we just rename the task. The related pull request looks like it is out of date, so it shows nodemon not included (which we should keep). Also, while we are on the topic of renaming the development task, maybe we should adopt the more widely used "grunt serve". It seems to be the popular option for Yeoman generators. No strong opinion either way, just something to think about.

kyleaclark commented 10 years ago

Yeah, looks like the other pull request with nodemon was already implemented independently. We can scrap this issue.

I'm all for appealing to common terminology regarding "grunt serve". I just like the idea of using grunt to execute all program commands to establish a single command language.

rtorr commented 10 years ago

@kyleaclark Agreed. We (meltmedia) have created our own terminology, while the community adopted others. I think we should look at these ideas in the next release. The more adoption, the better (both internally and externally). I am going to close https://github.com/meltmedia/generator-express-static/pull/12 for now.