Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for Node.js versions below v10 #8131

Merged
merged 1 commit into from Aug 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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: Checkout repository
Expand Down Expand Up @@ -53,6 +53,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 @@ -154,72 +156,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 @@ -62,6 +62,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,73 +170,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/v2-

- 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/v2-

- 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 @@ -220,7 +220,7 @@
"test:isolated": "mocha-isolated"
},
"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();

process.on('uncaughtException', error => logError(error, { forceExit: true }));
Expand All @@ -34,13 +44,6 @@ require('../lib/utils/analytics').sendPending({
serverlessExecutionSpan: new BbPromise(resolve => (resolveServerlessExecutionSpan = resolve)),
});

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/'
);
}

// requiring here so that if anything went wrong,
// during require, it will be caught.
const Serverless = require('../lib/Serverless');
Expand Down