Skip to content

option to re-sync files of injected workspace packages #9081

@KSXGitHub

Description

@KSXGitHub

Contribution

Describe the user story

Injected workspace packages don't have the best ergonomic. Workspace packages that have already been copied to the node_modules as relinks or hardlinks will no longer accept new files, this makes it difficult for them to work with workflows that require build steps (such as when working with TypeScript).

This issue may also apply to file: packages.

Related issue: #8975

Describe the solution you'd like

There should be an option to make pnpm automatically synchronize the files of injected packages after every build steps. For example: update-injected-packages-after-run=true. But not every command would write to the filesystem, maybe the option be a list of task names: update-injected-packages-after-run[]=build.

We can also provide a subcommand (e.g. pnpm sync-injected-packages) for the user to append to the end of their commands (e.g. "build": "tsc && pnpm sync-injected-packages"). This allows even more granular control, but with the drawback of no longer being able to pass additional arguments to the command via pnpm run.

The two proposals above are not mutually exclusive, we can implement both.

Describe the drawbacks of your solution

No response

Describe alternatives you've considered

There are user space packages that help workaround this problem:

The problem is, not only do they inherit the same drawback as the proposed pnpm sync-injected-packages would inherit, they are also 3rd party solutions, so they may fail to keep up with changes from pnpm.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions