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

pnpm support #1224

Merged
merged 8 commits into from
Apr 29, 2024
Merged

pnpm support #1224

merged 8 commits into from
Apr 29, 2024

Conversation

colincasey
Copy link
Contributor

@colincasey colincasey commented Mar 25, 2024

These changes build on top of existing corepack support to allow pnpm to be installed via Corepack.

The buildpack 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

Usage

As stated in the Corepack docs, setting the package manager to be used is done using the packageManager field in package.json:

{
  "packageManager": "pnpm@<version>"
}

It is also possible to specify the pnpm version in the engines.pnpm field of package.json:

{
  "engines": {
    "pnpm": "<version>"
  }
}

Notes

  • If the pnpm version is specified in both the packageManager and engines.pnpm field of package.json then the version specified in packageManager will be used and a warning will be displayed noting this.
  • If there is a pnpm lockfile detected but no packageManager and engines.pnpm field defined in package.json then the buildpack will install the lastest version of pnpm.

The PRs listed below enhance this baseline support:

lib/dependencies.sh Outdated Show resolved Hide resolved
lib/dependencies.sh Outdated Show resolved Hide resolved
@l-campbell
Copy link

Thanks for working on this @colincasey! So excited to be able to make use of these changes

@colincasey
Copy link
Contributor Author

Thanks @l-campbell 😄

If you want to preview this in your application builds before it gets released, you can try it out today by swapping out the heroku/nodejs buildpack with one that references the pnpm_support branch:

heroku buildpacks:remove heroku/nodejs -a <your-appname>
heroku buildpacks:set https://github.com/heroku/heroku-buildpack-nodejs#pnpm_support -a <your-appname>

If you experience any build issues with pnpm during this preview phase, please file an issue and we'll do our best to address it before this PR is merged.

@l-campbell
Copy link

Working like a dream @colincasey 🚀 👏

Any idea when this will land?

@colincasey
Copy link
Contributor Author

Good to hear, @l-campbell. Thanks for giving it a try 😄

I can't give a specific time-frame for the release but it will be soon. I just have a couple of documentation tasks to complete first.

@colincasey colincasey marked this pull request as ready for review April 29, 2024 14:13
@colincasey colincasey requested a review from a team as a code owner April 29, 2024 14:14
@colincasey colincasey enabled auto-merge (squash) April 29, 2024 16:58
@edmorley edmorley removed the request for review from a team April 29, 2024 17:00
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
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.
These changes build on top of [existing pnpm support](#1224) to allow `pnpm` dependencies to be saved and restored between builds.
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`.
These changes build on top of [existing pnpm support](#1224) to use the version specified by the `engines.pnpm` field in `package.json`.
@colincasey colincasey merged commit f045fd7 into main Apr 29, 2024
11 checks passed
@colincasey colincasey deleted the pnpm_support branch April 29, 2024 18:52
@heroku-linguist heroku-linguist bot mentioned this pull request Apr 29, 2024
simar0at pushed a commit to simar0at/heroku-buildpack-basex that referenced this pull request Jun 20, 2024
* pnpm support

These changes build on top of [existing corepack support](heroku/heroku-buildpack-nodejs#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](heroku/heroku-buildpack-nodejs#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](heroku/heroku-buildpack-nodejs#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](heroku/heroku-buildpack-nodejs#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](heroku/heroku-buildpack-nodejs#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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants