Conversation
|
Love to see this work 👀 Does it contain workspace support? |
|
Yes |
|
I will probably be able to implement it only with some restrictions. I don't think we can allow publishing packages with patched dependencies. pnpm cannot have two copies of the same package (with the same version) inside one node_modules (unless that package has peer dependencies). If we allow packages to be published with patched dependencies, then pnpm will have to be able to write different variations of the same package, as it may be patched in one of the dependencies and not patched in some other dependencies. I can implement something like the following, that you would put to the package.json of your project: {
"patchedDependencies": {
"express@3": "patches/express.patch"
}
}and it would patch all express v3 packages in the node_modules. |
patch-package requires the version is pinned. Allowing this board version might fail to patch the package at some time. (conflict changes) |
|
OK, the version can be pinned. But that version of the dependency will have to be patched in subdependencies as well. Not only when it is a direct dependency. |
9c08baa to
0c216bb
Compare
ae2d212 to
e05debe
Compare
|
I'll add the |
Jack-Works
left a comment
There was a problem hiding this comment.
In patch-package there is a really useful feature, you can modify packages in node_modules directly, and then run npx patch-package PACKAGE_NAME, it will compare the modified package with the original one and generate a patch file.
I'm wondering if pnpm is going to have this too. 👀
|
No, it will work as in Yarn with the Editing files inside node_modules is problematic because you would change the file in the store as well, when the file is a hard link. |
Just read the document of yarn, I found it is better! |
|
Next PR in progress: #4900 |
|
Super useful feature, thanks! Have recently been trialing this in a monorepo workflow, couple of issues:
|
TODO:
For creating the patch, we may probably use this library of Yarn: https://github.com/yarnpkg/berry/blob/82376c1b7b96ea894ca92a9c8b777bbc17535ea3/packages/plugin-patch/sources/patchUtils.ts#L279