feat: Drop support for Node.js versions below v10

BREAKING CHANGE:
Node.js versions below v10 are no longer supported
This commit is contained in:
Mariusz Nowak 2020-08-25 16:49:43 +02:00 committed by Mariusz Nowak
parent 28ef7cc337
commit 69dd4b9745
5 changed files with 34 additions and 168 deletions

View File

@ -12,7 +12,7 @@ env:
jobs:
linuxNode14:
name: '[Linux] Node.js 14: Unit tests & Publish canary'
name: '[Linux] Node.js 14: Publish canary, Unit & packaging tests '
runs-on: ubuntu-latest
steps:
- name: Resolve last validated commit hash (for `git diff` purposes)
@ -67,6 +67,8 @@ jobs:
# Some tests depend on TTY support, which is missing in GA runner
# Workaround taken from https://github.com/actions/runner/issues/241#issuecomment-577360161
run: script -e -c "npm test -- -b"
- name: Packaging tests
run: npm run integration-test-run-package
windowsNode14:
name: '[Windows] Node.js v14: Unit tests'
@ -168,72 +170,6 @@ jobs:
CODECOV_TOKEN: 3898f3e1-f317-453e-a3a9-0462390f93c5
run: npx codecov
linuxNode8:
name: '[Linux] Node.js v8: Unit & packaging tests'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Retrieve dependencies from cache
id: cacheNpm
uses: actions/cache@v2
with:
path: |
~/.npm
node_modules
key: npm-v8-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
restore-keys: npm-v8-${{ runner.os }}-${{ github.ref }}-
- name: Install Node.js and npm
uses: actions/setup-node@v1
with:
node-version: 8.x
- name: Install dependencies
if: steps.cacheNpm.outputs.cache-hit != 'true'
run: |
npm update --no-save
npm update --save-dev --no-save
- name: Unit tests
# Some tests depend on TTY support, which is missing in GA runner
# Workaround taken from https://github.com/actions/runner/issues/241#issuecomment-577360161
run: script -e -c "npm test -- -b"
- name: Packaging tests
run: npm run integration-test-run-package
linuxNode6:
name: '[Linux] Node.js v6: Unit tests'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Retrieve dependencies from cache
id: cacheNpm
uses: actions/cache@v2
with:
path: |
~/.npm
node_modules
key: npm-v6-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
restore-keys: npm-v6-${{ runner.os }}-${{ github.ref }}-
- name: Install Node.js and npm
uses: actions/setup-node@v1
with:
node-version: 6.x
- name: Install dependencies
if: steps.cacheNpm.outputs.cache-hit != 'true'
run: |
npm update --no-save
npm update --save-dev --no-save
- name: Unit tests
# Some tests depend on TTY support, which is missing in GA runner
# Workaround taken from https://github.com/actions/runner/issues/241#issuecomment-577360161
run: script -e -c "npm test -- -b"
integrate:
name: Integrate
runs-on: ubuntu-latest

View File

@ -12,7 +12,7 @@ env:
jobs:
linuxNode14:
name: '[Linux] Node.js 14: Lint, Formatting, Eventual Commitlint, Eventual Changelog & Unit tests'
name: '[Linux] Node.js 14: Lint, Formatting, Eventual Commitlint, Eventual Changelog, Unit & packaging tests'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
@ -69,6 +69,8 @@ jobs:
# Some tests depend on TTY support, which is missing in GA runner
# Workaround taken from https://github.com/actions/runner/issues/241#issuecomment-577360161
run: script -e -c "npm test -- -b"
- name: Packaging tests
run: npm run integration-test-run-package
windowsNode14:
name: '[Windows] Node.js v14: Unit tests'
@ -175,73 +177,3 @@ jobs:
env:
CODECOV_TOKEN: 3898f3e1-f317-453e-a3a9-0462390f93c5
run: npx codecov
linuxNode8:
name: '[Linux] Node.js v8: Unit & packaging tests'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Retrieve dependencies from cache
id: cacheNpm
uses: actions/cache@v2
with:
path: |
~/.npm
node_modules
key: npm-v8-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
restore-keys: |
npm-v8-${{ runner.os }}-${{ github.ref }}-
npm-v8-${{ runner.os }}-refs/heads/master-
- name: Install Node.js and npm
uses: actions/setup-node@v1
with:
node-version: 8.x
- name: Install dependencies
if: steps.cacheNpm.outputs.cache-hit != 'true'
run: |
npm update --no-save
npm update --save-dev --no-save
- name: Unit tests
# Some tests depend on TTY support, which is missing in GA runner
# Workaround taken from https://github.com/actions/runner/issues/241#issuecomment-577360161
run: script -e -c "npm test -- -b"
- name: Packaging tests
run: npm run integration-test-run-package
linuxNode6:
name: '[Linux] Node.js v6: Unit tests'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Retrieve dependencies from cache
id: cacheNpm
uses: actions/cache@v2
with:
path: |
~/.npm
node_modules
key: npm-v6-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
restore-keys: |
npm-v6-${{ runner.os }}-${{ github.ref }}-
npm-v6-${{ runner.os }}-refs/heads/master-
- name: Install Node.js and npm
uses: actions/setup-node@v1
with:
node-version: 6.x
- name: Install dependencies
if: steps.cacheNpm.outputs.cache-hit != 'true'
run: |
npm update --no-save
npm update --save-dev --no-save
- name: Unit tests
# Some tests depend on TTY support, which is missing in GA runner
# Workaround taken from https://github.com/actions/runner/issues/241#issuecomment-577360161
run: script -e -c "npm test -- -b"

View File

@ -10,30 +10,25 @@ if (require('../lib/utils/isStandaloneExecutable')) {
}
}
const nodeVersion = Number(process.version.split('.')[0].slice(1));
// CLI Triage
// Serverless Components work only in Node.js v8+
if (nodeVersion >= 8) {
try {
const componentsV1 = require('@serverless/cli');
const componentsV2 = require('@serverless/components');
try {
const componentsV1 = require('@serverless/cli');
const componentsV2 = require('@serverless/components');
if (componentsV1.runningComponents()) {
// Serverless Components v1 CLI (deprecated)
componentsV1.runComponents();
return;
}
if (componentsV1.runningComponents()) {
// Serverless Components v1 CLI (deprecated)
componentsV1.runComponents();
return;
}
if (componentsV2.runningComponents()) {
// Serverless Components CLI
componentsV2.runComponents();
return;
}
} catch (error) {
if (process.env.SLS_DEBUG) {
require('../lib/classes/Error').logWarning(`CLI triage crashed with: ${error.stack}`);
}
if (componentsV2.runningComponents()) {
// Serverless Components CLI
componentsV2.runComponents();
return;
}
} catch (error) {
if (process.env.SLS_DEBUG) {
require('../lib/classes/Error').logWarning(`CLI triage crashed with: ${error.stack}`);
}
}

View File

@ -219,7 +219,7 @@
"test:isolated": "mocha-isolated \"!(test|node_modules)/**/*.test.js\""
},
"engines": {
"node": ">=6.0"
"node": ">=10.0"
},
"license": "MIT"
}

View File

@ -4,6 +4,17 @@
require('essentials');
const nodeVersion = Number(process.version.split('.')[0].slice(1));
if (nodeVersion < 10) {
const serverlessVersion = Number(require('../package.json').version.split('.')[0]);
process.stdout.write(
`Serverless: \x1b[91mInitialization error: Node.js v${nodeVersion} is not supported by ` +
`Serverless Framework v${serverlessVersion}. Please upgrade\x1b[39m\n`
);
process.exit(1);
}
// global graceful-fs patch
// https://github.com/isaacs/node-graceful-fs#global-patching
require('graceful-fs').gracefulify(require('fs'));
@ -17,7 +28,6 @@ const BbPromise = require('bluebird');
const logError = require('../lib/classes/Error').logError;
const uuid = require('uuid');
const nodeVersion = Number(process.version.split('.')[0].slice(1));
const invocationId = uuid.v4();
let serverless;
@ -31,13 +41,6 @@ if (process.env.SLS_DEBUG) {
});
}
if (nodeVersion < 10) {
require('../lib/utils/logDeprecation')(
'OUTDATED_NODEJS',
'Support for Node.js versions below v10 will be dropped with next major release. Please upgrade at https://nodejs.org/en/'
);
}
const Serverless = require('../lib/Serverless');
serverless = new Serverless();