Skip to content

Commit

Permalink
fix(azure): add 18 and 20 to supported node versions (#2077)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 authored Jan 16, 2024
1 parent 19dbd27 commit f758d4d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/presets/azure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,19 @@ async function writeRoutes(nitro: Nitro) {
version: "2.0",
};

let nodeVersion = "16";
// https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-node?tabs=typescript%2Cwindows%2Cazure-cli&pivots=nodejs-model-v4#supported-versions
const supportedNodeVersions = new Set(["16", "18", "20"]);
let nodeVersion = "18";
try {
const currentNodeVersion = JSON.parse(
await readFile(join(nitro.options.rootDir, "package.json"), "utf8")
).engines.node;
if (["16", "14"].includes(currentNodeVersion)) {
if (supportedNodeVersions.has(currentNodeVersion)) {
nodeVersion = currentNodeVersion;
}
} catch {
const currentNodeVersion = process.versions.node.slice(0, 2);
if (["16", "14"].includes(currentNodeVersion)) {
if (supportedNodeVersions.has(currentNodeVersion)) {
nodeVersion = currentNodeVersion;
}
}
Expand Down

0 comments on commit f758d4d

Please sign in to comment.