Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap emulator Node runtime discovery to favor local cache #2740

Merged
merged 12 commits into from
Oct 28, 2020
Prev Previous commit
Next Next commit
Simplify code
  • Loading branch information
abeisgoat committed Oct 28, 2020
commit e7a7679ac67697b03b1358619be0f8e6de04a8f2
8 changes: 2 additions & 6 deletions src/emulator/functionsEmulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -676,13 +676,9 @@ export class FunctionsEmulator implements EmulatorInstance {
* Returns a node major version ("10", "8") or null
* @param frb the current Functions Runtime Bundle
*/
getRequestedNodeRuntimeVersion(frb: FunctionsRuntimeBundle): string | null {
getRequestedNodeRuntimeVersion(frb: FunctionsRuntimeBundle): string | undefined {
const pkg = require(path.join(frb.cwd, "package.json"));
if ((!pkg.engines || !pkg.engines.node) && !frb.nodeMajorVersion) {
return null;
}

return frb.nodeMajorVersion || pkg.engines.node;
return frb.nodeMajorVersion || (pkg.engines && pkg.engines.node);
}
/**
* Returns the path to a "node" executable to use.
Expand Down