Skip to content

Commit aa60d96

Browse files
paul-soporanSagnikPradhan
authored andcommitted
fix: add workaround so that pnpm@5 can pack regular packages
1 parent 5c1c4d8 commit aa60d96

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

packages/yarnpkg-core/sources/scriptUtils.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,6 @@ export async function prepareExternalProject(cwd: PortablePath, outputPath: Port
400400
}],
401401

402402
[PackageManager.Pnpm, async () => {
403-
const workspaceCli = workspace !== null
404-
? [`--filter`, workspace]
405-
: [];
406-
407403
const install = await execUtils.pipevp(`pnpm`, [`install`], {cwd, env, stdin, stdout, stderr, end: execUtils.EndStrategy.ErrorCode});
408404
if (install.code !== 0)
409405
return install.code;
@@ -418,7 +414,10 @@ export async function prepareExternalProject(cwd: PortablePath, outputPath: Port
418414

419415
// - `pnpm pack` doesn't support the `--filter` flag so we have to use `pnpm exec`
420416
// - We have to use the `--pack-destination` flag because otherwise pnpm generates the tarball inside the workspace cwd
421-
const packArgs = [...workspaceCli, `exec`, `pnpm`, `pack`, `--pack-destination`, npath.fromPortablePath(cwd)];
417+
// - Only pnpm@>=6.x supports the `--pack-destination` flag (and previous versions throw an error)
418+
const packArgs = workspace !== null
419+
? [`--filter`, workspace, `exec`, `pnpm`, `pack`, `--pack-destination`, npath.fromPortablePath(cwd)]
420+
: [`pack`];
422421

423422
const pack = await execUtils.pipevp(`pnpm`, packArgs, {cwd, env, stdin, stdout: packStream, stderr});
424423
if (pack.code !== 0)

0 commit comments

Comments
 (0)