-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Bugfix 3306: Check top level patterns during integrity check #3811
Conversation
src/cli/commands/install.js
Outdated
if (!match.integrityMatches && match.integrityError == 'PATTERNS_DONT_MATCH') { | ||
this.reporter.warn(this.reporter.lang('integrityPatternsDontMatch')); | ||
this.reporter.info(this.reporter.lang('uninstallRegenerate')); | ||
this.flags.force = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we should force here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, should the install command not regenerate the lockfile then, and instead just display a warning in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should cleanup lockfile, yes.
Just force may mean more things like forcing rebuilding binary dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably the logic for missing dependencies should be done not in bailout function but where the lockfile is saved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. I'll try that out instead.
Thanks, @aracarie. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix!
Prettier still complains.
Please rebase, run yarn install && yarn prettier
.
After CI is green it is ready to be merged
👍 done |
Summary
Fixes issue 3306. Previously changes to the package.json dependencies would not throw an error during integrity checks, unless there were zero dependencies, in which case an empty yarn.lock would be written.
A condition was added to the integrity checker for top level patterns. If the top level patterns are not the same, the install task will continue running with the force flag set, as would be done with a reinstall after a package was removed.
yarn check --integrity
is also affected by this, and will return an error if the top level patterns don't match those specified in the package.json.Test plan
Before:
After: