Skip to content

Commit

Permalink
Nested if-statements are an eye sore.
Browse files Browse the repository at this point in the history
  • Loading branch information
taeold committed Jan 18, 2023
1 parent 5ab15aa commit 6063984
Showing 1 changed file with 25 additions and 26 deletions.
51 changes: 25 additions & 26 deletions src/deploy/functions/runtimes/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,35 +103,34 @@ export class Delegate {
}
}

// If the requested version is the same as the host, let's use that
if (semver.major(requestedVersion) === semver.major(hostVersion)) {
logLabeledSuccess("functions", `Using node@${semver.major(hostVersion)} from host.`);
} else {
// Otherwise we'll warn and use the version that is currently running this process.
if (process.env.FIREPIT_VERSION) {
logLabeledWarning(
"functions",
`You've requested "node" version "${semver.major(
requestedVersion
)}", but the standalone Firebase CLI comes with bundled Node "${semver.major(
hostVersion
)}".`
);
logLabeledSuccess(
"functions",
`To use a different Node.js version, consider removing the standalone Firebase CLI and switching to "firebase-tools" on npm.`
);
} else {
logLabeledWarning(
"functions",
`Your requested "node" version "${semver.major(
requestedVersion
)}" doesn't match your global version "${semver.major(
hostVersion
)}". Using node@${semver.major(hostVersion)} from host.`
);
}
return process.execPath;
}

if (!process.env.FIREPIT_VERSION) {
logLabeledWarning(
"functions",
`Your requested "node" version "${semver.major(
requestedVersion
)}" doesn't match your global version "${semver.major(
hostVersion
)}". Using node@${semver.major(hostVersion)} from host.`
);
return process.execPath;
}

// Otherwise we'll warn and use the version that is currently running this process.
logLabeledWarning(
"functions",
`You've requested "node" version "${semver.major(
requestedVersion
)}", but the standalone Firebase CLI comes with bundled Node "${semver.major(hostVersion)}".`
);
logLabeledSuccess(
"functions",
`To use a different Node.js version, consider removing the standalone Firebase CLI and switching to "firebase-tools" on npm.`
);
return process.execPath;
}

Expand Down

0 comments on commit 6063984

Please sign in to comment.