Open andyjy opened 1 year ago
@ds300 what do you think about this one? Would be very useful :)
@ds300 I saw you approved a CI run that failed all jobs during setup - looks to have been unrelated to my changes; I've just updated against latest master branch which seems should fix the CI workflows (?🤞)
Glad to update this PR with changes if you'd like to accept it conditional on feedback. Thanks!
Update 2023-07-03: PR now updated to support setting env var PATCH_PACKAGE_IGNORE_MISSING=1
so missing packages can easily be ignored during deployment (due to pruned dependencies) but alerted during development (due to updating dependencies without also updating relevant patches).
Original comment:
I realise this feature as-implemented is "dangerous" - within a monorepo, a future update to the package-lock file may relocate a package out from the root node_modules
folder into one or more nested node_modules
folders under an individual workspace/subpackage.
Currently patch-package
will error when this occurs, drawing attention to fact the current patch is now against a "missing" package. This PR will currently switch that behaviour to subtly reporting as missing when the --ignore-missing
flag is specified, which is easy to miss and not the desired behaviour for such circumstances.
I suspect a workable approach is to update the support for --ignore-missing
to (instead?) be set via an environment variable - this can then be set at deploy time (when some packages may be missing as expected due to deploying with pruned dependencies) but error locally and during CI when we expect all packages to be present.
guys, you can do it according to the following in packages.json.
"installConfig": { "hoistingLimits": "workspaces" }
guys, you can do it according to the following in packages.json.
"installConfig": { "hoistingLimits": "workspaces" }
thanks, it looks like that's a feature of yarn only - not npm
I realise this feature as-implemented is "dangerous"
PR now updated to support setting the env var PATCH_PACKAGE_IGNORE_MISSING=1
so this can be set at deploy time (when some packages may be missing as expected due to deploying with pruned dependencies) but error during local development and CI when we expect all packages to be present.
I left the CLI option --ignore-missing
for now, but could remove that if preferred.
I've published this fork under patch-package-ignore-missing - version 7.0.1-2
is up to date with patch-package
@ https://github.com/ds300/patch-package/commit/0779cbafefc5241ba53f6eb6fb3b94ee398e037a
Ignores patches for packages that are not present in node_modules.
This is useful when working with monorepos and wanting to install sub-packages separately from the root package, with pruned dependencies.
Closes #339