Skip to content

Commit

Permalink
feat: Remove support for Node v10
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Node in versions lower than 12 is no longer supported
  • Loading branch information
pgrzesik authored and medikoo committed Jan 27, 2022
1 parent f958afb commit 90f00b7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 87 deletions.
36 changes: 2 additions & 34 deletions .github/workflows/integrate.yml
Expand Up @@ -152,38 +152,6 @@ jobs:
- name: Push coverage
run: npx codecov

linuxNode10:
name: '[Linux] Node.js v10: 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-v10-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
restore-keys: npm-v10-${{ runner.os }}-${{ github.ref }}-

- name: Install Node.js and npm
uses: actions/setup-node@v1
with:
node-version: 10.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"

linuxNode4:
name: '[Linux] Node.js v4: Node version validation test'
runs-on: ubuntu-latest
Expand All @@ -197,12 +165,12 @@ jobs:
node-version: 4.x

- name: Node version validation test
run: ./bin/serverless.js | grep -q "Initialization error"
run: ./bin/serverless.js 2>&1 | grep -q "does not support"

integrate:
name: Integrate
runs-on: ubuntu-latest
needs: [linuxNode16, windowsNode16, linuxNode14, linuxNode12, linuxNode10, linuxNode4]
needs: [linuxNode16, windowsNode16, linuxNode14, linuxNode12, linuxNode4]
timeout-minutes: 30 # Default is 360
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down
36 changes: 1 addition & 35 deletions .github/workflows/validate.yml
Expand Up @@ -174,40 +174,6 @@ jobs:
- name: Push coverage
run: npx codecov

linuxNode10:
name: '[Linux] Node.js v10: 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-v10-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
restore-keys: |
npm-v10-${{ runner.os }}-${{ github.ref }}-
npm-v10-${{ runner.os }}-refs/heads/master-
- name: Install Node.js and npm
uses: actions/setup-node@v1
with:
node-version: 10.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"

linuxNode4:
name: '[Linux] Node.js v4: Node version validation test'
runs-on: ubuntu-latest
Expand All @@ -221,4 +187,4 @@ jobs:
node-version: 4.x

- name: Node version validation test
run: ./bin/serverless.js | grep -q "Initialization error"
run: ./bin/serverless.js 2>&1 | grep -q "does not support"
23 changes: 9 additions & 14 deletions bin/serverless.js
Expand Up @@ -10,21 +10,16 @@
EvalError.$serverlessCommandStartTime = process.hrtime();

const nodeVersion = Number(process.version.split('.')[0].slice(1));
const minimumSupportedVersion = 12;

if (nodeVersion < 12) {
if (nodeVersion >= 10) {
require('../lib/utils/logDeprecation')(
'OUTDATED_NODEJS',
'Support for Node.js versions below v12 will be dropped with next major release. Please upgrade at https://nodejs.org/en/'
);
} else {
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);
}
if (nodeVersion < minimumSupportedVersion) {
const serverlessVersion = Number(require('../package.json').version.split('.')[0]);
process.stderr.write(
`\x1b[91mError: Serverless Framework v${serverlessVersion} does not support ` +
`Node.js v${nodeVersion}. Please upgrade Node.js to the latest ` +
`LTS version (v${minimumSupportedVersion} is a minimum supported version)\x1b[39m\n`
);
process.exit(1);
}

if (require('../lib/utils/isStandaloneExecutable')) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -109,7 +109,7 @@
"xml2js": "^0.4.23"
},
"eslintConfig": {
"extends": "@serverless/eslint-config/node/10",
"extends": "@serverless/eslint-config/node",
"root": true,
"overrides": [
{
Expand Down Expand Up @@ -218,7 +218,7 @@
"test:isolated": "mocha-isolated \"test/unit/**/*.test.js\""
},
"engines": {
"node": ">=10.0"
"node": ">=12.0"
},
"license": "MIT"
}
2 changes: 0 additions & 2 deletions test/unit/lib/classes/PluginManager.test.js
Expand Up @@ -1863,8 +1863,6 @@ describe('PluginManager', () => {

before(() => {
env = resolveAwsEnv();
// Test may be run against deprecated Node.js versions
env.SLS_DEPRECATION_DISABLE = 'OUTDATED_NODEJS';
});

beforeEach(() => {
Expand Down

0 comments on commit 90f00b7

Please sign in to comment.