-
-
Notifications
You must be signed in to change notification settings - Fork 313
Add --ignore-missing flag to continue without error on missing packages #460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
karlhorky
commented
May 7, 2023
@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.
zhanghengxin
commented
Jun 13, 2023
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
@ 0779cba
bertrand-caron-cascade
commented
May 6, 2025
Did this ever get merged?
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