From 68f8d66f128f7f14e90b26b24c43678ac4a04139 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Thu, 19 Jun 2025 10:48:08 -0600 Subject: [PATCH] pnpm update for clients --- .DS_Store | Bin 6148 -> 6148 bytes .github/workflows/biome-lint.yml | 16 +-- .github/workflows/manage-versions.yml | 5 +- .github/workflows/trigger-deployment-main.yml | 2 +- .../workflows/trigger-deployment-staging.yml | 2 +- .github/workflows/web-unit-tests.yml | 12 +- PNPM_MIGRATION.md | 120 ------------------ apps/web/Makefile | 20 +-- apps/web/package.json | 4 +- pnpm-lock.yaml | 9 +- 10 files changed, 34 insertions(+), 156 deletions(-) delete mode 100644 PNPM_MIGRATION.md diff --git a/.DS_Store b/.DS_Store index de5ff85869de56aedbe64ae7cc48782fb7fd2f51..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 100644 GIT binary patch delta 70 zcmZoMXfc=|#>AjHu~2NHo+1YW5HK<@2yA9#Vq@DZz_f~SGdl-A2T%b}B`mF;Q%yo}wrd0|Nsi1A_oVaY0f}eiD$kJE>q|;_`Zs1T#Z9Ln=d3 zQaQ3@PG)h5fx$IKCT12^Hg*nn4sMRv;Eeq8;F83W(qgB?qG%8=BtJhV3C2!L3d>9_ zj~5Ve&d)1J%*;zI0&B=jNd+p23D3++$uD=xFU?CS2I~z5N@N0MI5;^t;{~Lvt91=6 zOe}O1%*<Z7vYqP(2^ymX)lI#>DT;llesySwSJ7FxgN $NEW_WEB_VERSION" cd .. if [[ "$OLD_WEB_VERSION" != "$NEW_WEB_VERSION" ]]; then - git add web/package.json web/package-lock.json + git add web/package.json pnpm-lock.yaml COMMIT_MESSAGE_PREFIX="$COMMIT_MESSAGE_PREFIX bump web to v$NEW_WEB_VERSION;" COMMIT_CHANGES=true echo "new_web_version=$NEW_WEB_VERSION" >> $GITHUB_OUTPUT diff --git a/.github/workflows/trigger-deployment-main.yml b/.github/workflows/trigger-deployment-main.yml index 80a57cd79..40f197a28 100644 --- a/.github/workflows/trigger-deployment-main.yml +++ b/.github/workflows/trigger-deployment-main.yml @@ -21,7 +21,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: '20.x' - cache: 'npm' + cache: 'pnpm' - name: Install dependencies run: npm ci diff --git a/.github/workflows/trigger-deployment-staging.yml b/.github/workflows/trigger-deployment-staging.yml index 991f342c5..f218543fe 100644 --- a/.github/workflows/trigger-deployment-staging.yml +++ b/.github/workflows/trigger-deployment-staging.yml @@ -21,7 +21,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: '20.x' - cache: 'npm' + cache: 'pnpm' - name: Install dependencies run: npm ci diff --git a/.github/workflows/web-unit-tests.yml b/.github/workflows/web-unit-tests.yml index 1f68363a8..727172996 100644 --- a/.github/workflows/web-unit-tests.yml +++ b/.github/workflows/web-unit-tests.yml @@ -15,17 +15,17 @@ jobs: working-directory: web steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: "22" - cache: "npm" - cache-dependency-path: web/package-lock.json + cache: "pnpm" + cache-dependency-path: pnpm-lock.yaml - name: Install dependencies - run: npm ci + run: pnpm install --frozen-lockfile - name: Run Jest tests - run: npm run test + run: pnpm run test diff --git a/PNPM_MIGRATION.md b/PNPM_MIGRATION.md deleted file mode 100644 index aa5069650..000000000 --- a/PNPM_MIGRATION.md +++ /dev/null @@ -1,120 +0,0 @@ -# PNPM Migration Guide - -This document outlines the migration from npm to pnpm for the Buster monorepo. - -## What Changed - -### Files Added -- `pnpm-workspace.yaml` - Defines workspace configuration for pnpm -- `.pnpmrc` - pnpm configuration file with monorepo best practices -- `PNPM_MIGRATION.md` - This migration guide - -### Files Modified -- `package.json` - Updated packageManager to pnpm@9.15.0, removed workspaces field, updated scripts -- `apps/web/Dockerfile` - Updated to use pnpm instead of npm -- `.github/workflows/web-lint.yml` - Updated CI to use pnpm -- `.github/workflows/web-e2e-tests-optimized.yml` - Updated CI to use pnpm -- `scripts/evals.sh` - Updated to use `pnpm exec` instead of `npx` -- `CLAUDE.md` - Updated documentation examples to use pnpm -- `.github/dependabot.yml` - Consolidated npm dependency updates to root - -### Files Removed -- `package-lock.json` - Replaced by `pnpm-lock.yaml` -- `apps/web/package-lock.json` - Replaced by workspace-wide `pnpm-lock.yaml` - -## Migration Steps Completed - -1. ✅ Created `pnpm-workspace.yaml` with workspace definitions -2. ✅ Created `.pnpmrc` with optimized monorepo settings -3. ✅ Updated `package.json` packageManager field to `pnpm@9.15.0` -4. ✅ Removed `workspaces` field from `package.json` (now in pnpm-workspace.yaml) -5. ✅ Updated all npm scripts to use pnpm equivalents: - - `npm run` → `pnpm run` - - `npm run --workspace=@package` → `pnpm --filter @package run` - - `npm run --cwd` → `pnpm --filter` -6. ✅ Updated Dockerfile to use pnpm with corepack -7. ✅ Updated GitHub Actions workflows to use pnpm -8. ✅ Updated shell scripts to use `pnpm exec` instead of `npx` -9. ✅ Removed npm lockfiles -10. ✅ Updated documentation - -## Key Differences for Developers - -### Installation -```bash -# Old (npm) -npm install - -# New (pnpm) -pnpm install -``` - -### Running Scripts -```bash -# Old (npm) -npm run dev -npm run build --workspace=@buster/web - -# New (pnpm) -pnpm run dev -pnpm --filter @buster/web run build -``` - -### Adding Dependencies -```bash -# Old (npm) -npm install lodash -npm install -D typescript --workspace=@buster/web - -# New (pnpm) -pnpm add lodash -pnpm --filter @buster/web add -D typescript -``` - -### Running Package Executables -```bash -# Old (npm) -npx playwright test - -# New (pnpm) -pnpm exec playwright test -``` - -## Benefits of pnpm - -1. **Disk Space Efficiency**: pnpm uses hard links and symlinks to share dependencies across projects -2. **Faster Installation**: Better caching and parallel installation -3. **Strict Dependency Resolution**: Prevents phantom dependencies by creating proper node_modules structure -4. **Better Workspace Support**: More intuitive workspace commands with filtering -5. **Lockfile Efficiency**: Smaller, more readable lockfiles - -## Next Steps - -After migration, developers should: - -1. Install pnpm globally: `npm install -g pnpm` -2. Remove any local `node_modules` directories: `rm -rf node_modules` -3. Install dependencies: `pnpm install` -4. Update any local scripts or tooling to use pnpm commands - -## Troubleshooting - -### If you encounter issues: - -1. **Clear pnpm cache**: `pnpm store prune` -2. **Remove node_modules**: `rm -rf node_modules packages/*/node_modules apps/*/node_modules` -3. **Fresh install**: `pnpm install` -4. **Check workspace setup**: `pnpm list -r` to see all workspace packages - -### Common Command Equivalents - -| npm | pnpm | -|-----|------| -| `npm install` | `pnpm install` | -| `npm run script` | `pnpm run script` | -| `npm run script --workspace=pkg` | `pnpm --filter pkg run script` | -| `npx command` | `pnpm exec command` | -| `npm install pkg` | `pnpm add pkg` | -| `npm install -g pkg` | `pnpm add -g pkg` | - -For more information, see the [pnpm documentation](https://pnpm.io/) \ No newline at end of file diff --git a/apps/web/Makefile b/apps/web/Makefile index 9acdbec75..bb4359bc3 100644 --- a/apps/web/Makefile +++ b/apps/web/Makefile @@ -1,33 +1,33 @@ dev: - rm -rf ./next && npm i && npm run dev + rm -rf ./next && pnpm install && pnpm run dev build: - rm -rf ./next && npm i && npm run build + rm -rf ./next && pnpm install && pnpm run build start: - npm i && npm run build && npm run start + pnpm install && pnpm run build && pnpm run start start-fast: @if [ ! -d "./.next" ]; then \ echo "No build found. Installing dependencies and building..."; \ - npm i && npm run build && npm run start; \ + pnpm install && pnpm run build && pnpm run start; \ else \ echo "Using existing build..."; \ - npm run start; \ + pnpm run start; \ fi fast: - npm run dev + pnpm run dev build-storybook: - npm run build-storybook + pnpm run build-storybook storybook: - npm run storybook + pnpm run storybook lint: - npm run lint + pnpm run lint lint-fix: - npm run lint-fix + pnpm run lint-fix diff --git a/apps/web/package.json b/apps/web/package.json index 1e57f87b9..7285f2f4d 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -5,7 +5,6 @@ "scripts": { "dev": "next dev --turbo", "build": "next build", - "build:skip-lint": "next build", "start": "next start", "lint": "next lint", "lint:biome": "npx biome check", @@ -32,6 +31,7 @@ "@dnd-kit/modifiers": "^9.0.0", "@dnd-kit/sortable": "^10.0.0", "@electric-sql/react": "^1.0.4", + "@electric-sql/client": "^1.0.4", "@faker-js/faker": "^9.8.0", "@monaco-editor/react": "^4.7.0", "@radix-ui/react-avatar": "^1.1.10", @@ -156,4 +156,4 @@ "public" ] } -} +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 09b1a5e25..7a847b116 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -156,12 +156,6 @@ importers: apps/server: dependencies: - '@buster/access-controls': - specifier: workspace:* - version: link:../../packages/access-controls - '@buster/database': - specifier: workspace:* - version: link:../../packages/database '@hono/zod-validator': specifier: ^0.7.0 version: 0.7.0(hono@4.8.0)(zod@3.25.67) @@ -186,6 +180,9 @@ importers: '@dnd-kit/sortable': specifier: ^10.0.0 version: 10.0.0(@dnd-kit/core@6.3.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1) + '@electric-sql/client': + specifier: ^1.0.4 + version: 1.0.4 '@electric-sql/react': specifier: ^1.0.4 version: 1.0.4(react@18.3.1)