fix(clojure): Prioritize Maven-based deps over git-based ones (#15720)

This commit is contained in:
Sergei Zharinov 2022-05-25 08:48:44 +03:00 committed by GitHub
parent f86f9f5e75
commit c18c55e97c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 9 deletions

View file

@ -3,6 +3,7 @@
,,,,persistent-sorted-set,{:mvn/version,"0.1.2"}
invalid/package! {:mvn/version "1.2.3"}
invalid/version nil
io.github.nextjournal/clerk {:mvn/version "0.7.418"}
}
:aliases {

View file

@ -14,6 +14,18 @@ Array [
],
"replaceString": "{:mvn/version,\\"0.1.2\\"}",
},
Object {
"currentValue": "0.7.418",
"datasource": "clojure",
"depName": "io.github.nextjournal/clerk",
"packageName": "io.github.nextjournal:clerk",
"registryUrls": Array [
"https://deps.com/foo/bar",
"https://my.auth.com/repo",
"s3://my-bucket/maven/releases",
],
"replaceString": "{:mvn/version \\"0.7.418\\"}",
},
Object {
"currentValue": "1.9.0",
"datasource": "clojure",

View file

@ -123,6 +123,9 @@ Object {
"mvn/version": "1.2.3",
},
"invalid/version": "nil",
"io.github.nextjournal/clerk": Object {
"mvn/version": "0.7.418",
},
"persistent-sorted-set": Object {
"mvn/version": "0.1.2",
},

View file

@ -20,6 +20,11 @@ describe('modules/manager/deps-edn/extract', () => {
's3://my-bucket/maven/releases',
],
},
{
depName: 'io.github.nextjournal/clerk',
currentValue: '0.7.418',
datasource: 'clojure',
},
{ depName: 'org.clojure/clojure', currentValue: '1.9.0' },
{ depName: 'org.clojure/clojure', currentValue: '1.10.0' },
{ depName: 'org.clojure/clojurescript', currentValue: '1.10.520' },

View file

@ -151,6 +151,15 @@ function extractDependency(
dep.depType = depType;
}
const mvnVersion = val['mvn/version'];
if (is.string(mvnVersion)) {
dep.datasource = ClojureDatasource.id;
dep.currentValue = mvnVersion;
dep.packageName = packageName.replace('/', ':');
dep.registryUrls = [...mavenRegistries];
return dep;
}
resolveGitPackageFromEdnVal(dep, val);
resolveGitPackageFromEdnKey(dep, key);
@ -169,15 +178,6 @@ function extractDependency(
return dep;
}
const mvnVersion = val['mvn/version'];
if (is.string(mvnVersion)) {
dep.datasource = ClojureDatasource.id;
dep.currentValue = mvnVersion;
dep.packageName = packageName.replace('/', ':');
dep.registryUrls = [...mavenRegistries];
return dep;
}
return null;
}