Skip to content

Commit 59cda04

Browse files
authoredFeb 24, 2025··
feat: change default node version to v22 (#5958)
* feat: change default node version to v22 * fix: update framework node versions
1 parent b1de419 commit 59cda04

File tree

10 files changed

+17
-26
lines changed

10 files changed

+17
-26
lines changed
 

‎packages/build-info/src/frameworks/nuxt.test.ts

-4
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ describe('Nuxt V3', () => {
4646
expect(detected?.[0].dev?.command).toBe('nuxt dev')
4747
expect(detected?.[0].dev?.clearPublishDirectory).toBe(true)
4848
expect(detected?.[0].dev?.port).toBe(3000)
49-
expect(detected?.[0].env).toMatchObject({
50-
AWS_LAMBDA_JS_RUNTIME: 'nodejs18.x',
51-
NODE_VERSION: '18',
52-
})
5349

5450
const settings = await getSettings(detected![0], project, cwd)
5551
expect(settings.clearPublishDirectory).toBeTruthy()

‎packages/build-info/src/frameworks/nuxt.ts

-5
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ export class Nuxt extends BaseFramework implements Framework {
3434
this.build.command = `nuxt build`
3535
this.build.directory = `dist`
3636
this.dev.command = `nuxt dev`
37-
38-
this.env = {
39-
AWS_LAMBDA_JS_RUNTIME: 'nodejs18.x',
40-
NODE_VERSION: '18',
41-
}
4237
}
4338
return this as DetectedFramework
4439
}

‎packages/build-info/src/frameworks/observable.ts

-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,4 @@ export class Observable extends BaseFramework implements Framework {
2222
light: '/logos/observable/default.svg',
2323
dark: '/logos/observable/default.svg',
2424
}
25-
26-
env = {
27-
NODE_VERSION: '20',
28-
}
2925
}

‎packages/zip-it-and-ship-it/src/runtimes/node/bundlers/esbuild/bundler_target.ts

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const versionMap = {
88
16: 'node16',
99
18: 'node18',
1010
20: 'node20',
11+
22: 'node22',
1112
} as const
1213

1314
type VersionValues = (typeof versionMap)[keyof typeof versionMap]

‎packages/zip-it-and-ship-it/src/runtimes/node/utils/node_runtime.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const getNodeRuntimeForV2 = (input: string | undefined): string | undefin
2525
const version = parseVersion(input)
2626

2727
// If version was unable to be parsed or if the version is older than Node.js 18
28-
// we return the current default Node.js version (which was Node.js 18 while writing this).
28+
// we return the current default Node.js version (which was Node.js 22 while writing this).
2929
// Here we do not want BB/FO to decide on the version, because they value AWS_LAMBDA_JS_RUNTIME, which
3030
// might be set to an too old version
3131
if (!version || version < minimumV2Version) {

‎packages/zip-it-and-ship-it/src/runtimes/node/utils/node_version.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export interface NodeVersionSupport {
66
}
77

88
// Must match the default version used in Bitballoon.
9-
export const DEFAULT_NODE_VERSION = 18
9+
export const DEFAULT_NODE_VERSION = 22
1010

1111
export const getNodeVersion = (configVersion?: string) => parseVersion(configVersion) ?? DEFAULT_NODE_VERSION
1212

‎packages/zip-it-and-ship-it/tests/esbuild.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ describe('esbuild', () => {
3232
await zipFixture('node-module-optional-catch-binding', {
3333
opts: {
3434
archiveFormat: ARCHIVE_FORMAT.NONE,
35-
config: { '*': { nodeBundler: NODE_BUNDLER.ESBUILD, nodeVersion: '18.x' } },
35+
config: { '*': { nodeBundler: NODE_BUNDLER.ESBUILD, nodeVersion: '22.x' } },
3636
},
3737
})
3838

39-
expect(build).toHaveBeenCalledWith(expect.objectContaining({ target: ['node18'] }))
39+
expect(build).toHaveBeenCalledWith(expect.objectContaining({ target: ['node22'] }))
4040
})
4141
})

‎packages/zip-it-and-ship-it/tests/unit/runtimes/node/utils/node_runtime.test.ts

+8-7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ describe('getNodeRuntime', () => {
88
['nodejs16.x', 'nodejs16.x'],
99
['nodejs18.x', 'nodejs18.x'],
1010
['nodejs20.x', 'nodejs20.x'],
11+
['nodejs22.x', 'nodejs22.x'],
1112
['14.x', 'nodejs14.x'],
1213
['v16.x', 'nodejs16.x'],
1314
['18.0.0', 'nodejs18.x'],
@@ -21,17 +22,17 @@ describe('getNodeRuntime', () => {
2122

2223
describe('getNodeRuntimeForV2', () => {
2324
test.each([
24-
['nodejs12.x', 'nodejs18.x'],
25-
['nodejs16.x', 'nodejs18.x'],
25+
['nodejs12.x', 'nodejs22.x'],
26+
['nodejs16.x', 'nodejs22.x'],
2627
['nodejs18.x', 'nodejs18.x'],
2728
['nodejs20.x', 'nodejs20.x'],
28-
['14.x', 'nodejs18.x'],
29-
['v16.x', 'nodejs18.x'],
29+
['14.x', 'nodejs22.x'],
30+
['v16.x', 'nodejs22.x'],
3031
['18.0.0', 'nodejs18.x'],
3132
['20.0.0', 'nodejs20.x'],
32-
['v14.2.0', 'nodejs18.x'],
33-
['14.1', 'nodejs18.x'],
34-
[':shrug:', 'nodejs18.x'],
33+
['v14.2.0', 'nodejs22.x'],
34+
['14.1', 'nodejs22.x'],
35+
[':shrug:', 'nodejs22.x'],
3536
['99.0.0', undefined],
3637
])('handles `%s`', (input, expected) => {
3738
expect(getNodeRuntimeForV2(input)).toBe(expected)

‎packages/zip-it-and-ship-it/tests/unit/runtimes/node/utils/node_version.test.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ describe('getNodeVersion', () => {
1313
['nodejs16.x', 16],
1414
['nodejs18.x', 18],
1515
['nodejs20.x', 20],
16+
['nodejs22.x', 22],
1617
['18.x', 18],
1718
['node16', 16],
1819
['14.1.1', 14],
@@ -29,6 +30,7 @@ describe('parseVersion', () => {
2930
['nodejs12.x', 12],
3031
['nodejs18.x', 18],
3132
['nodejs20.x', 20],
33+
['nodejs22.x', 22],
3234
['18.x', 18],
3335
['node14', 14],
3436
['14.1.1', 14],

‎packages/zip-it-and-ship-it/tests/v2api.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ describe.runIf(semver.gte(nodeVersion, '18.13.0'))('V2 functions API', () => {
342342
},
343343
})
344344

345-
expect(files[0].runtimeVersion).toBe('nodejs18.x')
345+
expect(files[0].runtimeVersion).toBe('nodejs22.x')
346346
})
347347

348348
test('Returns Node.js 18 if invalid version is set', async () => {
@@ -357,7 +357,7 @@ describe.runIf(semver.gte(nodeVersion, '18.13.0'))('V2 functions API', () => {
357357
},
358358
})
359359

360-
expect(files[0].runtimeVersion).toBe('nodejs18.x')
360+
expect(files[0].runtimeVersion).toBe('nodejs22.x')
361361
})
362362

363363
test('Returns no Node.js version if version is newer than 18 but not a valid runtime', async () => {

0 commit comments

Comments
 (0)
Please sign in to comment.