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

Corepack support (Yarn only) #1222

Merged
merged 1 commit into from Apr 10, 2024
Merged

Corepack support (Yarn only) #1222

merged 1 commit into from Apr 10, 2024

Conversation

colincasey
Copy link
Contributor

@colincasey colincasey commented Mar 12, 2024

These changes lay the groundwork for Corepack support in Node.js projects. Yarn 4 already prefers corepack for installation so this feature will be available for use with Yarn and, in the future, it will be expanded to support pnpm.

Usage

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

{
  "packageManager": "<package manager name>@<version>"
}

Notes

  • Corepack supports both Yarn and pnpm as package managers but this buildpack only supports Yarn currently.
  • Corepack was introduced in Node.js 14.19.0 / 16.9.0, attempting to use it in an unsupported version will result in an error.
  • If the Yarn version is specified in both the packageManager and engines.yarn field of package.json then the version specified in packageManager will be used and a warning will be displayed noting this.
  • Yarn allows for vendoring a specific version into the .yarn/releases folder and referencing it using yarnPath from a project's .yarnrc.yml. If a vendored binary is present and a Yarn version is set in the packageManager field of package.json then the vendored binary will be used and a warning will be displayed noting this.

W-15237072

@colincasey colincasey self-assigned this Mar 12, 2024
@colincasey colincasey marked this pull request as ready for review March 13, 2024 14:52
@colincasey colincasey requested review from joshwlewis and a team as code owners March 13, 2024 14:52
@edmorley edmorley removed the request for review from a team March 21, 2024 10:37
colincasey added a commit that referenced this pull request Mar 25, 2024
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
@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 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
colincasey added a commit that referenced this pull request Mar 25, 2024
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
bin/compile Outdated Show resolved Hide resolved
bin/compile Outdated Show resolved Hide resolved
bin/compile Outdated Show resolved Hide resolved
bin/compile 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 27, 2024
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
lib/binaries.sh Outdated Show resolved Hide resolved
@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 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
@colincasey colincasey force-pushed the corepack_support branch 2 times, most recently from b421ec1 to a70cc6b Compare April 4, 2024 12:36
These changes lay the groundwork for [Corepack](https://nodejs.org/docs/latest/api/corepack.html) support in Node.js projects. [Yarn 4 already prefers corepack for installation](https://yarnpkg.com/getting-started/install) so this feature will be available for use with Yarn and, in the future, it will be expanded to support pnpm.

[W-15237072](https://gus.lightning.force.com/a07EE00001m2GDFYA2)
colincasey added a commit that referenced this pull request Apr 4, 2024
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
colincasey added a commit that referenced this pull request Apr 4, 2024
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
@colincasey colincasey merged commit 52ed325 into main Apr 10, 2024
9 checks passed
@colincasey colincasey deleted the corepack_support branch April 10, 2024 12:30
@heroku-linguist heroku-linguist bot mentioned this pull request Apr 10, 2024
colincasey added a commit that referenced this pull request Apr 11, 2024
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
colincasey added a commit that referenced this pull request Apr 29, 2024
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
colincasey added a commit that referenced this pull request Apr 29, 2024
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
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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants