Make WordPress Core

Opened 11 months ago

Closed 11 months ago

Last modified 10 months ago

#58628 closed defect (bug) (fixed)

Tools: Gutenberg package sync script fails

Reported by: bernhard-reiter's profile Bernhard Reiter Owned by: bernhard-reiter's profile Bernhard Reiter
Milestone: 6.3 Priority: normal
Severity: normal Version: 6.3
Component: Build/Test Tools Keywords: has-patch
Focuses: Cc:

Description

Running npm run sync-gutenberg-packages -- --dist-tag=wp-6.3 currently results in the following error:

~/src/wordpress-develop/tools/release/sync-gutenberg-packages.js:126
		.map( ( [name, group] ) => [name, group.map( ( [, { required }] ) => required )] )
		                                             ^

TypeError: undefined is not a function

after which script execution resumed, thus typically hiding the error behind a lot of other output.

However, this results in package.json not being updated with the expected version bumps.

Change History (8)

This ticket was mentioned in PR #4701 on WordPress/wordpress-develop by @Bernhard Reiter.


11 months ago
#1

Running npm run sync-gutenberg-packages -- --dist-tag=wp-6.3 would currently result in the following error:

~/src/wordpress-develop/tools/release/sync-gutenberg-packages.js:126
		.map( ( [name, group] ) => [name, group.map( ( [, { required }] ) => required )] )
		                                             ^

TypeError: undefined is not a function

after which script execution resumed, thus typically hiding the error behind a lot of other output.
It would, however, result in package.json not being updated with the expected version bumps.

This PR attempts to fix that logic.

### Testing Instructions

  • On trunk, run npm run sync-gutenberg-packages -- --dist-tag=wp-6.3. Scroll up near the start of the resulting output and verify that the above warning is present. Furthermore, verify that package.json is unchanged after running the script.
  • Switch to this branch, and re-run that command. Verify that the warning doesn't appear this time around, and that package.json is indeed changed. (Note that only three or so third-party dependencies' versions are changed, whereas no @wordpress/ packages are; this is due to a separate issue.)

Trac ticket: https://core.trac.wordpress.org/ticket/58628

@dmsnell commented on PR #4701:


11 months ago
#2

Tested with node version v18.14.2

in trunk

Running "wp-packages:refresh-deps" task
Updating versions of dependencies listed in package.json (--dist-tag=wp-6.3)
/Users/dmsnell/code/WordPress-develop/tools/release/sync-gutenberg-packages.js:123
	const unresolvableConflicts = Object.entries( groupBy( versionConflicts, ( [name] ) => name ) )
	                                                                         ^

TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator))
    at /Users/dmsnell/code/WordPress-develop/tools/release/sync-gutenberg-packages.js:123:75

in this branch

Running "wp-packages:refresh-deps" task
Updating versions of dependencies listed in package.json (--dist-tag=wp-6.3)
The following dependencies are outdated:
[
  { name: 'uuid', required: '8.3.2', actual: '9.0.0' },
  { name: 'is-plain-object', required: '5.0.0', actual: '2.0.4' },
  { name: 'uuid', required: '8.3.2', actual: '9.0.0' },
  { name: 'path-to-regexp', required: '6.2.1', actual: '0.1.7' },
  { name: 'uuid', required: '8.3.2', actual: '9.0.0' },
  { name: 'uuid', required: '8.3.2', actual: '9.0.0' },
  { name: 'is-plain-object', required: '5.0.0', actual: '2.0.4' },
  { name: 'is-plain-object', required: '5.0.0', actual: '2.0.4' },
  { name: 'is-plain-object', required: '5.0.0', actual: '2.0.4' }
]

@Bernhard Reiter commented on PR #4701:


11 months ago
#3

Thank you @dmsnell!

Tested with node version v18.14.2

in trunk

[...]
TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator))

Right, that's the error message with Node 16 and later; mine was with v14. I should've mentioned that.

in this branch

That message is expected ✅

#4 @Bernhard Reiter
11 months ago

  • Owner set to Bernhard Reiter
  • Resolution set to fixed
  • Status changed from new to closed

In 56035:

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.

@Bernhard Reiter commented on PR #4701:


11 months ago
#5

Committed to wordpress-develop in https://core.trac.wordpress.org/changeset/56035.

@Bernhard Reiter commented on PR #4701:


11 months ago
#6

Committed to wordpress-develop in https://core.trac.wordpress.org/changeset/56035.

@ramonopoly commented on PR #4701:


11 months ago
#7

Huge thanks for stepping in @ockham and @dmsnell 🙇

#8 @peterwilsoncc
10 months ago

I'm seeing this on the 6.2 branch, could I please get a logic check that others are too?

If it's a general problem then it may be worth backporting the patch for the purpose of any security releases that may need to sync scripts.

Note: See TracTickets for help on using tickets.