mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-28 03:51:40 -04:00
feat(cli-link): link multiple packages at once
allows `pnpm link pkg1 pkg2` issue 825 changes
This commit is contained in:
@@ -10,12 +10,14 @@ export default (input: string[], opts: PnpmOptions & {globalPrefix: string}) =>
|
||||
return linkToGlobal(cwd, opts)
|
||||
}
|
||||
|
||||
// pnpm link ../foo
|
||||
if (input[0].indexOf('.') === 0) {
|
||||
const linkFrom = path.join(cwd, input[0])
|
||||
return link(linkFrom, cwd, opts)
|
||||
}
|
||||
return input.reduce((previous: Promise<void>, inp: string) => {
|
||||
// pnpm link ../foo
|
||||
if (inp[0].indexOf('.') === 0) {
|
||||
const linkFrom = path.join(cwd, inp)
|
||||
return previous.then(link.bind(null, linkFrom, cwd, opts))
|
||||
}
|
||||
|
||||
// pnpm link foo
|
||||
return linkFromGlobal(input[0], cwd, opts)
|
||||
// pnpm link foo
|
||||
return previous.then(linkFromGlobal.bind(null, inp, cwd, opts))
|
||||
}, Promise.resolve())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user