Skip to content

Conversation

@horacioh
Copy link
Collaborator

@horacioh horacioh commented Oct 2, 2025

Monorepo Migration: Yarn → pnpm

This PR migrates the frontend workspace from Yarn to pnpm, establishing a more performant and efficient package management system.

Summary

  • Migrated from Yarn 3 to pnpm for package management
  • Updated all workspace configurations and tooling to support pnpm
  • Fixed prettier configuration and formatting issues
  • Verified desktop app functionality with new setup
  • Fixed temporary infinite indentation bug on paste
  • Updated all CI/CD workflows and GitHub Actions to use pnpm
  • Comprehensive documentation updates for the new setup

Key Changes

Package Management

  • Removed .yarnrc.yml, yarn.lock, and Yarn plugins
  • Added pnpm-workspace.yaml and pnpm-lock.yaml
  • Added .npmrc with pnpm-specific configuration
  • Updated package.json scripts to use pnpm commands
  • Changed packageManager field from [email protected] to [email protected]

Build & Tooling

  • Updated Prettier configuration (.prettierrc.json) and ignore rules
  • Added new TypeScript base configuration (tsconfig.base.json)
  • Updated all workspace package.json files for pnpm compatibility
  • Modified build scripts and development workflows

CI/CD

  • Updated all GitHub Actions workflows to use pnpm instead of Yarn
  • Modified CI setup action for pnpm support
  • Updated desktop, web, and Docker image workflows

Documentation

  • Created comprehensive migration guides (MONOREPO_MIGRATION.md, MONOREPO_MIGRATION_NIX.md)
  • Updated CLAUDE.md with new pnpm commands
  • Updated AGENTS.md with new agent configurations
  • Updated various docs throughout the codebase

Development Experience

  • Updated ./dev script to support pnpm
  • Modified docker-compose configurations
  • Desktop app verified working with new setup

Package.json Script Changes

Category Old Script (Yarn) New Script (pnpm)
Testing
All tests yarn web:test && yarn shared:test pnpm run test:web && pnpm run test:shared
Shared tests yarn workspace @shm/shared test pnpm --filter=@shm/shared test
Web tests yarn workspace @shm/web test pnpm --filter=@shm/web test
Desktop tests yarn workspace @shm/desktop test pnpm --filter=@shm/desktop test
Type Checking
Typecheck all yarn workspace @shm/shared build:types && yarn workspaces foreach -pt run typecheck pnpm -r --filter='./frontend/**' run typecheck
Typecheck web N/A pnpm --filter=@shm/web typecheck
Typecheck desktop N/A pnpm --filter=@shm/desktop typecheck
Formatting
Check format yarn workspaces foreach -pt run format:check prettier --check .
Write format yarn workspaces foreach -pt run format:write prettier --write .
Security
Audit prod yarn npm audit pnpm audit
Audit dev yarn npm audit --environment development pnpm audit --dev
Web App - Development
Web dev cd frontend/apps/web && ... yarn dev pnpm --filter=@shm/web dev
Web gateway N/A SEED_IDENTITY_ENABLED=true ... pnpm --filter=@shm/web dev
Web custom N/A SEED_BASE_URL=${CUSTOM_DOMAIN:-...} pnpm --filter=@shm/web dev --host
Web standalone ... yarn web:start --host ... pnpm --filter=@shm/web dev --host
Web App - Production
Build web yarn workspace @shm/web build pnpm --filter=@shm/web build
Prod web yarn web:prod && yarn web:start pnpm build:web && pnpm --filter=@shm/web start:prod
Prod gateway N/A pnpm build:web && SEED_IDENTITY_ENABLED=true pnpm --filter=@shm/web start:prod
Desktop App
Desktop dev yarn workspace @shm/desktop dev pnpm --filter=@shm/desktop dev
Desktop prod N/A VITE_DESKTOP_HTTP_PORT=53001 ... pnpm --filter=@shm/desktop dev
Desktop watch concurrently ... "yarn watch" concurrently ... "pnpm watch"
Desktop package yarn workspace @shm/desktop package pnpm --filter=@shm/desktop package
Desktop make yarn workspace @shm/desktop make pnpm --filter=@shm/desktop make
Desktop publish yarn workspace @shm/desktop publish pnpm --filter=@shm/desktop publish
Desktop devtools yarn workspace @shm/desktop devtools pnpm --filter=@shm/desktop devtools
Desktop perf yarn workspace @shm/performance test pnpm --filter=@shm/performance test
Other Apps
Explore dev yarn workspace @shm/explore dev pnpm --filter=@shm/explore dev
Explore build yarn workspace @shm/explore build pnpm --filter=@shm/explore build
Landing dev yarn workspace @shm/landing dev pnpm --filter=@shm/landing dev
Landing build yarn workspace @shm/landing build pnpm --filter=@shm/landing build
Landing preview yarn workspace @shm/landing preview pnpm --filter=@shm/landing preview
Docs yarn workspace @shm/docs start pnpm --filter=@shm/docs start
Performance
Perf web yarn workspace @shm/perf-web start --url ... pnpm --filter=@shm/perf-web start --url ...
Perf landing yarn workspace @shm/perf-web start --url ... pnpm --filter=@shm/perf-web start --url ...
Perf dashboard yarn workspace @shm/perf-web generate-index && ... pnpm --filter=@shm/perf-web generate-index && ...
Perf dash build yarn workspace @shm/performance-dashboard ... pnpm --filter=@shm/performance-dashboard ...
Utilities
Watch yarn workspaces foreach -pi run watch pnpm -r --parallel run watch
Clean N/A pnpm -r exec rm -rf dist node_modules .turbo
Clean deps N/A rm -rf node_modules pnpm-lock.yaml && pnpm -r exec rm -rf node_modules

Key Command Pattern Changes

  • yarn workspace <name> <cmd>pnpm --filter=<name> <cmd>
  • yarn workspaces foreach -pt run <cmd>pnpm -r run <cmd> (recursive)
  • yarn workspaces foreach -pi run <cmd>pnpm -r --parallel run <cmd>
  • yarn npm auditpnpm audit

Test Plan

  • Desktop app builds and runs successfully
  • Type checking works across all workspaces
  • Prettier formatting applied correctly
  • Build commands execute successfully
  • CI/CD pipelines pass (to be verified after merge)
  • Web app builds and runs successfully
  • E2E tests pass

Migration Impact

This is a significant infrastructure change that affects all developers. After merging:

  1. Install pnpm: npm install -g pnpm
  2. Remove existing node_modules:
    rm -rf node_modules frontend/*/node_modules frontend/*/*/node_modules
  3. Install dependencies: pnpm install
  4. Update commands: All yarn commands should be replaced with pnpm equivalents (see table above)

Additional Notes

  • pnpm uses a content-addressable store, which saves disk space and speeds up installations
  • Workspace filtering with --filter is more explicit than Yarn's workspace commands
  • The pnpm.overrides section replaces Yarn's resolutions for React and other pinned dependencies
  • New onlyBuiltDependencies configuration helps control which packages need build steps

@burdiyan
Copy link
Collaborator

burdiyan commented Oct 5, 2025

Why so many unrelated changes? Looks like something to do with Prettier I guess?

@horacioh
Copy link
Collaborator Author

horacioh commented Oct 5, 2025

Why so many unrelated changes? Looks like something to do with Prettier I guess?

Yes. But because this also changes the prettier config o would not say this are "unrelated changes" ;)

Sign up for free to 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.

3 participants