-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Contribution
- I'd be willing to implement this feature (contributing guide)
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:
- https://github.com/tiktok/pnpm-sync
- https://www.npmjs.com/package/pnpm-sync-dependencies-meta-injected
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.