fix(recursive): resolve directory deps correctly inside monorepo

ref #1253
This commit is contained in:
Zoltan Kochan
2018-07-04 00:37:24 +03:00
parent 7bde6a81c7
commit 8e6196b407
2 changed files with 28 additions and 1 deletions

View File

@@ -54,6 +54,33 @@ test('recursive install/uninstall', async (t: tape.Test) => {
await projects['project-2'].hasNot('is-negative')
})
// Created to cover the issue described in https://github.com/pnpm/pnpm/issues/1253
test('recursive install with package that has link', async (t: tape.Test) => {
const projects = preparePackages(t, [
{
name: 'project-1',
version: '1.0.0',
dependencies: {
'is-positive': '1.0.0',
'project-2': 'link:../project-2',
},
},
{
name: 'project-2',
version: '1.0.0',
dependencies: {
'is-negative': '1.0.0',
},
},
])
await execPnpm('recursive', 'install')
t.ok(projects['project-1'].requireModule('is-positive'))
t.ok(projects['project-1'].requireModule('project-2/package.json'))
t.ok(projects['project-2'].requireModule('is-negative'))
})
test('recursive update', async (t: tape.Test) => {
const projects = preparePackages(t, [
{

View File

@@ -727,7 +727,7 @@ async function installInContext (
linkToBin: opts.bin,
skipInstall: true,
}
const externalPkgs = installCtx.localPackages.map((localPackage) => localPackage.resolution.directory)
const externalPkgs = installCtx.localPackages.map((localPackage) => path.join(opts.prefix, localPackage.resolution.directory))
await externalLink(externalPkgs, installCtx.nodeModules, linkOpts)
}
}