diff --git a/CHANGELOG.md b/CHANGELOG.md index 29acd96da..946053205 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ Runtime - Skip loading node html if disableEditor set #2684 - Update util.writeFile to write to tmp file before rename #2683 - Fix getModuleFiles function to include path property #2705 (@t-kawamorita) + - Update nodemon to latest so grunt dev task behaves Nodes diff --git a/Gruntfile.js b/Gruntfile.js index 278ce4b96..1eaf3f6a9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -20,7 +20,7 @@ var sass = require("node-sass"); module.exports = function(grunt) { - var nodemonArgs = ["-v"]; + var nodemonArgs = ["-V"]; var flowFile = grunt.option('flowFile'); if (flowFile) { nodemonArgs.push(flowFile); @@ -507,7 +507,6 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-concurrent'); grunt.loadNpmTasks('grunt-sass'); - grunt.loadNpmTasks('grunt-nodemon'); grunt.loadNpmTasks('grunt-contrib-compress'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-chmod'); @@ -521,6 +520,25 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-npm-command'); grunt.loadNpmTasks('grunt-mkdir'); + grunt.registerMultiTask('nodemon', 'Runs a nodemon monitor of your node.js server.', function () { + const nodemon = require('nodemon'); + this.async(); + const options = this.options(); + options.script = this.data.script; + let callback; + if (options.callback) { + callback = options.callback; + delete options.callback; + } else { + callback = function(nodemonApp) { + nodemonApp.on('log', function (event) { + console.log(event.colour); + }); + }; + } + callback(nodemon(options)); + }); + grunt.registerMultiTask('attachCopyright', function() { var files = this.data.src; var copyright = "/**\n"+ diff --git a/package.json b/package.json index 47fdbc2be..c9662ada4 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,6 @@ "grunt-jsonlint": "2.1.3", "grunt-mkdir": "~1.0.0", "grunt-mocha-istanbul": "5.0.2", - "grunt-nodemon": "~0.4.2", "grunt-npm-command": "~0.1.2", "grunt-sass": "~3.1.0", "grunt-simple-mocha": "~0.4.1", @@ -112,6 +111,7 @@ "mosca": "^2.8.3", "node-red-node-test-helper": "^0.2.5", "node-sass": "^4.14.1", + "nodemon": "2.0.4", "should": "13.2.3", "sinon": "1.17.7", "stoppable": "^1.1.0",