Update npm6 to allow for better semver handling#4460
Update npm6 to allow for better semver handling#4460devpow112 wants to merge 3 commits intodependabot:mainfrom devpow112:patch-1
semver handling#4460Conversation
semver detectionsemver handling
lseppala
left a comment
There was a problem hiding this comment.
Thanks for your contribution! This seems reasonable and seems to do as you describe. Because this is change that could have significant impact, we'll want to test this on a repo before merging—thanks again for providing a test repository we can do this with. I'll report back with results later.
I think it might make sense to test this behavior by adding a test to the updater test file. Would you mind doing so? I may be able to help later.
|
@lseppala for sure. I'll work on adding some tests to the updater file stuff as well as looking at why the latest test runs failed. Thanks for taking a look. |
|
With regards to the test failure, there was an external dependency we used in testing that had drifted. We corrected this in #4466. Update your branch with the latest in |
Often when using git, github or gitlab style
semverdependencies with npm (ex,github:Brightspace/d2l-activity-alignments#semver:^2) the tags/branches associated with the repository can be for the formv[major].[minor].[patch](common if following standardsemverset-up s and automated tooling such assemantic-release) or[major].[minor].[patch]. Thesemverkeyword allows for variance of branch name allowingv3.0.0and3.0.0to be treated as the same version allowing these dependency checks to succeed. When not using thesemverkeyword in the dependency install command the resolved version will be treated as needing to be an exact match for a branch/tag name. This change adjust the install command used to update package lock file to include thesemverkeyword whenever it's present in the existing requirement which allows this variance in branch naming to be allowed. Once this change is done we also need to repair thefromproperties of the installed dependencies since they will no longer match the existing requirement in thepackage.jsonfile (repairgithub:Brightspace/d2l-activity-alignments#semver:3.0.0togithub:Brightspace/d2l-activity-alignments#semver:^3).Example of something that wouldn't work before
The
github:Brightspace/d2l-activity-alignments#semver:^2dependency is attempting to be updated togithub:Brightspace/d2l-activity-alignments#semver:^3which results in the install command ofThis causes a git error since the branch on the target repository is
v3.0.0.After change
The
github:Brightspace/d2l-activity-alignments#semver:^2dependency is attempting to be updated togithub:Brightspace/d2l-activity-alignments#semver:^3which results in the install command ofThis succeeds even though the tag name is
v3.0.0.Notes
Repository used for testing of changes along side existing tests https://github.com/devpow112/dependabot-core-test. This would just throw errors when trying to run dependabot