Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Commit

Permalink
Update Notify: Fix TypeError in printVersionInfo
Browse files Browse the repository at this point in the history
To reproduce, run `zapier -v` in a directory containing a package.json which
doesn't have zapier-platform-core as dependency.
  • Loading branch information
eliangcs committed Mar 28, 2018
1 parent 9e45d10 commit f0ce5f0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/utils/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);

Expand Down

0 comments on commit f0ce5f0

Please sign in to comment.