runtime: deprecate Node <= 7. From Etherpad 1.8.0 minimum Node version will be 8

This commit is contained in:
muxator 2018-07-27 01:51:28 +02:00 committed by muxator
parent 7544585908
commit a69f8a3db9
2 changed files with 22 additions and 0 deletions

View file

@ -45,6 +45,11 @@ async.waterfall([
NodeVersion.enforceMinNodeVersion('6.9.0', callback);
},
function(callback)
{
NodeVersion.checkDeprecationStatus('8.9.0', '1.8.0', callback);
},
// load npm
function(callback) {
npm.load({}, function(er) {

View file

@ -35,3 +35,20 @@ exports.enforceMinNodeVersion = function(minNodeVersion, callback) {
callback();
}
};
/**
* Prints a warning if running on a supported but deprecated Node version
*
* @param {String} lowestNonDeprecatedNodeVersion all Node version less than this one are deprecated
* @param {Function} epRemovalVersion Etherpad version that will remove support for deprecated Node releases
*/
exports.checkDeprecationStatus = function(lowestNonDeprecatedNodeVersion, epRemovalVersion, callback) {
const semver = require('semver');
const currentNodeVersion = process.version;
if (semver.lt(currentNodeVersion, lowestNonDeprecatedNodeVersion)) {
console.warn(`Support for Node ${currentNodeVersion} will be removed in Etherpad ${epRemovalVersion}. Please consider updating at least to Node ${lowestNonDeprecatedNodeVersion}`);
}
callback();
};