From a9a3694a98060be9a33045bb0fcf92ccf1acff6f Mon Sep 17 00:00:00 2001 From: Jacob Lamb Date: Tue, 2 Apr 2024 23:03:17 -0700 Subject: [PATCH] fix: update vercel node support status (#10611) * Update adapter.ts * Create clever-houses-yawn.md * Update adapter.ts * Update adapter.ts * Update adapter.ts Co-authored-by: Bjorn Lu * Update .changeset/clever-houses-yawn.md Co-authored-by: Emanuele Stoppa --------- Co-authored-by: Bjorn Lu Co-authored-by: Emanuele Stoppa --- .changeset/clever-houses-yawn.md | 5 +++++ .../vercel/src/serverless/adapter.ts | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 .changeset/clever-houses-yawn.md diff --git a/.changeset/clever-houses-yawn.md b/.changeset/clever-houses-yawn.md new file mode 100644 index 0000000000..54e4e09cb7 --- /dev/null +++ b/.changeset/clever-houses-yawn.md @@ -0,0 +1,5 @@ +--- +"@astrojs/vercel": patch +--- + +Updates the supported version of Node.js diff --git a/packages/integrations/vercel/src/serverless/adapter.ts b/packages/integrations/vercel/src/serverless/adapter.ts index bb7d9f4373..4aa7a5a995 100644 --- a/packages/integrations/vercel/src/serverless/adapter.ts +++ b/packages/integrations/vercel/src/serverless/adapter.ts @@ -59,11 +59,10 @@ const ISR_PATH = `/_isr?${ASTRO_PATH_PARAM}=$0`; // https://vercel.com/docs/concepts/functions/serverless-functions/runtimes/node-js#node.js-version const SUPPORTED_NODE_VERSIONS: Record< string, - { status: 'current' } | { status: 'beta' } | { status: 'deprecated'; removal: Date } + { status: 'default' } | { status: 'beta' } | { status: 'retiring'; removal: Date | string; warnDate: Date } | { status: 'deprecated'; removal: Date } > = { - 16: { status: 'deprecated', removal: new Date('February 6 2024') }, - 18: { status: 'current' }, - 20: { status: 'beta' }, + 18: { status: 'retiring', removal: "Early 2025", warnDate: new Date('October 1 2024') }, + 20: { status: 'default' }, }; function getAdapter({ @@ -522,9 +521,17 @@ function getRuntime(process: NodeJS.Process, logger: AstroIntegrationLogger): Ru ); return 'nodejs18.x'; } - if (support.status === 'current') { + if (support.status === 'default') { return `nodejs${major}.x`; } + if (support.status === 'retiring') { + if (support.warnDate && new Date() >= support.warnDate) { + logger.warn( + `Your project is being built for Node.js ${major} as the runtime, which is retiring by ${support.removal}.` + ); + } + return `nodejs${major}.x`; + } if (support.status === 'beta') { logger.warn( `Your project is being built for Node.js ${major} as the runtime, which is currently in beta for Vercel Serverless Functions.`