mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
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 <bjornlu.dev@gmail.com> * Update .changeset/clever-houses-yawn.md Co-authored-by: Emanuele Stoppa <my.burning@gmail.com> --------- Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com> Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
This commit is contained in:
parent
57959e607e
commit
a9a3694a98
2 changed files with 17 additions and 5 deletions
5
.changeset/clever-houses-yawn.md
Normal file
5
.changeset/clever-houses-yawn.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@astrojs/vercel": patch
|
||||
---
|
||||
|
||||
Updates the supported version of Node.js
|
|
@ -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.`
|
||||
|
|
Loading…
Reference in a new issue