@@ -51,7 +51,7 @@ export interface DependencyVersionComparison {
5151 description : ValueComparison < string > ;
5252 author : ValueComparison < Maintainer > ;
5353 engines : DictionaryComparison < string > ;
54- repository : ValueComparison < Repository > ;
54+ repository : ValueComparison < Repository | string | undefined > ;
5555 scripts : DictionaryComparison < string > ;
5656 warnings : ArrayDiff < Warning > ;
5757 composition : CompositionComparison ;
@@ -166,9 +166,7 @@ function compareVersions(
166166 author : version . author && comparedVersion . author ? compareObjects ( "name" , version . author , comparedVersion . author ) : void 0 ,
167167 // @ts -ignore
168168 engines : compareDictionnaries ( version . engines , comparedVersion . engines ) ,
169- // FIXME: repository can be a string: https://github.com/pillarjs/encodeurl/blob/master/package.json#L14
170- repository : compareObjects ( "type" , version . repository , comparedVersion . repository )
171- ?? compareObjects ( "url" , version . repository , comparedVersion . repository ) ,
169+ repository : compareRepositories ( version . repository , comparedVersion . repository ) ,
172170 scripts : compareDictionnaries ( version . scripts , comparedVersion . scripts ) ,
173171 warnings : arrayDiff ( version . warnings , comparedVersion . warnings ) ,
174172 composition : compareComposition ( version . composition , comparedVersion . composition ) ,
@@ -312,3 +310,15 @@ export function arrayOfObjectsDiffByKey<T extends Record<string, any>>(
312310
313311 return { added, removed } ;
314312}
313+
314+ function compareRepositories (
315+ original : DependencyVersion [ "repository" ] ,
316+ toCompare : DependencyVersion [ "repository" ]
317+ ) : ValueComparison < Repository | string | undefined > {
318+ if ( typeof original === "string" || typeof toCompare === "string" ) {
319+ return compareValues ( original , toCompare ) ;
320+ }
321+
322+ return compareObjects ( "type" , original , toCompare )
323+ ?? compareObjects ( "url" , original , toCompare ) ;
324+ }
0 commit comments