Skip to content

chore: migrate npm to pnpm across CI, Docker, and scripts - #555

Merged
cameri merged 16 commits into
cameri:mainfrom
Anshumancanrock:chore/pnpm-migration
Apr 25, 2026
Merged

chore: migrate npm to pnpm across CI, Docker, and scripts#555
cameri merged 16 commits into
cameri:mainfrom
Anshumancanrock:chore/pnpm-migration

Conversation

@Anshumancanrock

@AnshumancanrockAnshumancanrock commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

Migrates the package manager from npm to pnpm to improve install times, enforce strict dependency resolution, and reduce disk space usage.

Changes

  • Replaced package-lock.json with pnpm-lock.yaml (using pnpm@10.33.0).
  • Updated GitHub Actions to use pnpm/action-setup and pnpm install --frozen-lockfile.
  • Updated Dockerfile and docker-compose configuration to use pnpm.
  • Fixed Husky pre-commit/pre-push hooks to use pnpm exec.
  • Updated command references in README.md, CONTRIBUTING.md, and CONFIGURATION.md.
  • Added patch changeset to satisfy CI dependency constraint.

Closes#434

npm vs pnpm benchmark (cold install, 3 runs each)

runnpm installpnpm install --frozen-lockfile
178.64s13.78s
247.86s28.72s
366.91s29.12s

Installation is ~2.5× faster

Testing

  1. Install and script flows run with pnpm locally.
  2. CI workflow steps are updated for pnpm.
  3. Docker-related command paths are updated to pnpm.

@socket-security

socket-securityBot commented Apr 21, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

DiffPackageSupply Chain
Security
VulnerabilityQualityMaintenanceLicense
Addedzod@​3.25.769810010088100
Updatedaxios@​1.15.0 ⏵ 1.15.190-110010096+1100

View full report

@coveralls

coveralls commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 74.929% (-0.02%) from 74.946% — Anshumancanrock:chore/pnpm-migration into cameri:main

@Anshumancanrock
Anshumancanrock marked this pull request as draft April 21, 2026 01:22
@cameri
cameri requested a review from CopilotApril 22, 2026 00:06
@camericameri self-assigned this Apr 22, 2026

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the project’s tooling and documentation from npm to pnpm across local scripts, CI workflows, and Docker-based environments.

Changes:

  • Switch CI workflows to install/cache dependencies with pnpm and frozen lockfile installs.
  • Update Dockerfiles/docker-compose migration steps and Husky hooks to use pnpm/pnpm exec.
  • Refresh docs and script usage text to reference pnpm commands; add a changeset for CI requirements.

Reviewed changes

Copilot reviewed 27 out of 30 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
test/integration/docker-compose.ymlUpdates DB migration step to use corepack + pnpm dlx during integration tests.
docker-compose.ymlUpdates DB migration step to use corepack + pnpm dlx in local compose setup.
src/scripts/export-events.tsUpdates CLI usage output from npm run to pnpm run.
src/scripts/benchmark-queries.tsUpdates docstring/usage output from npm run to pnpm run.
src/import-events.tsUpdates CLI usage output from npm run to pnpm run.
src/clean-db.tsUpdates help text examples from npm run to pnpm run.
scripts/verify-index-impact.tsUpdates usage doc comment to pnpm run.
scripts/smoke-nip03.tsUpdates usage doc comment to pnpm exec.
scripts/smoke-nip03.mdUpdates instructions to pnpm run / pnpm exec.
scripts/security-load-test.tsUpdates usage doc comment to pnpm exec / pnpm run.
package.jsonAdds packageManager pin and updates scripts to use pnpm.
Dockerfile.testSwitches dependency install to pnpm with frozen lockfile.
Dockerfile.railwayappSwitches build/runtime installs and migration invocation to pnpm.
DockerfileSwitches build/runtime installs and build step to pnpm.
README.mdUpdates developer/user commands to pnpm.
CONTRIBUTING.mdUpdates contributor commands to pnpm / pnpm exec.
CONFIGURATION.mdUpdates benchmarking commands to pnpm.
.husky/pre-commitUpdates hook commands to pnpm run.
.husky/commit-msgUpdates hook to use pnpm exec commitlint.
.gitignoreIgnores package-lock.json and pnpm cache artifacts.
.github/workflows/checks.ymlUpdates CI jobs to use pnpm/action-setup, pnpm cache, and frozen installs.
.github/workflows/changesets.ymlUpdates release workflow to use pnpm install and pnpm-based changeset commands.
.changeset/bright-clocks-jam.mdAdds a patch changeset documenting the migration.
src/routes/index.tsAdds explicit Router typing and import adjustments.
src/routes/invoices/index.tsAdds explicit Router typing for router instance.
src/routes/callbacks/index.tsAdds explicit Router typing for router instance.
src/routes/admissions/index.tsAdds explicit Router typing for router instance.
src/factories/web-app-factory.tsAdds explicit Express return type for createWebApp.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadtest/integration/docker-compose.yml Outdated
- sh
- -c
- 'cd code && npm install --no-save --quiet knex@2.4.0 pg@8.8.0 && npx knex migrate:latest'
- 'cd code && corepack enable && pnpm dlx --package=knex@2.4.0 --package=pg@8.8.0 knex migrate:latest'

CopilotAIApr 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This migration container runs corepack enable && pnpm dlx ... in /code without a package.json, so Corepack can’t read the repo’s packageManager pin and may pick a different pnpm version over time. To keep CI/integration tests reproducible, explicitly prepare/activate the pnpm version you expect (e.g., corepack prepare pnpm@10.33.0 --activate) before invoking pnpm dlx.

Suggested change
- 'cd code && corepack enable && pnpm dlx --package=knex@2.4.0 --package=pg@8.8.0 knex migrate:latest'
- 'cd code && corepack enable && corepack prepare pnpm@10.33.0 --activate && pnpm dlx --package=knex@2.4.0 --package=pg@8.8.0 knex migrate:latest'

Copilot uses AI. Check for mistakes.
Comment threaddocker-compose.yml Outdated
- sh
- -c
- 'cd code && npm install --no-save --quiet knex@2.4.0 pg@8.8.0 && npx knex migrate:latest'
- 'cd code && corepack enable && pnpm dlx --package=knex@2.4.0 --package=pg@8.8.0 knex migrate:latest'

CopilotAIApr 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corepack enable && pnpm dlx ... is executed in /code, which doesn’t include this repo’s package.json (and therefore doesn’t provide the packageManager: pnpm@10.33.0 pin). That makes the pnpm version selected by Corepack non-deterministic and could break migrations if Corepack defaults change. Consider explicitly preparing/activating the intended pnpm version here (e.g., corepack prepare pnpm@10.33.0 --activate) before running pnpm dlx.

Suggested change
- 'cd code && corepack enable && pnpm dlx --package=knex@2.4.0 --package=pg@8.8.0 knex migrate:latest'
- 'cd code && corepack enable && corepack prepare pnpm@10.33.0 --activate && pnpm dlx --package=knex@2.4.0 --package=pg@8.8.0 knex migrate:latest'

Copilot uses AI. Check for mistakes.
@changeset-bot

changeset-botBot commented Apr 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: aafcfcb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
nostreamPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Anshumancanrock
Anshumancanrock marked this pull request as ready for review April 23, 2026 07:54
@Anshumancanrock

Copy link
Copy Markdown
CollaboratorAuthor

hii @cameri , could you please review this pr when you have time? Thanks !

Comment threadCONTRIBUTING.md Outdated
Comment threadCONFIGURATION.md Outdated
Comment threadDockerfile Outdated
COPY --from=build /build/package.json /build/pnpm-lock.yaml ./

RUN npm install --omit=dev --quiet
RUN corepack enable && corepack prepare pnpm@10.33.0 --activate && pnpm install --prod --frozen-lockfile --silent

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make PNMP_VERSION an ARG and ENV var?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ! Added ARG PNPM_VERSION=10.33.0 at the top of all three Dockerfiles and replaced every hardcoded reference with$PNPM_VERSION

Comment threadDockerfile.railwayapp
Comment threadREADME.md
Comment threadREADME.md Outdated

```
NODE_OPTIONS="-r dotenv/config" npm run db:migrate
NODE_OPTIONS="-r dotenv/config" pnpm run db:migrate

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's check if this NODE_OPTIONS can be removed and use node owns env file loading mechanism.

@Anshumancanrock
Anshumancanrock marked this pull request as draft April 23, 2026 16:56
@Anshumancanrock
Anshumancanrock marked this pull request as ready for review April 23, 2026 17:31
Comment threadCONTRIBUTING.md Outdated

```
npm run dev
pnpm run dev

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we remove run from commands in this file as well?

Comment threadCONTRIBUTING.md Outdated
Comment threadCONTRIBUTING.md Outdated
Comment threadDockerfile Outdated
Comment threadDockerfile.railwayapp Outdated
Comment threadREADME.md Outdated
Sign up for freeto 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.

Migrate to using pnpm instead of npm

4 participants

@Anshumancanrock@coveralls@cameri