yarn-global
Advanced tools
Comparing version 1.0.2 to 1.1.0
10
index.js
@@ -27,3 +27,3 @@ 'use strict' | ||
function hasDependency(name) { | ||
function getDependencies() { | ||
try { | ||
@@ -33,8 +33,11 @@ const dir = getDirectory() | ||
.keys(require(path.join(dir, '../', 'package.json')).dependencies) | ||
.indexOf(name) !== -1 | ||
} catch (_) { | ||
return false | ||
return [] | ||
} | ||
} | ||
function hasDependency(name) { | ||
return getDependencies().indexOf(name) !== -1 | ||
} | ||
function hasPackage(name) { | ||
@@ -61,3 +64,4 @@ try { | ||
module.exports.inDirectory = inDirectory | ||
module.exports.getDependencies = getDependencies | ||
module.exports.hasDependency = hasDependency | ||
module.exports.hasPackage = hasPackage |
{ | ||
"name": "yarn-global", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "A set of useful methods for @yarnpkg", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -17,3 +17,3 @@ # yarn-global | ||
yarnGlobal.getDirectory() | ||
//=> /User/name/.config/yarn/global/node_modules | ||
//=> /Users/name/.config/yarn/global/node_modules | ||
@@ -23,2 +23,5 @@ yarnGlobal.inDirectory(process.cwd()) | ||
yarnGlobal.getDependencies() | ||
// An array of denpendencies installed by `yarn global add` | ||
yarnGlobal.hasDependency('create-react-app') | ||
@@ -29,3 +32,3 @@ // Check if you have installed it via `yarn global add` | ||
yarnGlobal.hasPackage('minimist') | ||
// Check if `/User/name/.config/yarn/global/node_modules/minimist` exists | ||
// Check if `/Users/name/.config/yarn/global/node_modules/minimist` exists | ||
// you may not have installed it by `yarn global add` | ||
@@ -32,0 +35,0 @@ //=> true |
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
4719
54
46