Skip to content

Commit

Permalink
Make semver warning more tailored to 8 deprecation and 10 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mhoeger committed Jun 12, 2018
1 parent 976fddc commit a34e72c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/GrpcService.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import * as semver from 'semver';

if (!semver.satisfies(process.version, '8.x || 10.x')) {
let errorMessage = `Your Function App is currently set to use current version ${process.version}, but the runtime requires Node 8.x or 10.x.
For deployed code, please change WEBSITE_NODE_DEFAULT_VERSION in App Settings. On your local machine, you can change node version using 'nvm' (make sure to quit and restart your code editor to pick up the changes).`;
console.error(errorMessage);
throw new Error(errorMessage);
}
// If user is not using Node.js v10, warn to upgrade to v10
if (!semver.satisfies(process.version, '10.x')) {
let errorMessage = `Your Function App is currently set to use Node.js version ${process.version}, but the runtime requires a 10.x version.
For deployed code, please change WEBSITE_NODE_DEFAULT_VERSION in App Settings. On your local machine, you can change node version using 'nvm' (make sure to quit and restart your code editor to pick up the changes).`;
console.error(errorMessage);
// Don't fail Node.js v8 users for now
if (!semver.satisfies(process.version, '8.x')) {
throw new Error(errorMessage);
}
}

import { Duplex } from 'stream';
import * as grpc from 'grpc';
Expand Down

0 comments on commit a34e72c

Please sign in to comment.