Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat: Drop support for Node.js versions below v10
BREAKING CHANGE:
Node.js versions below v10 are no longer supported
  • Loading branch information
medikoo committed Sep 10, 2020
1 parent 28ef7cc commit 69dd4b9
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 168 deletions.
70 changes: 3 additions & 67 deletions .github/workflows/integrate.yml
Expand Up @@ -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)
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
74 changes: 3 additions & 71 deletions .github/workflows/validate.yml
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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"
37 changes: 16 additions & 21 deletions bin/serverless.js
Expand Up @@ -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}`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -219,7 +219,7 @@
"test:isolated": "mocha-isolated \"!(test|node_modules)/**/*.test.js\""
},
"engines": {
"node": ">=6.0"
"node": ">=10.0"
},
"license": "MIT"
}
19 changes: 11 additions & 8 deletions scripts/serverless.js
Expand Up @@ -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'));
Expand All @@ -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;
Expand All @@ -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();
Expand Down

0 comments on commit 69dd4b9

Please sign in to comment.