diff --git a/Gruntfile.js b/Gruntfile.js index eae2587ef..fdf855466 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -526,12 +526,15 @@ module.exports = function(grunt) { }); grunt.registerTask('verifyPackageDependencies', function() { + var done = this.async(); var verifyDependencies = require("./scripts/verify-package-dependencies.js"); - var failures = verifyDependencies(); - if (failures.length > 0) { - failures.forEach(f => grunt.log.error(f)); - grunt.fail.fatal("Failed to verify package dependencies"); - } + verifyDependencies().then(function(failures) { + if (failures.length > 0) { + failures.forEach(f => grunt.log.error(f)); + grunt.fail.fatal("Failed to verify package dependencies"); + } + done(); + }); }); grunt.registerTask('setDevEnv', diff --git a/package.json b/package.json index ec464927a..5ce01d15c 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ } ], "dependencies": { - "ajv": "6.5.4", + "ajv": "6.6.1", "basic-auth": "2.0.1", "bcryptjs": "2.4.3", "body-parser": "1.18.3", @@ -32,28 +32,28 @@ "clone": "2.1.2", "cookie": "0.3.1", "cookie-parser": "1.4.3", - "cors": "2.8.4", - "cron": "1.5.0", - "denque": "1.3.0", + "cors": "2.8.5", + "cron": "1.5.1", + "denque": "1.4.0", "express": "4.16.4", "express-session": "1.15.6", - "fs-extra": "5.0.0", + "fs-extra": "7.0.1", "fs.notify": "0.0.4", "hash-sum": "1.0.2", "https-proxy-agent": "2.2.1", - "i18next": "11.6.0", + "i18next": "12.1.0", "is-utf8": "0.2.1", "js-yaml": "3.12.0", "json-stringify-safe": "5.0.1", "jsonata": "1.5.4", - "media-typer": "0.3.0", + "media-typer": "1.0.1", "memorystore": "1.6.0", - "mime": "1.4.1", + "mime": "2.4.0", "mqtt": "2.18.8", "multer": "1.4.1", - "mustache": "2.3.2", - "node-red-node-email": "0.1.*", - "node-red-node-feedparser": "^0.1.12", + "mustache": "3.0.1", + "node-red-node-email": "1.0.*", + "node-red-node-feedparser": "^0.1.14", "node-red-node-rbe": "0.2.*", "node-red-node-twitter": "^1.1.0", "nopt": "4.0.1", @@ -78,7 +78,7 @@ "chromedriver": "2.43.1", "grunt": "~1.0.3", "grunt-chmod": "~1.1.1", - "grunt-cli": "~1.3.1", + "grunt-cli": "~1.3.2", "grunt-concurrent": "~2.3.1", "grunt-contrib-clean": "~1.1.0", "grunt-contrib-compress": "~1.4.0", @@ -104,12 +104,12 @@ "mosca": "^2.8.3", "should": "^8.4.0", "sinon": "1.17.7", - "stoppable": "^1.0.7", + "stoppable": "^1.1.0", "supertest": "3.3.0", - "wdio-chromedriver-service": "^0.1.3", - "wdio-mocha-framework": "^0.6.2", + "wdio-chromedriver-service": "^0.1.5", + "wdio-mocha-framework": "^0.6.4", "wdio-spec-reporter": "^0.1.5", - "webdriverio": "^4.13.1", + "webdriverio": "^4.14.1", "node-red-node-test-helper": "node-red/node-red-node-test-helper", "jsdoc-nr-template": "node-red/jsdoc-nr-template" }, diff --git a/packages/node_modules/@node-red/editor-api/lib/editor/ui.js b/packages/node_modules/@node-red/editor-api/lib/editor/ui.js index d37439c92..ce3ec862c 100644 --- a/packages/node_modules/@node-red/editor-api/lib/editor/ui.js +++ b/packages/node_modules/@node-red/editor-api/lib/editor/ui.js @@ -57,7 +57,7 @@ module.exports = { } runtimeAPI.nodes.getIcon(opts).then(function(data) { if (data) { - var contentType = mime.lookup(icon); + var contentType = mime.getType(icon); res.set("Content-Type", contentType); res.send(data); } else { diff --git a/packages/node_modules/@node-red/editor-api/package.json b/packages/node_modules/@node-red/editor-api/package.json index 6f6f3d590..9065d5682 100644 --- a/packages/node_modules/@node-red/editor-api/package.json +++ b/packages/node_modules/@node-red/editor-api/package.json @@ -21,12 +21,12 @@ "bcryptjs": "2.4.3", "body-parser": "1.18.3", "clone": "2.1.2", - "cors": "2.8.4", + "cors": "2.8.5", "express-session": "1.15.6", "express": "4.16.4", "memorystore": "1.6.0", - "mime": "1.4.1", - "mustache": "2.3.2", + "mime": "2.4.0", + "mustache": "3.0.1", "oauth2orize": "1.11.0", "passport-http-bearer": "1.0.1", "passport-oauth2-client-password": "0.1.2", diff --git a/packages/node_modules/@node-red/nodes/package.json b/packages/node_modules/@node-red/nodes/package.json index a5f2b19f8..68c7354eb 100644 --- a/packages/node_modules/@node-red/nodes/package.json +++ b/packages/node_modules/@node-red/nodes/package.json @@ -15,24 +15,24 @@ } ], "dependencies": { - "ajv": "6.5.4", + "ajv": "6.6.1", "body-parser": "1.18.3", "cheerio": "0.22.0", "cookie-parser": "1.4.3", "cookie": "0.3.1", - "cors": "2.8.4", - "cron": "1.5.0", - "denque": "1.3.0", - "fs-extra": "5.0.0", + "cors": "2.8.5", + "cron": "1.5.1", + "denque": "1.4.0", + "fs-extra": "7.0.1", "fs.notify": "0.0.4", "hash-sum": "1.0.2", "https-proxy-agent": "2.2.1", "is-utf8": "0.2.1", "js-yaml": "3.12.0", - "media-typer": "0.3.0", + "media-typer": "1.0.1", "mqtt": "2.18.8", "multer": "1.4.1", - "mustache": "2.3.2", + "mustache": "3.0.1", "on-headers": "1.0.1", "raw-body": "2.3.3", "request": "2.88.0", diff --git a/packages/node_modules/@node-red/runtime/package.json b/packages/node_modules/@node-red/runtime/package.json index 087fcdcd2..12c510507 100644 --- a/packages/node_modules/@node-red/runtime/package.json +++ b/packages/node_modules/@node-red/runtime/package.json @@ -20,7 +20,7 @@ "@node-red/util": "0.20.0-beta.1", "clone": "2.1.2", "express": "4.16.4", - "fs-extra": "5.0.0", + "fs-extra": "7.0.1", "json-stringify-safe": "5.0.1", "when": "3.7.8" } diff --git a/packages/node_modules/@node-red/util/package.json b/packages/node_modules/@node-red/util/package.json index 3a1d85a6b..b690ea474 100644 --- a/packages/node_modules/@node-red/util/package.json +++ b/packages/node_modules/@node-red/util/package.json @@ -16,7 +16,7 @@ ], "dependencies": { "clone": "2.1.2", - "i18next": "11.6.0", + "i18next": "12.1.0", "json-stringify-safe": "5.0.1", "jsonata": "1.5.4", "when": "3.7.8" diff --git a/packages/node_modules/node-red/package.json b/packages/node_modules/node-red/package.json index 6ca8d875b..f514e1939 100644 --- a/packages/node_modules/node-red/package.json +++ b/packages/node_modules/node-red/package.json @@ -38,9 +38,9 @@ "basic-auth": "2.0.1", "bcryptjs": "2.4.3", "express": "4.16.4", - "fs-extra": "5.0.0", - "node-red-node-email": "0.1.*", - "node-red-node-feedparser": "^0.1.12", + "fs-extra": "7.0.1", + "node-red-node-email": "1.0.*", + "node-red-node-feedparser": "^0.1.14", "node-red-node-rbe": "0.2.*", "node-red-node-twitter": "^1.1.0", "nopt": "4.0.1", diff --git a/scripts/verify-package-dependencies.js b/scripts/verify-package-dependencies.js index cf77ed197..8732d3038 100644 --- a/scripts/verify-package-dependencies.js +++ b/scripts/verify-package-dependencies.js @@ -1,7 +1,7 @@ #!/usr/bin/env node const path = require("path"); -const fs = require("fs"); +const fs = require("fs-extra"); const should = require("should"); const rootPackage = require(path.join("..","package.json")); @@ -16,8 +16,11 @@ const packages = [ "@node-red/util" ]; +const fixFlag = process.argv[2] === '--fix'; + function verifyDependencies() { let failures = []; + let packageUpdates = {}; packages.forEach(package => { let modulePackage = require(path.join("../packages/node_modules",package,"package.json")); let dependencies = Object.keys(modulePackage.dependencies||{}); @@ -25,22 +28,48 @@ function verifyDependencies() { try { if (!/^@node-red\//.test(module)) { should.exist(rootDependencies[module],`[${package}] '${module}' missing from root package.json`); - rootDependencies[module].should.eql(modulePackage.dependencies[module],`[${package}] '${module}' version mismatch. Expected '${modulePackage.dependencies[module]}' (got '${rootDependencies[module]}') `); + try { + rootDependencies[module].should.eql(modulePackage.dependencies[module],`[${package}] '${module}' version mismatch. Expected '${modulePackage.dependencies[module]}' (got '${rootDependencies[module]}') `); + } catch(err) { + if (fixFlag) { + modulePackage.dependencies[module] = rootDependencies[module]; + packageUpdates[package] = modulePackage; + } else { + failures.push(err.toString()); + } + } } } catch(err) { failures.push(err.toString()); } }); }) - return failures; + if (failures.length === 0 && fixFlag) { + var promises = []; + packages.forEach(package => { + if (packageUpdates.hasOwnProperty(package)) { + promises.push(fs.writeJSON(path.join(__dirname,"../packages/node_modules",package,"package.json"),packageUpdates[package],{spaces:4})); + } + }); + return Promise.all(promises).then(r => []).catch(e => { + console.log(e); + process.exit(1); + }) + } else { + return Promise.resolve(failures); + } } if (require.main === module) { - let failures = verifyDependencies(); - if (failures.length > 0) { - failures.forEach(f => console.log(` - ${f}`)); + verifyDependencies().then(failures => { + if (failures.length > 0) { + failures.forEach(f => console.log(` - ${f}`)); + process.exit(1); + } + }).catch(e => { + console.log(e); process.exit(1); - } + }); } else { module.exports = verifyDependencies; }