Skip to content

Commit

Permalink
install: directlyRequested -> userRequired
Browse files Browse the repository at this point in the history
We had two flags that meant the same thing with different names. Consolidate
these.

Credit: @iarna
PR-URL: npm/npm#10465
Reviewed By: @othiym23
  • Loading branch information
iarna committed Nov 20, 2015
1 parent 7efd3bc commit f5f166f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/install/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function andHandleOptionalDepErrors (pkg, next) {
return function (er) {
if (!er) return next.apply(null, arguments)
markAsFailed(pkg)
var anyFatal = pkg.directlyRequested || !pkg.parent
var anyFatal = pkg.userRequired || !pkg.parent
for (var ii = 0; ii < pkg.requiredBy.length; ++ii) {
var parent = pkg.requiredBy[ii]
var isFatal = failedDependency(parent, pkg)
Expand Down
3 changes: 1 addition & 2 deletions lib/install/deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,14 @@ exports.loadRequestedDeps = function (args, tree, saveToDependencies, log, next)
tree.package.dependencies[childName] =
child.package._requested.rawSpec || child.package._requested.spec
}
child.directlyRequested = true
child.userRequired = true
child.save = saveToDependencies

// For things the user asked to install, that aren't a dependency (or
// won't be when we're done), flag it as "depending" on the user
// themselves, so we don't remove it as a dep that no longer exists
if (!addRequiredDep(tree, child)) {
replaceModuleName(child.package, '_requiredBy', '#USER')
child.directlyRequested = true
}
depLoaded(null, child, tracker)
}))
Expand Down
2 changes: 1 addition & 1 deletion lib/install/diff-trees.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function diffTrees (oldTree, newTree) {
if (npm.config.get('rebuild-bundle')) differences.push(['rebuild', pkg])
if (pkg.oldPkg) differences.push(['remove', pkg])
} else if (pkg.oldPkg) {
if (!pkg.directlyRequested && pkgAreEquiv(pkg.oldPkg.package, pkg.package)) return
if (!pkg.userRequired && pkgAreEquiv(pkg.oldPkg.package, pkg.package)) return
if (!pkg.isInLink && (isLink(pkg.oldPkg) || isLink(pkg))) {
differences.push(['update-linked', pkg])
} else {
Expand Down

0 comments on commit f5f166f

Please sign in to comment.