Skip to content

Commit

Permalink
Revert "install: do not descend into directory deps' child modules"
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Aug 28, 2019
1 parent bd6e5d2 commit 176b8c1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 146 deletions.
20 changes: 6 additions & 14 deletions lib/install/inflate-shrinkwrap.js
Expand Up @@ -50,12 +50,8 @@ function inflateShrinkwrap (topPath, tree, swdeps, opts) {

return BB.each(Object.keys(swdeps), (name) => {
const sw = swdeps[name]
const dependencies = sw.dependencies || {}
const requested = realizeShrinkwrapSpecifier(name, sw, topPath)
// We should not muck about in the node_modules folder of
// symlinked packages. Treat its dependencies as if they
// were empty, since it's none of our business.
const dependencies = requested.type === 'directory' ? {}
: sw.dependencies || {}
return inflatableChild(
onDisk[name], name, topPath, tree, sw, requested, opts
).then((child) => {
Expand Down Expand Up @@ -145,10 +141,6 @@ function isGit (sw) {
}

function makeFakeChild (name, topPath, tree, sw, requested) {
// We should not muck about in the node_modules folder of
// symlinked packages. Treat its dependencies as if they
// were empty, since it's none of our business.
const isDirectory = requested.type === 'directory'
const from = sw.from || requested.raw
const pkg = {
name: name,
Expand All @@ -164,7 +156,7 @@ function makeFakeChild (name, topPath, tree, sw, requested) {
_spec: requested.rawSpec,
_where: topPath,
_args: [[requested.toString(), topPath]],
dependencies: isDirectory ? {} : sw.requires
dependencies: sw.requires
}

if (!sw.bundled) {
Expand All @@ -175,16 +167,16 @@ function makeFakeChild (name, topPath, tree, sw, requested) {
}
const child = createChild({
package: pkg,
loaded: isDirectory,
loaded: true,
parent: tree,
children: [],
fromShrinkwrap: requested,
fakeChild: sw,
fromBundle: sw.bundled ? tree.fromBundle || tree : null,
path: childPath(tree.path, pkg),
realpath: isDirectory ? requested.fetchSpec : childPath(tree.realpath, pkg),
realpath: requested.type === 'directory' ? requested.fetchSpec : childPath(tree.realpath, pkg),
location: (tree.location === '/' ? '' : tree.location + '/') + pkg.name,
isLink: isDirectory,
isLink: requested.type === 'directory',
isInLink: tree.isLink || tree.isInLink,
swRequires: sw.requires
})
Expand All @@ -203,7 +195,7 @@ function fetchChild (topPath, tree, sw, requested) {
var isLink = pkg._requested.type === 'directory'
const child = createChild({
package: pkg,
loaded: isLink,
loaded: false,
parent: tree,
fromShrinkwrap: requested,
path: childPath(tree.path, pkg),
Expand Down
6 changes: 1 addition & 5 deletions test/tap/install-from-local-multipath.js
Expand Up @@ -167,13 +167,9 @@ test('\'npm install\' should install local packages', function (t) {
'install', '.'
],
EXEC_OPTS,
function (err, code, stdout, stderr) {
function (err, code) {
t.ifError(err, 'error should not exist')
t.notOk(code, 'npm install exited with code 0')
// if the test fails, let's see why
if (err || code) {
console.error({code, stdout, stderr})
}
t.end()
}
)
Expand Down
127 changes: 0 additions & 127 deletions test/tap/install-symlink-leave-children-alone.js

This file was deleted.

0 comments on commit 176b8c1

Please sign in to comment.