Skip to content

Commit

Permalink
fix: update vercel node support status (#10611)
Browse files Browse the repository at this point in the history
* Update adapter.ts

* Create clever-houses-yawn.md

* Update adapter.ts

* Update adapter.ts

* Update adapter.ts

Co-authored-by: Bjorn Lu <[email protected]>

* Update .changeset/clever-houses-yawn.md

Co-authored-by: Emanuele Stoppa <[email protected]>

---------

Co-authored-by: Bjorn Lu <[email protected]>
Co-authored-by: Emanuele Stoppa <[email protected]>
  • Loading branch information
3 people committed Apr 3, 2024
1 parent 57959e6 commit a9a3694
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/clever-houses-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/vercel": patch
---

Updates the supported version of Node.js
17 changes: 12 additions & 5 deletions packages/integrations/vercel/src/serverless/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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.`
Expand Down

0 comments on commit a9a3694

Please sign in to comment.