Skip to content

Commit

Permalink
Update to pnpm v9 (#37720)
Browse files Browse the repository at this point in the history
It's been out for a while, and people are starting to get confused
again when installing the latest version doesn't work.

Additional changes:
* Drop pnpmfile hack preventing webpack without webpack-cli, the issue
  it was avoiding has been fixed.
* New lock file format.
* No need for hacks to get the lock file updated after editing pnpmfile
  anymore.
  • Loading branch information
anomiex authored and dilirity committed Jun 11, 2024
1 parent 4ae741f commit e89874c
Show file tree
Hide file tree
Showing 5 changed files with 12,210 additions and 9,433 deletions.
2 changes: 1 addition & 1 deletion .github/versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
PHP_VERSION=8.2
COMPOSER_VERSION=2.7.1
NODE_VERSION=20.8.1
PNPM_VERSION=8.6.8
PNPM_VERSION=9.2.0

# Other useful version numbers.
MIN_PHP_VERSION=7.0
Expand Down
17 changes: 3 additions & 14 deletions .pnpmfile.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Note if you change something here, you'll have to make a package.json mismatch pnpm-lock.yaml to
// get it re-run. An easy way to do that is to just edit pnpm-lock.yaml to change the version number
// of husky near the top.

/**
* Fix package dependencies.
*
Expand Down Expand Up @@ -179,20 +175,13 @@ function afterAllResolved( lockfile ) {
return lockfile;
}

// eslint-disable-next-line no-unused-vars -- Don't care.
for ( const [ k, v ] of Object.entries( lockfile.packages ) ) {
// Forbid installing webpack without webpack-cli. It results in lots of spurious lockfile changes.
// https://github.com/pnpm/pnpm/issues/3935
if ( k.startsWith( '/webpack/' ) && ! v.dependencies[ 'webpack-cli' ] ) {
throw new Error(
"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.' )
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.'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@
},
"engines": {
"node": "^20.8.1",
"pnpm": "^8.6.2"
"pnpm": "^9.2.0"
}
}
Loading

0 comments on commit e89874c

Please sign in to comment.