Skip to content

publishConfig.directory does not get symlinked for workspace packages if the directory does not exist #5219

@michaelwarren1106

Description

@michaelwarren1106

When a package in a monorepo is depended on by other packages, and has the following publishConfig settings in package.json:

{
  "publishConfig: {
    "directory": "dist",
    "linkDirectory: true
  }
}

the symlink only gets created if the dist folder actually exists.

This setting breaks repos that follow a typical install => link => build model. Monorepos with lots of cross-repo dependencies cannot successfully build dists without upstream local dependencies also being built first.

pnpm version:

7.9.0

Code to reproduce the issue:

Repro repo here:
https://github.com/michaelwarren1106/pnpm-linking-repro
Steps to reproduce the issue are in the README.md

Expected behavior:

Symlinks are created for the specified publishConfig.directory path (including a package scope directory if necessary) regardless of whether or not the specified directory exists.

Actual behavior:

Symlinks are not created if the specified publishConfig.directory folder does not exist. Warnings are seen in the console instead.

Related issues

#5115
#3901

Related Discussion

#5204 (reply in thread)

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions