Heroku's official Cloud Native Buildpack for Corepack.
This buildpack relies on and builds on top of the Node.js Engine Cloud Native Buildpack to leverage corepack
for installing package managers.
- Reads
package.json
to determine if and which package manager should be installed based on thepackageManager
field. - Uses
corepack enable
to install the package manager shim. The shim will be cached between builds and available on$PATH
at build and runtime. - Uses
corepack prepare
to install the target package manager version. The package manager will be cached between builds.
- Yarn major versions 1, 2, and 3.
- pnpm 7+
- Installing
npm
(for now).
bin/detect
will pass if and only if a package.json
exists in the root
directory, has a packageManager
field, the packageManager
field has valid
syntax (like "yarn@3.2.0"
), and the packageManager
name is supported.
This buildpack requires
node
(from the heroku/nodejs-engine buildpack).
It provides
and requires
the package manager named in packageManager
of
package.json
(for example, yarn
).
$PATH
will be modified such that the package manager named in packageManager
of package.json
is available at build and runtime.
$COREPACK_HOME
will be set to point to the cached layer where the package
manager is installed.
For most users, it's simplest to build an app using pack
and Heroku's builder, which includes this buildpack.
pack build example-app-image --builder heroku/builder:22 --path /my/example-app
For users desiring more control, this buildpack can be used as part of a
buildpack group. For example, use heroku/nodejs-engine to
install node
and corepack
, this buildpack (heroku/nodejs-corepack) to
install a package manager (like yarn
), and a package manager buildpack
(like heroku/nodejs-yarn to install packages.
pack build example-app-image --buildpack heroku/nodejs-engine --buildpack heroku/nodejs-corepack --buildpack heroku/nodejs-yarn --path /some/example-app
For development, dependencies, contribution, license and other info, please refer to the root README.md.