diff options
author | Julian Gruber <julian@juliangruber.com> | 2014-05-02 12:13:22 +0400 |
---|---|---|
committer | Domenic Denicola <domenic@domenicdenicola.com> | 2014-05-12 01:51:34 +0400 |
commit | 48d8353ac8ee8270019ce1ee34336c74a38cc42e (patch) | |
tree | 3b16c51be7f502ceb576b466b36db2a7c2d96b75 /node_modules/read-installed | |
parent | 7ca9e7eca5f9a5e14d5b68859fef62a8e6a89cd3 (diff) |
read-installed@2.0.3
peer dependencies can be satisfied by grandparent
Diffstat (limited to 'node_modules/read-installed')
4 files changed, 39 insertions, 3 deletions
diff --git a/node_modules/read-installed/package.json b/node_modules/read-installed/package.json index 41a980f76..566736ca5 100644 --- a/node_modules/read-installed/package.json +++ b/node_modules/read-installed/package.json @@ -1,7 +1,7 @@ { "name": "read-installed", "description": "Read all the installed packages in a folder, and return a tree structure with all the data.", - "version": "2.0.2", + "version": "2.0.3", "repository": { "type": "git", "url": "git://github.com/isaacs/read-installed" @@ -35,6 +35,6 @@ "url": "https://github.com/isaacs/read-installed/issues" }, "homepage": "https://github.com/isaacs/read-installed", - "_id": "read-installed@2.0.2", + "_id": "read-installed@2.0.3", "_from": "read-installed@latest" } diff --git a/node_modules/read-installed/read-installed.js b/node_modules/read-installed/read-installed.js index a33758b17..43ba994c8 100644 --- a/node_modules/read-installed/read-installed.js +++ b/node_modules/read-installed/read-installed.js @@ -331,7 +331,11 @@ function findUnmet (obj, opts) { obj.dependencies[d] = peerDeps[d] } } else { - dependency = obj.parent.dependencies && obj.parent.dependencies[d] + var r = obj.parent + while (r && !dependency) { + dependency = r.dependencies && r.dependencies[d] + r = r.link ? null : r.parent + } } if (!dependency) { diff --git a/node_modules/read-installed/test/fixtures/grandparent-peer/package.json b/node_modules/read-installed/test/fixtures/grandparent-peer/package.json new file mode 100644 index 000000000..51c12935f --- /dev/null +++ b/node_modules/read-installed/test/fixtures/grandparent-peer/package.json @@ -0,0 +1,8 @@ +{ + "name": "example", + "version": "0.0.0", + "dependencies": { + "plugin-wrapper": "0.0.0", + "framework": "0.0.0" + } +} diff --git a/node_modules/read-installed/test/grandparent-peer.js b/node_modules/read-installed/test/grandparent-peer.js new file mode 100644 index 000000000..8b51a0985 --- /dev/null +++ b/node_modules/read-installed/test/grandparent-peer.js @@ -0,0 +1,24 @@ +var readInstalled = require('../read-installed.js') +var test = require('tap').test +var path = require('path'); + +function allValid(t, map) { + var deps = Object.keys(map.dependencies || {}) + deps.forEach(function (dep) { + t.notOk(map.dependencies[dep].invalid, 'dependency ' + dep + ' of ' + map.name + ' is not invalid') + t.notOk(typeof map.dependencies[dep] === 'string', 'dependency ' + dep + ' of ' + map.name + ' is not missing') + }) + deps.forEach(function (dep) { + allValid(t, map.dependencies[dep]) + }) +} + +test('grandparent can satisfy peer dependencies', function(t) { + readInstalled( + path.join(__dirname, 'fixtures/grandparent-peer'), + { log: console.error }, + function(err, map) { + allValid(t, map) + t.end() + }) +}) |