mirror of https://github.com/buster-so/buster.git
pnpm update for clients
This commit is contained in:
parent
3f64edf903
commit
68f8d66f12
|
@ -26,13 +26,13 @@ jobs:
|
|||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22.9.0'
|
||||
cache: 'npm'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Run Biome lint check
|
||||
run: npm run check
|
||||
run: pnpm run check
|
||||
|
||||
- name: Upload node_modules
|
||||
uses: actions/upload-artifact@v4
|
||||
|
@ -61,7 +61,7 @@ jobs:
|
|||
path: node_modules/
|
||||
|
||||
- name: Build database package
|
||||
run: npm run build
|
||||
run: pnpm run build
|
||||
working-directory: packages/database
|
||||
|
||||
build-access-controls:
|
||||
|
@ -84,7 +84,7 @@ jobs:
|
|||
path: node_modules/
|
||||
|
||||
- name: Build access-controls package
|
||||
run: npm run build
|
||||
run: pnpm run build
|
||||
working-directory: packages/access-controls
|
||||
|
||||
build-data-source:
|
||||
|
@ -107,7 +107,7 @@ jobs:
|
|||
path: node_modules/
|
||||
|
||||
- name: Build data-source package
|
||||
run: npm run build
|
||||
run: pnpm run build
|
||||
working-directory: packages/data-source
|
||||
|
||||
build-web-tools:
|
||||
|
@ -129,7 +129,7 @@ jobs:
|
|||
path: node_modules/
|
||||
|
||||
- name: Build web-tools package
|
||||
run: npm run build
|
||||
run: pnpm run build
|
||||
working-directory: packages/web-tools
|
||||
|
||||
build-test-utils:
|
||||
|
@ -152,5 +152,5 @@ jobs:
|
|||
path: node_modules/
|
||||
|
||||
- name: Build test-utils package
|
||||
run: npm run build
|
||||
run: pnpm run build
|
||||
working-directory: packages/test-utils
|
|
@ -67,6 +67,7 @@ jobs:
|
|||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Set up Rust toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
|
@ -165,12 +166,12 @@ jobs:
|
|||
echo "Bumping Web version using spec: $VERSION_SPEC..."
|
||||
cd web
|
||||
OLD_WEB_VERSION=$(jq -r .version package.json)
|
||||
npm version "$VERSION_SPEC" --no-git-tag-version --allow-same-version
|
||||
pnpm version "$VERSION_SPEC" --no-git-tag-version --allow-same-version
|
||||
NEW_WEB_VERSION=$(jq -r .version package.json)
|
||||
echo "Web: $OLD_WEB_VERSION -> $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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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/)
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue