npm-check-updates
Advanced tools
Comparing version 2.8.5 to 2.8.6
@@ -182,3 +182,3 @@ var options = {}; | ||
// only search for installed dependencies if a pkgFile is specified | ||
pkgFile ? vm.getInstalledPackages() : Promise.resolve(), | ||
pkgFile ? vm.getInstalledPackages({cwd: options.packageFileDir ? path.dirname(path.resolve(pkgFile)) : null}) : Promise.resolve(), | ||
upgradePackageDefinitions(current) | ||
@@ -386,3 +386,3 @@ ]) | ||
// print a message if we are using a descendant package file | ||
var relPathToPackage = path.relative(process.cwd(), pkgFile); | ||
var relPathToPackage = path.resolve(pkgFile); | ||
if (relPathToPackage !== pkgFileName) { | ||
@@ -389,0 +389,0 @@ print('Using ' + relPathToPackage); |
@@ -6,3 +6,4 @@ var _ = require('lodash'); | ||
var rawPromisify = require('../raw-promisify.js'); | ||
var versionUtil = require('../version-util.js'); | ||
var versionUtil = require('../version-util.js'); | ||
var spawn = require('spawn-please'); | ||
@@ -73,4 +74,10 @@ var initialized = false; | ||
list: function (args) { | ||
/** | ||
* @args Arguments for npm ls | ||
* @options.cwd (optional) | ||
*/ | ||
list: function (args, options) { | ||
options = options || {} | ||
if (!initialized) { | ||
@@ -80,3 +87,18 @@ throw new Error('init must be called before using the version manager'); | ||
return npm.commands.listAsync(args || [], true); // silent:true | ||
// if packageFile is specified, spawn an npm process so that installed modules can be read from the same directotry as the package file (#201) | ||
return options.cwd ? | ||
spawn('npm', ['ls', '--json', '-depth=0'], {cwd: options.cwd}) | ||
.then(JSON.parse) | ||
// transform results into a similar format as the API | ||
.then(function (results) { | ||
return { | ||
dependencies: cint.mapObject(results.dependencies, function (name, info) { | ||
return cint.keyValue(name, { | ||
name: name, | ||
version: info.version | ||
}); | ||
}) | ||
}; | ||
}) : | ||
npm.commands.listAsync(args || [], true); // silent:true | ||
}, | ||
@@ -83,0 +105,0 @@ |
@@ -260,2 +260,5 @@ var semver = require('semver'); | ||
/** | ||
* @options.cwd | ||
*/ | ||
function getInstalledPackages(options) { | ||
@@ -265,3 +268,3 @@ | ||
return selectedPackageManager.list().then(function (results) { | ||
return selectedPackageManager.list([], {cwd: options.cwd}).then(function (results) { | ||
if (!results || !results.dependencies) { | ||
@@ -283,3 +286,2 @@ throw new Error('Unable to retrieve NPM package list'); | ||
return simpleDependencies; | ||
}); | ||
@@ -286,0 +288,0 @@ } |
{ | ||
"name": "npm-check-updates", | ||
"version": "2.8.5", | ||
"version": "2.8.6", | ||
"author": "Tomas Junnonen <tomas1@gmail.com>", | ||
@@ -64,3 +64,3 @@ "license": "MIT", | ||
"semver-utils": "^1.1.1", | ||
"spawn-please": "^0.1.0", | ||
"spawn-please": "^0.2.0", | ||
"update-notifier": "^1.0.2" | ||
@@ -67,0 +67,0 @@ }, |
@@ -89,2 +89,4 @@ [![NPM version](https://badge.fury.io/js/npm-check-updates.svg)](http://badge.fury.io/js/npm-check-updates) | ||
--packageFile package file location (default: ./package.json) | ||
--packageFileDir use same directory as packageFile to compare against | ||
installed modules. See #201. | ||
-m, --packageManager npm or bower (default: npm) | ||
@@ -91,0 +93,0 @@ -n, --newest find the newest versions available instead of the |
Sorry, the diff of this file is not supported yet
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
59488
1114
183
+ Addedspawn-please@0.2.0(transitive)
- Removedspawn-please@0.1.0(transitive)
Updatedspawn-please@^0.2.0