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:

@colincasey colincasey self-assigned this Mar 25, 2024
colincasey added a commit that referenced this pull request Mar 25, 2024
These changes build on top of [existing pnpm support](#1224) to allow `pnpm` dependencies to be saved and restored between builds.
@colincasey colincasey mentioned this pull request Mar 25, 2024
colincasey added a commit that referenced this pull request Mar 25, 2024
These changes build on top of [existing pnpm support](#1224) to allow `pnpm` dependencies to be saved and restored between builds.
colincasey added a commit that referenced this pull request Mar 25, 2024
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`.
colincasey added a commit that referenced this pull request Mar 25, 2024
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 mentioned this pull request Mar 25, 2024
colincasey added a commit that referenced this pull request Mar 26, 2024
These changes build on top of [existing pnpm support](#1224) to use the version specified by the `engines.pnpm` field in `package.json`.
colincasey added a commit that referenced this pull request Mar 26, 2024
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.
lib/dependencies.sh Outdated Show resolved Hide resolved
lib/dependencies.sh Outdated Show resolved Hide resolved
@colincasey colincasey force-pushed the corepack_support branch 3 times, most recently from 213ab2e to 4de5c95 Compare March 27, 2024 15:43
colincasey added a commit that referenced this pull request Mar 28, 2024
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.
colincasey added a commit that referenced this pull request Mar 28, 2024
These changes build on top of [existing pnpm support](#1224) to allow `pnpm` dependencies to be saved and restored between builds.
colincasey added a commit that referenced this pull request Mar 28, 2024
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`.
colincasey added a commit that referenced this pull request Mar 28, 2024
These changes build on top of [existing pnpm support](#1224) to use the version specified by the `engines.pnpm` field in `package.json`.
colincasey added a commit that referenced this pull request Mar 28, 2024
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 force-pushed the corepack_support branch 2 times, most recently from 375fd1a to 6ac0c04 Compare April 2, 2024 12:20
colincasey added a commit that referenced this pull request Apr 2, 2024
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.
colincasey added a commit that referenced this pull request Apr 2, 2024
These changes build on top of [existing pnpm support](#1224) to allow `pnpm` dependencies to be saved and restored between builds.
colincasey added a commit that referenced this pull request Apr 11, 2024
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`.
colincasey added a commit that referenced this pull request Apr 11, 2024
These changes build on top of [existing pnpm support](#1224) to use the version specified by the `engines.pnpm` field in `package.json`.
@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
colincasey added a commit that referenced this pull request Apr 29, 2024
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.
colincasey added a commit that referenced this pull request Apr 29, 2024
These changes build on top of [existing pnpm support](#1224) to allow `pnpm` dependencies to be saved and restored between builds.
colincasey added a commit that referenced this pull request Apr 29, 2024
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`.
colincasey added a commit that referenced this pull request Apr 29, 2024
These changes build on top of [existing pnpm support](#1224) to use the version specified by the `engines.pnpm` field in `package.json`.
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`.
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.

None yet

3 participants