hammerkit

pnpm

Install locked Node.js dependencies with pnpm.

Install locked Node.js dependencies with pnpm. The task runs in a node container and keeps node_modules as its output, so it is skipped when package.json and pnpm-lock.yaml are unchanged.

.hammerkit.yaml
includes:
  pnpm:
    git: https://github.com/no0dles/hammerkit.git
    ref: v1.16.0
    path: catalog/pnpm

tasks:
  build:
    image: node:24-alpine
    deps: [pnpm:install]
    cmds:
      - npm run build

Tasks

TaskWhat it doesReadsProduces
installInstall locked Node.js dependencies with pnpm.package.json, pnpm-lock.yamlnode_modules

Inputs

InputDefaultMeaning
NODE_VERSION24Tag of the node image the install runs in, e.g. 22 or 24. The image is node:<NODE_VERSION>-alpine.
PNPM_VERSION10pnpm release to run, fetched with corepack the first time, e.g. 9 or 10.28.0.

The entry

catalog/pnpm/build.yaml
# Installs the locked dependencies of a Node.js project with pnpm.
envs:
  # tag of the node image the install runs in
  NODE_VERSION: 24
  # pnpm release to run, fetched with corepack
  PNPM_VERSION: 10

tasks:
  install:
    description: install the locked dependencies with pnpm
    image: node:${NODE_VERSION}-alpine
    src: [package.json, pnpm-lock.yaml]
    generates: [node_modules]
    envs:
      COREPACK_HOME: /tmp/corepack
    cmds:
      - corepack pnpm@${PNPM_VERSION} install --frozen-lockfile

On this page