From f0ce5f095e3c2ee7de3327bd6affcee1e1281fd5 Mon Sep 17 00:00:00 2001 From: Chang-Hung Liang Date: Wed, 28 Mar 2018 22:52:18 +0800 Subject: [PATCH] Update Notify: Fix TypeError in printVersionInfo To reproduce, run `zapier -v` in a directory containing a package.json which doesn't have zapier-platform-core as dependency. --- src/utils/misc.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/utils/misc.js b/src/utils/misc.js index 721ddfb..e4b9ba8 100644 --- a/src/utils/misc.js +++ b/src/utils/misc.js @@ -161,14 +161,16 @@ const printVersionInfo = context => { if (fileExistsSync(path.resolve('./package.json'))) { // might be a caret, have to coerce for later comparison - const requiredVersion = semver.coerce( - _.get( - require(path.resolve('./package.json')), - `dependencies.${PLATFORM_PACKAGE}`, - {} - ) + // + let requiredVersion = _.get( + require(path.resolve('./package.json')), + `dependencies.${PLATFORM_PACKAGE}`, + {} ).version; if (requiredVersion) { + // might be a caret, have to coerce for later comparison + requiredVersion = semver.coerce(requiredVersion); + // the single version their package.json requires versions.splice(1, 0, `zapier-platform-core/${requiredVersion}`);