From a34e72c49f1d4e8087e0de881e6a723ada0cebfd Mon Sep 17 00:00:00 2001 From: mhoeger Date: Tue, 12 Jun 2018 10:41:17 -0700 Subject: [PATCH] Make semver warning more tailored to 8 deprecation and 10 support --- src/GrpcService.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/GrpcService.ts b/src/GrpcService.ts index 88dffd35..5797fe49 100644 --- a/src/GrpcService.ts +++ b/src/GrpcService.ts @@ -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';