ember-cli-version-checker
Advanced tools
Comparing version 2.1.2 to 2.2.0
{ | ||
"name": "ember-cli-version-checker", | ||
"version": "2.1.2", | ||
"version": "2.2.0", | ||
"description": "Determine if your addon is being used by a minimum version of Ember CLI.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "mocha tests" | ||
"test": "mocha tests", | ||
"changelog": "lerna-changelog" | ||
}, | ||
@@ -16,2 +17,3 @@ "author": "Robert Jackson <me@rwjblue.com>", | ||
"eslint-plugin-prettier": "^2.3.1", | ||
"lerna-changelog": "^0.8.2", | ||
"mocha": "^3.3.0", | ||
@@ -18,0 +20,0 @@ "mocha-eslint": "^4.1.0", |
@@ -6,2 +6,20 @@ 'use strict'; | ||
const ALLOWED_ERROR_CODES = [ | ||
// resolve package error codes | ||
'MODULE_NOT_FOUND', | ||
// Yarn PnP Error Codes | ||
'UNDECLARED_DEPENDENCY', | ||
'MISSING_PEER_DEPENDENCY', | ||
'MISSING_DEPENDENCY', | ||
]; | ||
let pnp; | ||
try { | ||
pnp = require('pnpapi'); | ||
} catch (error) { | ||
// not in Yarn PnP; not a problem | ||
} | ||
class NPMDependencyVersionChecker extends DependencyVersionChecker { | ||
@@ -13,9 +31,16 @@ constructor(parent, name) { | ||
let target = this.name + '/package.json'; | ||
let basedir = addon.root; | ||
let jsonPath; | ||
try { | ||
jsonPath = resolve.sync(this.name + '/package.json', { | ||
basedir: addon.root, | ||
}); | ||
// the custom `pnp` code here can be removed when yarn 1.13 is the | ||
// current release this is due to Yarn 1.13 and resolve interoperating | ||
// together seemlessly | ||
jsonPath = pnp | ||
? pnp.resolveToUnqualified(target, basedir) | ||
: resolve.sync(target, { basedir }); | ||
} catch (e) { | ||
if (e.code === 'MODULE_NOT_FOUND') { | ||
if (ALLOWED_ERROR_CODES.indexOf(e.code) > -1) { | ||
jsonPath = null; | ||
@@ -22,0 +47,0 @@ } else { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15802
9
168
8