|
|
@ -19,14 +19,17 @@ module.exports = function (Meta) {
|
|
|
|
|
|
|
|
|
|
|
|
winston.verbose('Checking dependencies for outdated modules');
|
|
|
|
winston.verbose('Checking dependencies for outdated modules');
|
|
|
|
|
|
|
|
|
|
|
|
async.every(modules, function (module, next) {
|
|
|
|
async.each(modules, function (module, next) {
|
|
|
|
fs.readFile(path.join(__dirname, '../../node_modules/', module, 'package.json'), {
|
|
|
|
fs.readFile(path.join(__dirname, '../../node_modules/', module, 'package.json'), {
|
|
|
|
encoding: 'utf-8'
|
|
|
|
encoding: 'utf-8'
|
|
|
|
}, function (err, pkgData) {
|
|
|
|
}, function (err, pkgData) {
|
|
|
|
// If a bundled plugin/theme is not present, skip the dep check (#3384)
|
|
|
|
if (err) {
|
|
|
|
if (err && err.code === 'ENOENT' && (module === 'nodebb-rewards-essentials' || module.startsWith('nodebb-plugin') || module.startsWith('nodebb-theme'))) {
|
|
|
|
// If a bundled plugin/theme is not present, skip the dep check (#3384)
|
|
|
|
winston.warn('[meta/dependencies] Bundled plugin ' + module + ' not found, skipping dependency check.');
|
|
|
|
if (err.code === 'ENOENT' && (module === 'nodebb-rewards-essentials' || module.startsWith('nodebb-plugin') || module.startsWith('nodebb-theme'))) {
|
|
|
|
return next(true);
|
|
|
|
winston.warn('[meta/dependencies] Bundled plugin ' + module + ' not found, skipping dependency check.');
|
|
|
|
|
|
|
|
return next();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return next(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -34,20 +37,24 @@ module.exports = function (Meta) {
|
|
|
|
} catch(e) {
|
|
|
|
} catch(e) {
|
|
|
|
process.stdout.write('[' + 'missing'.red + '] ' + module.bold + ' is a required dependency but could not be found\n');
|
|
|
|
process.stdout.write('[' + 'missing'.red + '] ' + module.bold + ' is a required dependency but could not be found\n');
|
|
|
|
depsMissing = true;
|
|
|
|
depsMissing = true;
|
|
|
|
return next(true);
|
|
|
|
return next();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var ok = !semver.validRange(pkg.dependencies[module]) || semver.satisfies(pkgData.version, pkg.dependencies[module]);
|
|
|
|
var ok = !semver.validRange(pkg.dependencies[module]) || semver.satisfies(pkgData.version, pkg.dependencies[module]);
|
|
|
|
|
|
|
|
|
|
|
|
if (ok || (pkgData._resolved && pkgData._resolved.indexOf('//github.com') !== -1)) {
|
|
|
|
if (ok || (pkgData._resolved && pkgData._resolved.indexOf('//github.com') !== -1)) {
|
|
|
|
next(true);
|
|
|
|
next();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
process.stdout.write('[' + 'outdated'.yellow + '] ' + module.bold + ' installed v' + pkgData.version + ', package.json requires ' + pkg.dependencies[module] + '\n');
|
|
|
|
process.stdout.write('[' + 'outdated'.yellow + '] ' + module.bold + ' installed v' + pkgData.version + ', package.json requires ' + pkg.dependencies[module] + '\n');
|
|
|
|
depsOutdated = true;
|
|
|
|
depsOutdated = true;
|
|
|
|
next(true);
|
|
|
|
next();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}, function (ok) {
|
|
|
|
}, function (err) {
|
|
|
|
|
|
|
|
if (err) {
|
|
|
|
|
|
|
|
return callback(err);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (depsMissing) {
|
|
|
|
if (depsMissing) {
|
|
|
|
callback(new Error('dependencies-missing'));
|
|
|
|
callback(new Error('dependencies-missing'));
|
|
|
|
} else if (depsOutdated) {
|
|
|
|
} else if (depsOutdated) {
|
|
|
|