diff --git a/.changeset/fair-poems-pull.md b/.changeset/fair-poems-pull.md new file mode 100644 index 00000000..4ba352b2 --- /dev/null +++ b/.changeset/fair-poems-pull.md @@ -0,0 +1,13 @@ +--- +'@twilio-labs/serverless-twilio-runtime': major +'create-twilio-function': major +'@twilio-labs/plugin-serverless': major +'@twilio-labs/plugin-assets': major +'twilio-run': major +--- + +**WHAT**: Remove Node.js 18 from supported versions. + +**WHY**: Node.js 18 is EOL and will not receive bug fixes or security upgrades. Users should migrate to Node.js 20 or 22. + +**BREAKING CHANGE**: Projects using `create-twilio-function`, `@twilio-labs/plugin-asset`, `@twilio-labs/plugin-serverless`, `@twilio-labs/serverless-twilio-runtime` or `twilio-run` will have to migrate to Node.js 20 or 22. diff --git a/.nvmrc b/.nvmrc index 3c032078..209e3ef4 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18 +20 diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 7e647123..cfa7ff9d 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -14,8 +14,8 @@ If you are planning to contribute something that does not have an open issue yet ## Requirements -Make sure you have Node.js 18 or newer installed. Due to compatibility with Twilio -Functions this project has to support at least Node.js 18.0.0. +Make sure you have Node.js 20 or newer installed. Due to compatibility with Twilio +Functions this project has to support at least Node.js 20.0.0. We are using the npm CLI to manage our project. You'll need at least `npm` version 8 or newer. diff --git a/package.json b/package.json index 3d599527..dcd4a4e7 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "prettier": "^2.2.1", "rimraf": "^3.0.2", "ts-jest": "^29.1.2", - "typedoc": "^0.27.4", + "typedoc": "^0.28.14", "typescript": "^5.3.3" }, "lint-staged": { diff --git a/packages/create-twilio-function/package.json b/packages/create-twilio-function/package.json index a3f8e8b7..782155a5 100644 --- a/packages/create-twilio-function/package.json +++ b/packages/create-twilio-function/package.json @@ -42,7 +42,7 @@ "yargs": "^17.2.1" }, "engines": { - "node": ">=12.22.1" + "node": "^20.x || ^22.x" }, "files": [ "bin/", diff --git a/packages/create-twilio-function/src/create-twilio-function/versions.js b/packages/create-twilio-function/src/create-twilio-function/versions.js index cb65f86d..d50856dd 100644 --- a/packages/create-twilio-function/src/create-twilio-function/versions.js +++ b/packages/create-twilio-function/src/create-twilio-function/versions.js @@ -6,7 +6,7 @@ module.exports = { '@twilio/runtime-handler' ].replace(/[\^~]/, ''), twilioRun: pkgJson.dependencies['twilio-run'], - node: '22', + node: '^20.x || ^22.x', typescript: '^5.3.3', serverlessRuntimeTypes: '^4.0.0', copyfiles: '^2.4.1', diff --git a/packages/plugin-assets/package.json b/packages/plugin-assets/package.json index 2eefcf50..f637570b 100644 --- a/packages/plugin-assets/package.json +++ b/packages/plugin-assets/package.json @@ -23,7 +23,7 @@ "rimraf": "^5.0.5" }, "engines": { - "node": ">=18" + "node": "^20.x || ^22.x" }, "files": [ "/oclif.manifest.json", diff --git a/packages/plugin-serverless/package.json b/packages/plugin-serverless/package.json index f4be1b08..069595b2 100644 --- a/packages/plugin-serverless/package.json +++ b/packages/plugin-serverless/package.json @@ -22,7 +22,7 @@ "oclif": "^4.0.0" }, "engines": { - "node": ">=18.0.0" + "node": "^20.x || ^22.x" }, "files": [ "/oclif.manifest.json", diff --git a/packages/serverless-twilio-runtime/Readme.md b/packages/serverless-twilio-runtime/Readme.md index 8afa3c06..c394493c 100644 --- a/packages/serverless-twilio-runtime/Readme.md +++ b/packages/serverless-twilio-runtime/Readme.md @@ -8,7 +8,7 @@ Serverless Framework plugin to deploy to the Twilio Runtime. ### Pre-requisites -- Node.js v18.x (this is the runtime version supported by Twilio Functions) +- Node.js v20.x (this is the runtime version supported by Twilio Functions) - Serverless CLI v1.50.0+. You can run npm i -g serverless if you don't already have it. - A Twilio account. If you don't have one you can [sign up quickly](https://www.twilio.com/try-twilio). diff --git a/packages/twilio-run/__tests__/utils/stack-trace/helpers.test.ts b/packages/twilio-run/__tests__/utils/stack-trace/helpers.test.ts index 0b6aee19..fc02d212 100644 --- a/packages/twilio-run/__tests__/utils/stack-trace/helpers.test.ts +++ b/packages/twilio-run/__tests__/utils/stack-trace/helpers.test.ts @@ -16,9 +16,12 @@ function generateMockCallSite( getFunction: jest.fn(), getFunctionName: jest.fn(), getMethodName: jest.fn(), + getPosition: jest.fn(), getFileName: jest.fn().mockReturnValue(fileName), getLineNumber: jest.fn(), getColumnNumber: jest.fn(), + getEnclosingColumnNumber: jest.fn(), + getEnclosingLineNumber: jest.fn(), getEvalOrigin: jest.fn(), isToplevel: jest.fn(), isEval: jest.fn(), @@ -27,6 +30,8 @@ function generateMockCallSite( isAsync: jest.fn(), isPromiseAll: jest.fn(), getPromiseIndex: jest.fn(), + getScriptHash: jest.fn(), + getScriptNameOrSourceURL: jest.fn(), toString: () => { return str; }, diff --git a/packages/twilio-run/package.json b/packages/twilio-run/package.json index 1ea3d6ef..cc14ae3c 100644 --- a/packages/twilio-run/package.json +++ b/packages/twilio-run/package.json @@ -122,7 +122,7 @@ "README.md" ], "engines": { - "node": ">=18.0.0" + "node": "^20.x || ^22.x" }, "gitHead": "6db273648ed19474f4125042556b10c051529912" } diff --git a/packages/twilio-run/src/checks/nodejs-version.ts b/packages/twilio-run/src/checks/nodejs-version.ts index 7215d352..265f13e1 100644 --- a/packages/twilio-run/src/checks/nodejs-version.ts +++ b/packages/twilio-run/src/checks/nodejs-version.ts @@ -1,7 +1,7 @@ import { stripIndent } from 'common-tags'; import { logger } from '../utils/logger'; -const SERVERLESS_NODE_JS_VERSION = ['18.', '20.', '22.']; +const SERVERLESS_NODE_JS_VERSION = ['20.', '22.']; export function printVersionWarning( nodeVersion: string,