Tools: Fix unresolvable conflicts computation in package sync script.

Computation of unresolvable version conflicts in the Gutenberg package
sync script had a few issues that were causing it to fail, among them
two type errors in the destructuring of function arguments.
Furthermore, de-duplication of required package versions was missing,
leading to false positives being reported, when multiple instances of
the same package all required the same version.

Props dmsnell.
Fixes #58628.

git-svn-id: https://develop.svn.wordpress.org/trunk@56035 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Bernie Reiter 2023-06-26 15:41:25 +00:00
parent 7e6cd72166
commit fbc337d7b2

View File

@ -120,8 +120,8 @@ function getMismatchedNonWordPressDependencies() {
;
// Ensure that all the conflicts can be resolved with the same version
const unresolvableConflicts = Object.entries( groupBy( versionConflicts, ( [name] ) => name ) )
.map( ( [name, group] ) => [name, group.map( ( [, { required }] ) => required )] )
const unresolvableConflicts = Object.entries( groupBy( versionConflicts, ( {name} ) => name ) )
.map( ( [name, group] ) => [name, uniq( group.map( ( { required } ) => required ) )] )
.filter( ( [, group] ) => group.length > 1 );
if ( unresolvableConflicts.length > 0 ) {
console.error( "Can't resolve some conflicts automatically." );