Update required Node.js version / Add version check

This commit is contained in:
Philipp Muens 2019-05-03 13:32:06 +02:00
parent deed0e2255
commit 4edf46eaef
4 changed files with 20 additions and 7 deletions

View File

@ -8,12 +8,6 @@ matrix:
- secure: p9ka7mRzo/ecjnDh/dz19g0iVfQdvsGRAtg/4ONeiq75I2+oqHzu+VxUBA1Z2IQbpCEAMo21CarR3fg2I6MFUeazL0nEpqr1PoOAI8nPFeQlg/h+jLXsrPAkDcu2/b8ij7J5MXeLdZXUVqiPcGkr68x/tCMk/rwxftljQhvXPQfc7Lxm/m61ELnC7rLJulhxWZLNIq1hwQ9nh0GMKb4hm0KmPn8ksccVL+wyDikkgXCuvIujhTBjhNivAe4mG8mqnNsW1Ugh++SUe1ld27TtbH7wQj02SSG4Bxfwc3Gz0GFdAL1GyOkWI2WvrqP4a0KYTRUo+pUr9E+HZ1SNlxU5t6QWtmDiy5MKkxzgeTXmkKiJ98vMlF0ja5bpp46NjYarzDafqE8FozHzLtr+uAtqr6gRAgU1rWaG9BE3gKeW/f4B/2MfPI26b7SxuU1MwGVy0I76hb0Ujbgb3X8G4TYTGb6Nhoewc+RZExPwVhfrN8cJjo45masndv5tQAZMSRX/JUFjs4h/QMXNsn0A53GXgf6eIzUu15m+W8TJYFiKQeq9nMejzEE4sWMO3BFnkxueBGVCEurOc1GgdEnKxeqlp+psxHcJRlNCxC1HkUVOzfpkCr/Jy42vM8jQomAMv41Z9zWjOagVphWT25xNeSILfRt4yPku5wfW4CAxp+fl4KQ=
include:
# Linux tests
- os: linux
node_js: "4.4"
env: SLS_IGNORE_WARNING=*
- os: linux
node_js: "5.11"
env: SLS_IGNORE_WARNING=*
- os: linux
node_js: "6.2"
env: SLS_IGNORE_WARNING=*

View File

@ -49,6 +49,10 @@ Any non-backward compatible changes leads to a major version bump. This includes
If we remove a helper function from the serverless object passed down to a plugin then this is a breaking change since some people might rely on it in custom made plugins.
### Node.js versions
The Serverless Framework supports the major cloud providers Node.js runtime versions. Support for old Node.js versions will be removed once Cloud providers announce that such runtimes are not supported anymore.
### FAQ
1. Is it okay to mark a feature as deprecated in version 1.4.0 and then remove it in 1.8.0

View File

@ -7,6 +7,20 @@ const BbPromise = require('bluebird');
const logError = require('../lib/classes/Error').logError;
const uuid = require('uuid');
const initializeErrorReporter = require('../lib/utils/sentry').initializeErrorReporter;
const semver = require('semver');
const packageJson = require('../package.json');
function checkNodeVersion(serverless) {
const requiredVersion = packageJson.engines.node;
const nodeVersion = process.version;
if (!semver.satisfies(nodeVersion, requiredVersion)) {
const msg = [
`Serverless Framework requires Node.js version ${requiredVersion}. `,
`You're running version ${nodeVersion}.`,
].join('');
serverless.cli.log(msg);
}
}
Error.stackTraceLimit = Infinity;
@ -40,6 +54,7 @@ const invocationId = uuid.v4();
serverless.invocationId = invocationId;
return serverless.init()
.then(() => checkNodeVersion(serverless))
.then(() => serverless.run())
.then(() => process.exit(0))
.catch((err) => {

View File

@ -2,7 +2,7 @@
"name": "serverless",
"version": "1.43.0",
"engines": {
"node": ">=4.0"
"node": ">=6.0"
},
"preferGlobal": true,
"homepage": "https://github.com/serverless/serverless#readme",