Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only prune when it's safe to do so #1238

Merged
merged 1 commit into from
Apr 11, 2024
Merged

Conversation

colincasey
Copy link
Contributor

Prior to the pnpm 8.15.6 release, whenever pnpm prune would execute it would also execute any preinstall or postinstall scripts in package.json. This can cause build failures in applications that use these scripts along with dev dependencies (e.g.; the Nuxt starter project does this).

To prevent this case, pruning will only be performed if:

  • pnpm < 8.15.6 and there are no preinstall or postinstall scripts registered
  • pnpm >= 8.15.6

If the above conditions are not met, a helpful warning will be shown and pruning will be skipped.

@colincasey colincasey added the skip changelog Changelog entry is not required - Skips changelog check label Apr 4, 2024
@colincasey colincasey self-assigned this Apr 4, 2024
@colincasey colincasey requested a review from a team as a code owner April 4, 2024 20:01
@colincasey colincasey mentioned this pull request Apr 4, 2024
lib/dependencies.sh Outdated Show resolved Hide resolved
lib/failure.sh Outdated Show resolved Hide resolved
@colincasey colincasey merged commit f5a24c4 into pnpm_support Apr 11, 2024
9 checks passed
@colincasey colincasey deleted the pnpm_support_pruning branch April 11, 2024 15:02
colincasey added a commit that referenced this pull request Apr 11, 2024
colincasey added a commit that referenced this pull request Apr 29, 2024
colincasey added a commit that referenced this pull request Apr 29, 2024
colincasey added a commit that referenced this pull request Apr 29, 2024
* pnpm support

These changes build on top of [existing corepack support](#1222) to allow `pnpm` to be installed via [Corepack](https://nodejs.org/docs/latest/api/corepack.html).

The build process has also been modified use the `pnpm` binary at the following stages:
- installing dependencies
- running build scripts:
  - `heroku-prebuild`
  - `build` (or `heroku-postbuild`)
  - `heroku-cleanup`
- pruning dev dependencies

* Prune the pnpm store periodically (#1231)

* Multiple lockfiles error (#1228)

These changes build on top of [existing pnpm support](#1224) and modify the failure message shown when multiple lockfiles are detected to now include pnpm.

* Add pnpm caching (#1225)

These changes build on top of [existing pnpm support](#1224) to allow `pnpm` dependencies to be saved and restored between builds.

* pnpm support (default version) (#1226)

These changes build on top of [existing pnpm support](#1224) to default to the `latest` version when it appears that pnpm should be used but there is no `engines.pnpm` or `packageManager` specified in `package.json`.

* pnpm support engines (#1227)

These changes build on top of [existing pnpm support](#1224) to use the version specified by the `engines.pnpm` field in `package.json`.

* Only prune when it's safe to do so (#1238)

* Update CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip changelog Changelog entry is not required - Skips changelog check
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants