Build Tools: Validate package-lock.json for "resolved" errors#22237
Merged
Build Tools: Validate package-lock.json for "resolved" errors#22237
Conversation
5 tasks
jorgefilipecosta
approved these changes
May 8, 2020
Member
jorgefilipecosta
left a comment
There was a problem hiding this comment.
LGTM 👍 Nice verification, I verified the error triggers when expected.
Member
|
Unfortunately it seems on travis we get "bin/validate-package-lock.js(19,30): error TS2307: Cannot find module '../package-lock'.", so the json file is not read as expected. |
Member
Author
|
@jorgefilipecosta Yeah, funny enough, quite similar to very recent discussion with @sirreal at #19866 (comment) . I think a |
Member
|
On the wp-scripts package we read JSON files with: Maybe using this approach works on travis? |
|
Size Change: +89 B (0%) Total Size: 824 kB
ℹ️ View Unchanged
|
Member
|
Travis is green I guess we can merge :) |
Contributor
|
🎉 |
Member
|
Nice one, thanks for working on it 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Slack discussion (link requires registration): https://wordpress.slack.com/archives/C02QB2JS7/p1588692036240600
Related upstream issue: npm/cli#1138
Previously:
This pull request seeks to add a pre-commit and continuous integration build step for validating the contents of
package-lock.json. Notably, this is intended to try to capture issues where an invalidresolvedvalue becomes introduced inpackage-lock.json. The scriptbin/validate-package-lock.jswill deeply check the contents of the lockfile for anyresolved: false.The idea for this change proposal was inspired by @adamziel 's comment at #21873 (comment).
Testing Instructions:
Introduce
"resolved": falsein a dependency inpackage-lock.json(manually) and attempt to commit the change. Observe an error.