Skip to content

Latest commit

 

History

History
112 lines (77 loc) · 7.13 KB

File metadata and controls

112 lines (77 loc) · 7.13 KB

Node.js pnpm install Cloud Native Buildpack

Heroku's official Cloud Native Buildpack for pnpm install.

CI

Registry

This buildpack will install and cache package.json and pnpm-lock.json dependencies using the pnpm install command.

This buildpack relies on and builds on top of the Node.js Engine Cloud Native Buildpack to install Node.js and the Node.js Corepack Cloud Native Buildpack to install pnpm.

What it does

  • Sets up a cacheable content-addressable dependency store.
  • Sets up a non-cacheable virtual dependency store.
  • Modifies pnpm config so that the above content-addressable and virtual stores are used by pnpm install
  • Downloads, stores, and hard links package.json and pnpm-lock.json dependencies with pnpm install --frozen-lockfile.
  • Runs build scripts from package.json, including heroku-prebuild, heroku-build (or build), and heroku-postbuild.
  • Sets the default process type as pnpm start if it's defined in package.json

Features

Supported:

  • pnpm versions 7+
  • pnpm hoist = true mode
  • pnpm hoist = false mode
  • pnpm Plug'n'Play mode.

Unsupported:

  • Optional devDependencies. devDependencies are always installed.
  • Pruning devDependencies. devDependencies are always installed.
  • Arbritrary store-dir or virtual-store-dir locations. This buildpack only supports it's own store locations.

Reference

Detect

This buildpack's bin/detect will only pass if a pnpm-lock.json exists in the project root. This is done to prevent the buildpack from providing indeterminate and unpredictable dependency trees.

Build Plan

This buildpack requires node (from the heroku/nodejs-engine buildpack) and pnpm (from the heroku/nodejs-corepack buildpack). It also provides and requires and node_modules.

Hoist Modes

The hoist = true, hoist = false, shamefully-hoist = false, shamefully-hoist = true configurations are all supported by this buildpack. To use any of these features, make the changes in the project's .npmrc file.

Plug'n'Play

Plug'n'Play is supported. Use node-linker = pnp and symlink = false in the project's .npmrc to enable this mode.

Scripts

After dependencies are installed, build scripts will be run in this order: heroku-prebuild, heroku-build (falling back to build if heroku-build does not exist), heroku-postbuild.

Process types

If a start script is detected in package.json, the default process type for the build will be set to pnpm start.

pnpm version selection

This buildpack assumes that pnpm was installed by another buildpack, like heroku/nodejs-corepack. Check out heroku/nodejs-corepack to learn about how it selects versions.

Usage

To build an app locally into an OCI Image with this buildpack, use the pack command from Cloud Native Buildpacks using heroku/nodejs-engine, heroku/nodejs-corepack, and this buildpack:

pack build example-app-image --buildpack heroku/nodejs-engine --buildpack heroku/nodejs-corepack --buildpack heroku/nodejs-pnpm-install --path /some/example-app

Alternatively, use the heroku/builder:22 builder, which includes the above buildpacks:

pack build example-app-image --builder heroku/builder:22 --path /some/example-app

Additional Info

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