Merge pull request #99 from tgunnoe/git-plus-resolved

fix: parse resolved keys with git+https correctly
This commit is contained in:
DavHau 2022-03-12 14:15:18 +07:00 committed by GitHub
commit 83c1d872d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,7 +100,8 @@
|| (dObj
? resolved
&& lib.hasInfix "codeload.github.com/" dObj.resolved)
|| lib.hasInfix "@git+" dObj.yarnName
|| (lib.hasInfix "@git+" dObj.yarnName
|| lib.hasPrefix "git+" dObj.resolved)
# example:
# "jest-image-snapshot@https://github.com/machard/jest-image-snapshot#machard-patch-1":
# version "4.2.0"
@ -141,7 +142,9 @@
extractors = {
name = rawObj: finalObj:
if lib.hasInfix "@git+" rawObj.yarnName
if
(lib.hasInfix "@git+" rawObj.yarnName
|| lib.hasPrefix "git+" rawObj.resolved)
then lib.head (lib.splitString "@git+" rawObj.yarnName)
# Example:
# @matrix-org/olm@https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.3.tgz
@ -161,7 +164,7 @@
split = l.splitString "@git+" rawObj.yarnName;
gitUrl = l.last split;
in
# l.strings.sanitizeDerivationName
l.strings.sanitizeDerivationName
"${rawObj.version}@git+${gitUrl}"
else rawObj.version;