PackageLockJsonTest update to allow for transitive dependencies with "npm:" alias prefix#2995
Merged
Conversation
…o ALLOWED_NONSTANDARD_VERSIONS
…"npm:" alias prefix
labkey-tchad
approved these changes
May 13, 2026
| { | ||
| String tVer = transitiveDeps.optString(tDep); | ||
| if (tVer == null || tVer.contains(":") && !ALLOWED_NONSTANDARD_VERSIONS.contains(tVer)) // URL, file, or workspace dependency | ||
| if (tVer == null || (tVer.contains(":") && !tVer.startsWith("npm:"))) // URL, file, or workspace dependency |
Member
There was a problem hiding this comment.
Not sure it really matters but maybe make this trim off the "npm:" instead of just skipping any versions starting with it.
Suggested change
| if (tVer == null || (tVer.contains(":") && !tVer.startsWith("npm:"))) // URL, file, or workspace dependency | |
| if (tVer == null || tVer.replaceAll("^npm:", "").contains(":")) // URL, file, or workspace dependency |
labkey-alan
approved these changes
May 13, 2026
labkey-tchad
approved these changes
May 13, 2026
Member
labkey-tchad
left a comment
There was a problem hiding this comment.
I piggy-backed some logging improvements but this change looks ok to me.
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.
Rationale
This PR updates PackageLockJsonTest to allow transitive dependency version strings that use npm's package alias syntax (
npm:<package>@<range>). The original approach used a hardcoded allowlist of three specific aliases from@isaacs/cliui; the new approach allows any version string starting withnpm:, which is more general and won't need updating when new npm aliases appear in lock files.Changes