Skip to content

Commit b95f16b

Browse files
authored
feat: Add Node16 support as default (#435)
1 parent 30d5bdb commit b95f16b

File tree

8 files changed

+14
-10
lines changed

8 files changed

+14
-10
lines changed

Diff for: packages/create-twilio-function/src/create-twilio-function/versions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = {
66
'@twilio/runtime-handler'
77
].replace(/[\^~]/, ''),
88
twilioRun: pkgJson.dependencies['twilio-run'],
9-
node: '14',
9+
node: '16',
1010
typescript: '^3.8',
1111
serverlessRuntimeTypes: '^1.1',
1212
copyfiles: '^2.2.0',

Diff for: packages/plugin-serverless/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ FLAGS
157157
--password=<value> A specific API secret or auth token for deployment. Uses fields from .env otherwise
158158
--production Please prefer the "activate" command! Deploys to the production environment (no
159159
domain suffix). Overrides the value passed via the environment flag.
160-
--runtime=<value> The version of Node.js to deploy the build to. (node14)
160+
--runtime=<value> The version of Node.js to deploy the build to. (node16)
161161
--service-sid=<value> SID of the Twilio Serverless Service to deploy to
162162
--silent Suppress output and logs. This is a shorthand for "-l none -o none".
163163
--to=<value> [Alias for "environment"]

Diff for: packages/serverless-api/examples/deploy.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ async function run() {
1010
const result = await client.deployProject({
1111
...config,
1212
overrideExistingService: true,
13-
runtime: 'node14',
13+
runtime: 'node16',
1414
env: {
1515
HELLO: 'ahoy',
1616
WORLD: 'welt',

Diff for: packages/serverless-api/src/types/deploy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type DeployProjectConfigBase = {
4444
*/
4545
overrideExistingService?: boolean;
4646
/**
47-
* Version of Node.js to deploy with in Twilio Runtime. Can be "node14"
47+
* Version of Node.js to deploy with in Twilio Runtime. Can be "node16"
4848
*/
4949
runtime?: string;
5050
};

Diff for: packages/twilio-run/__tests__/templating/__snapshots__/defaultConfig.test.ts.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ exports[`writeDefaultConfigFile default file should match snapshot 1`] = `
3636
// \\"production\\": false /* Promote build to the production environment (no domain suffix). Overrides environment flag */,
3737
// \\"properties\\": null /* Specify the output properties you want to see. Works best on single types */,
3838
// \\"region\\": null /* Twilio API Region */,
39-
\\"runtime\\": \\"node14\\" /* The version of Node.js to deploy the build to. (node14) */,
39+
\\"runtime\\": \\"node16\\" /* The version of Node.js to deploy the build to. (node16) */,
4040
// \\"serviceName\\": null /* Overrides the name of the Serverless project. Default: the name field in your package.json */,
4141
// \\"serviceSid\\": null /* SID of the Twilio Serverless Service to deploy to */,
4242
// \\"sourceEnvironment\\": null /* SID or suffix of an existing environment you want to deploy from. */,

Diff for: packages/twilio-run/src/checks/nodejs-version.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { stripIndent } from 'common-tags';
22
import { logger } from '../utils/logger';
33

4-
const SERVERLESS_NODE_JS_VERSION = '14.';
4+
const SERVERLESS_NODE_JS_VERSION = ['14.', '16.'];
55

66
export function printVersionWarning(
77
nodeVersion: string,
8-
expectedVersion: string
8+
expectedVersion: string[]
99
): void {
1010
const title = 'Different Node.js Version Found';
1111
const msg = stripIndent`
@@ -22,7 +22,11 @@ export function printVersionWarning(
2222

2323
export default function checkNodejsVersion() {
2424
const nodeVersion = process.versions.node;
25-
if (!nodeVersion.startsWith(SERVERLESS_NODE_JS_VERSION)) {
25+
if (
26+
!SERVERLESS_NODE_JS_VERSION.some((nodeJsVersion) =>
27+
nodeVersion.startsWith(nodeJsVersion)
28+
)
29+
) {
2630
printVersionWarning(nodeVersion, SERVERLESS_NODE_JS_VERSION);
2731
}
2832
}

Diff for: packages/twilio-run/src/flags.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export const ALL_FLAGS = {
228228
} as Options,
229229
runtime: {
230230
type: 'string',
231-
describe: 'The version of Node.js to deploy the build to. (node14)',
231+
describe: 'The version of Node.js to deploy the build to. (node16)',
232232
} as Options,
233233
key: {
234234
type: 'string',

Diff for: packages/twilio-run/src/templating/defaultConfig.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { getDebugFunction } from '../utils/logger';
99

1010
const debug = getDebugFunction('twilio-run:templating:defaultConfig');
1111

12-
const DEFAULT_RUNTIME = 'node14';
12+
const DEFAULT_RUNTIME = 'node16';
1313

1414
function renderDefault(config: Options): string {
1515
if (config.type === 'boolean') {

0 commit comments

Comments
 (0)