Skip to content

Latest commit

 

History

History
78 lines (50 loc) · 6.14 KB

File metadata and controls

78 lines (50 loc) · 6.14 KB

Node.js Corepack Cloud Native Buildpack

Heroku's official Cloud Native Buildpack for Corepack.

CI

Registry

This buildpack relies on and builds on top of the Node.js Engine Cloud Native Buildpack to leverage corepack for installing package managers.

What it does

  • Reads package.json to determine if and which package manager should be installed based on the packageManager 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.

Features

Supported:

  • Yarn major versions 1, 2, and 3.
  • pnpm 7+

Unsupported:

  • Installing npm (for now).

Reference

Detect

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 "[email protected]"), and the packageManager name is supported.

Build Plan

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).

Environment Variables

PATH

$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.

Usage

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

Additional Info

For development, dependencies, contribution, license and other info, please refer to the root README.md.