Skip to content

Commit

Permalink
Update wordpress monorepo (#37669)
Browse files Browse the repository at this point in the history
* Update wordpress monorepo
* Pnpmfile hack for `@wordpress/primitives` missing `react` dep
* jest: Mock `client-zip`, it doesn't even try to work with jest.
* Update tests for WordPress/gutenberg#61366
* Don't upgrade `@wordpress/dependency-extraction-webpack-plugin` past 5.9.0
* Add pnpmfile hack to prevent accidentally re-updating `@wordpress/dependency-extraction-webpack-plugin`.
* Update `@automattic/social-previews` pnpmfile hack to avoid duplicate `@wordpress/*` package versions.

---------

Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Brad Jorsch <[email protected]>
  • Loading branch information
3 people authored Jun 4, 2024
1 parent 8d2874b commit 3273e03
Show file tree
Hide file tree
Showing 105 changed files with 2,004 additions and 1,796 deletions.
29 changes: 21 additions & 8 deletions .pnpmfile.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@
* @returns {object} Modified pkg.
*/
function fixDeps( pkg ) {
// Outdated dep. Already fixed upstream, just waiting on a release.
// https://github.com/Automattic/wp-calypso/pull/87350
if (
pkg.name === '@automattic/social-previews' &&
pkg.dependencies?.[ '@wordpress/components' ] === '^26.0.1'
) {
pkg.dependencies[ '@wordpress/components' ] = '>=26.0.1';
// Deps tend to get outdated due to a slow release cycle.
// So change `^` to `>=` and hope any breaking changes will not really break.
if ( pkg.name === '@automattic/social-previews' ) {
for ( const [ dep, ver ] of Object.entries( pkg.dependencies ) ) {
if ( dep.startsWith( '@wordpress/' ) && ver.startsWith( '^' ) ) {
pkg.dependencies[ dep ] = '>=' + ver.substring( 1 );
}
}
}

// Missing dep or peer dep on react.
// https://github.com/WordPress/gutenberg/issues/55171
// https://github.com/WordPress/gutenberg/issues/62250
if (
pkg.name === '@wordpress/icons' &&
( pkg.name === '@wordpress/icons' || pkg.name === '@wordpress/primitives' ) &&
! pkg.dependencies?.react &&
! pkg.peerDependencies?.react
) {
Expand Down Expand Up @@ -185,6 +187,17 @@ function afterAllResolved( lockfile ) {
"Something you've done is trying to add a dependency on webpack without webpack-cli.\nThis is not allowed, as it tends to result in pnpm lockfile flip-flopping.\nSee https://github.com/pnpm/pnpm/issues/3935 for the upstream bug report."
);
}

// Forbid `@wordpress/dependency-extraction-webpack-plugin` v6 until WP 6.5 support is dropped.
// https://github.com/WordPress/gutenberg/issues/62202
if (
k.startsWith( '/@wordpress/dependency-extraction-webpack-plugin/' ) &&
! k.startsWith( '/@wordpress/dependency-extraction-webpack-plugin/5.' )
) {
throw new Error(
'@wordpress/dependency-extraction-webpack-plugin >= 6.0.0 is not allowed until we drop WordPress 6.5 support.\nSee https://github.com/WordPress/gutenberg/issues/62202 for details.'
);
}
}
return lockfile;
}
Expand Down
Loading

0 comments on commit 3273e03

Please sign in to comment.