mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add scripts/verify-package-dependencies.js
This commit is contained in:
parent
e57d8ba0ef
commit
974ba40f28
2
.gitignore
vendored
2
.gitignore
vendored
@ -18,4 +18,4 @@ public
|
||||
locales/zz-ZZ
|
||||
nodes/core/locales/zz-ZZ
|
||||
!packages/node_modules
|
||||
packages/node_modules/@node-red/editor/public
|
||||
packages/node_modules/@node-red/editor-client/public
|
||||
|
@ -8,5 +8,3 @@ matrix:
|
||||
before_script:
|
||||
- npm install -g istanbul coveralls
|
||||
- node_js: "8"
|
||||
- node_js: "6"
|
||||
- node_js: "4"
|
||||
|
17
Gruntfile.js
17
Gruntfile.js
@ -303,12 +303,12 @@ module.exports = function(grunt) {
|
||||
nodemon: {
|
||||
/* uses .nodemonignore */
|
||||
dev: {
|
||||
script: 'red.js',
|
||||
script: 'packages/node_modules/node-red/red.js',
|
||||
options: {
|
||||
args: nodemonArgs,
|
||||
ext: 'js,html,json',
|
||||
watch: [
|
||||
'red','nodes'
|
||||
'packages/node_modules'
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -491,6 +491,15 @@ module.exports = function(grunt) {
|
||||
}
|
||||
});
|
||||
|
||||
grunt.registerTask('verifyPackageDependencies', function() {
|
||||
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");
|
||||
}
|
||||
});
|
||||
|
||||
grunt.registerTask('setDevEnv',
|
||||
'Sets NODE_ENV=development so non-minified assets are used',
|
||||
function () {
|
||||
@ -499,7 +508,7 @@ module.exports = function(grunt) {
|
||||
|
||||
grunt.registerTask('default',
|
||||
'Builds editor content then runs code style checks and unit tests on all components',
|
||||
['build','jshint:editor','mocha_istanbul:all']);
|
||||
['build','verifyPackageDependencies','jshint:editor','mocha_istanbul:all']);
|
||||
|
||||
grunt.registerTask('test-core',
|
||||
'Runs code style check and unit tests on core runtime code',
|
||||
@ -527,7 +536,7 @@ module.exports = function(grunt) {
|
||||
|
||||
grunt.registerTask('release',
|
||||
'Create distribution zip file',
|
||||
['build','clean:release','copy:release','chmod:release','compress:release']);
|
||||
['build','verifyPackageDependencies','clean:release','copy:release','chmod:release','compress:release']);
|
||||
|
||||
grunt.registerTask('coverage',
|
||||
'Run Istanbul code test coverage task',
|
||||
|
@ -10,7 +10,7 @@
|
||||
},
|
||||
"source": {
|
||||
"include": [
|
||||
"./red/runtime-api"
|
||||
"./packages/node_modules/@node-red/runtime/lib/api"
|
||||
]
|
||||
},
|
||||
"templates": {
|
||||
|
1
lib/.gitignore
vendored
1
lib/.gitignore
vendored
@ -1 +0,0 @@
|
||||
*
|
1586
package-lock.json
generated
1586
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
0
bin/node-red-pi → packages/node_modules/node-red/bin/node-red-pi
generated
vendored
0
bin/node-red-pi → packages/node_modules/node-red/bin/node-red-pi
generated
vendored
54
packages/node_modules/node-red/package.json
generated
vendored
Normal file
54
packages/node_modules/node-red/package.json
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "node-red",
|
||||
"version": "0.20.0",
|
||||
"description": "A visual tool for wiring the Internet of Things",
|
||||
"homepage": "http://nodered.org",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/node-red/node-red.git"
|
||||
},
|
||||
"main": "red/red.js",
|
||||
"scripts": {
|
||||
"start": "node red.js"
|
||||
},
|
||||
"bin": {
|
||||
"node-red": "./red.js",
|
||||
"node-red-pi": "bin/node-red-pi"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Nick O'Leary"
|
||||
},
|
||||
{
|
||||
"name": "Dave Conway-Jones"
|
||||
}
|
||||
],
|
||||
"keywords": [
|
||||
"editor",
|
||||
"messaging",
|
||||
"iot",
|
||||
"flow"
|
||||
],
|
||||
"dependencies": {
|
||||
"@node-red/editor-api": "0.20.0",
|
||||
"@node-red/runtime": "0.20.0",
|
||||
"@node-red/util": "0.20.0",
|
||||
"basic-auth": "2.0.0",
|
||||
"bcryptjs": "2.4.3",
|
||||
"express": "4.16.3",
|
||||
"fs-extra": "5.0.0",
|
||||
"node-red-node-email": "0.1.*",
|
||||
"node-red-node-feedparser": "^0.1.12",
|
||||
"node-red-node-rbe": "0.2.*",
|
||||
"node-red-node-twitter": "^1.1.0",
|
||||
"nopt": "4.0.1",
|
||||
"semver": "5.5.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"bcrypt": "~2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
}
|
2
red.js → packages/node_modules/node-red/red.js
generated
vendored
2
red.js → packages/node_modules/node-red/red.js
generated
vendored
@ -24,7 +24,7 @@ catch(e) { bcrypt = require('bcryptjs'); }
|
||||
var nopt = require("nopt");
|
||||
var path = require("path");
|
||||
var fs = require("fs-extra");
|
||||
var RED = require("./packages/node_modules/node-red/red/red.js");
|
||||
var RED = require("./red/red.js");
|
||||
|
||||
var server;
|
||||
var app = express();
|
46
scripts/verify-package-dependencies.js
Normal file
46
scripts/verify-package-dependencies.js
Normal file
@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const should = require("should");
|
||||
|
||||
const rootPackage = require(path.join("..","package.json"));
|
||||
const rootDependencies = rootPackage.dependencies;
|
||||
const packages = [
|
||||
"node-red",
|
||||
"@node-red/editor-api",
|
||||
"@node-red/editor-client",
|
||||
"@node-red/nodes",
|
||||
"@node-red/registry",
|
||||
"@node-red/runtime",
|
||||
"@node-red/util"
|
||||
];
|
||||
|
||||
function verifyDependencies() {
|
||||
let failures = [];
|
||||
packages.forEach(package => {
|
||||
let modulePackage = require(path.join("../packages/node_modules",package,"package.json"));
|
||||
let dependencies = Object.keys(modulePackage.dependencies||{});
|
||||
dependencies.forEach(module => {
|
||||
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]}') `);
|
||||
}
|
||||
} catch(err) {
|
||||
failures.push(err.toString());
|
||||
}
|
||||
});
|
||||
})
|
||||
return failures;
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
let failures = verifyDependencies();
|
||||
if (failures.length > 0) {
|
||||
failures.forEach(f => console.log(` - ${f}`));
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
module.exports = verifyDependencies;
|
||||
}
|
Loading…
Reference in New Issue
Block a user