Skip to content

Commit ba7b11b

Browse files
authored
Migrate from Yarn Classic to pnpm (#2121)
## Summary Migrate the react-on-rails monorepo from Yarn Classic (v1.22.22) to pnpm for improved monorepo management, faster installs, and native workspace linking. ## Key Changes - **Package Manager Configuration** - Add `pnpm-workspace.yaml` and `.npmrc` for pnpm configuration - Update `packageManager` field to `[email protected]` in all package.json files - Convert workspace dependencies from `"*"` to `"workspace:*"` protocol - Move `pnpm.overrides` from workspace package to root - **Lock Files** - Remove all `yarn.lock` files - Add `pnpm-lock.yaml` - **GitHub Actions Workflows** - Add pnpm setup action with caching - Replace all yarn commands with pnpm equivalents - Update cache keys from `yarn.lock` to `pnpm-lock.yaml` - **Rake Tasks** - Update `rakelib/lint.rake`, `rakelib/node_package.rake`, `rakelib/dummy_apps.rake`, `rakelib/run_rspec.rake` - **Documentation** - Update `CONTRIBUTING.md` and `CLAUDE.md` - Add note clarifying this only affects contributors ## Note for Users **End users of react_on_rails can continue using their preferred package manager** (npm, yarn, pnpm, or bun). The generators automatically detect your package manager. These changes only affect contributors working on the react_on_rails codebase itself. ## Test Plan - [x] `pnpm install` completes successfully - [x] `pnpm run build` produces correct artifacts - [ ] CI workflows pass with new pnpm setup - [ ] yalc publish/add workflow still works Closes #2120 ## Summary by CodeRabbit * **Chores** * Migrated project tooling, CI workflows, and workspace configs from Yarn to PNPM; added PNPM workspace and config changes. * **Documentation** * Updated contributor/developer guides, CI/merge instructions, and changelog to PNPM-first commands; removed/condensed numerous checklist and bullet items. * **Bug Fixes** * UI: error display now renders error values reliably as text. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent b50a74d commit ba7b11b

File tree

64 files changed

+11311
-27659
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+11311
-27659
lines changed

.claude/commands/update-changelog.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ You are helping to add an entry to the CHANGELOG.md file for the React on Rails
55
## Critical Requirements
66

77
1. **User-visible changes only**: Only add changelog entries for user-visible changes:
8-
98
- New features
109
- Bug fixes
1110
- Breaking changes
@@ -118,21 +117,18 @@ When a new version is released:
118117
### For Regular Changelog Updates
119118

120119
1. **ALWAYS fetch latest changes first**:
121-
122120
- **CRITICAL**: Run `git fetch origin master` to ensure you have the latest commits
123121
- The workspace may be behind origin/master, causing you to miss recently merged PRs
124122
- After fetching, use `origin/master` for all comparisons, NOT local `master` branch
125123

126124
2. **Determine the correct version tag to compare against**:
127-
128125
- First, check the tag dates: `git log --tags --simplify-by-decoration --pretty="format:%ai %d" | head -10`
129126
- Find the latest version tag and its date
130127
- Compare origin/master branch date to the tag date
131128
- If the tag is NEWER than origin/master, it means the branch needs to be updated to include the tag's commits
132129
- **CRITICAL**: Always use `git log TAG..BRANCH` to find commits that are in the tag but not in the branch, as the tag may be ahead
133130

134131
3. **Check commits and version boundaries**:
135-
136132
- **IMPORTANT**: Use `origin/master` in all commands below, not local `master`
137133
- Run `git log --oneline LAST_TAG..origin/master` to see commits since the last release
138134
- Also check `git log --oneline origin/master..LAST_TAG` to see if the tag is ahead of origin/master
@@ -148,20 +144,17 @@ When a new version is released:
148144
5. **Read the current CHANGELOG.md** to understand the existing structure and formatting.
149145

150146
6. **Determine where entries should go**:
151-
152147
- If the latest version tag is NEWER than origin/master branch, move entries from "Unreleased" to that version section
153148
- If origin/master is ahead of the latest tag, add new entries to "Unreleased"
154149
- Always verify the version date in CHANGELOG.md matches the actual tag date
155150

156151
7. **Add or move entries** to the appropriate section under appropriate category headings.
157-
158152
- **CRITICAL**: When moving entries from "Unreleased" to a version section, merge them with existing entries under the same category heading
159153
- **NEVER create duplicate section headings** (e.g., don't create two "### Fixed" sections)
160154
- If the version section already has a category heading (e.g., "### Fixed"), add the moved entries to that existing section
161155
- Maintain the category order as defined above
162156

163157
8. **Verify formatting**:
164-
165158
- Bold description with period
166159
- Proper PR link (NO hash symbol)
167160
- Proper author link
@@ -181,12 +174,10 @@ When a new version is released:
181174
When releasing from beta to a stable version (e.g., v16.1.0-beta.3 → v16.1.0):
182175

183176
1. **Remove all beta version labels** from the changelog:
184-
185177
- Change `### [v16.1.0-beta.1]`, `### [v16.1.0-beta.2]`, etc. to a single `### [v16.1.0]` section
186178
- Combine all beta entries into the stable release section
187179

188180
2. **Consolidate duplicate entries**:
189-
190181
- If bug fixes or changes were made to features introduced in earlier betas, keep only the final state
191182
- Remove redundant changelog entries for fixes to beta features
192183
- Keep the most recent/accurate description of each change

.claude/docs/analysis/MONOREPO_MIGRATION_ANALYSIS.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,10 @@ task node_package: "node_package:build"
265265
**Critical**: When migrating from `node_package/` to `packages/react-on-rails/`:
266266
267267
1. **package-scripts.yml** references:
268-
269268
- ❌ `[ -f node_package/lib/ReactOnRails.full.js ]` → ✅ `[ -f lib/ReactOnRails.full.js ]`
270269
- ❌ `[ -f packages/node-renderer/dist/ReactOnRailsProNodeRenderer.js ]` (already correct in Pro)
271270
272271
2. **package.json** "main" and "files" fields:
273-
274272
- Master: `"main": "node_package/lib/ReactOnRails.full.js"`
275273
- Target: `"main": "lib/ReactOnRails.full.js"` (in packages/react-on-rails)
276274
@@ -282,13 +280,11 @@ task node_package: "node_package:build"
282280
#### Workspace Integration Tasks
283281
284282
1. **Yarn workspaces validation**
285-
286283
- Verify all workspace commands work correctly
287284
- Test cross-workspace dependencies
288285
- Validate yalc publish chain
289286
290287
2. **CI/CD Integration**
291-
292288
- Update GitHub Actions for workspace structure
293289
- Verify separate package versioning works
294290
- Test independent package publishing
@@ -375,28 +371,24 @@ task node_package: "node_package:build"
375371
⚠️ **Critical Path Issues**:
376372

377373
1. **Path References** (HIGHEST PRIORITY)
378-
379374
- [ ] Update all hardcoded `node_package/lib/` references
380375
- [ ] Verify `package-scripts.yml` paths after migration
381376
- [ ] Test `yalc publish` with new paths
382377
- **Impact**: Breaking yalc publish silently (as happened in Sept 2024)
383378

384379
2. **Workspace Integration** (HIGH)
385-
386380
- [ ] Validate `yarn workspaces run yalc:publish`
387381
- [ ] Test cross-workspace dependency resolution
388382
- [ ] Verify package version management
389383
- **Impact**: Package installation failures for users
390384

391385
3. **CI/CD Consolidation** (HIGH)
392-
393386
- [ ] Merge CircleCI into GitHub Actions workflow
394387
- [ ] Test all CI jobs with workspace structure
395388
- [ ] Update caching strategies for workspaces
396389
- **Impact**: Unpredictable CI behavior, missing test coverage
397390

398391
4. **Pro Package Migration** (MEDIUM)
399-
400392
- [ ] Consolidate `react_on_rails_pro/` with `packages/react-on-rails-pro/`
401393
- [ ] Remove redundant configurations
402394
- [ ] Update build scripts
@@ -491,13 +483,11 @@ GitHub Actions
491483
### Phase 3: Pre-Monorepo Structure Preparation
492484

493485
1. **Validate Current State**
494-
495486
- [ ] Run full test suite on surabaya-v1
496487
- [ ] Verify yalc publish works with workspace structure
497488
- [ ] Test clean install scenarios
498489

499490
2. **Path Migration Checklist**
500-
501491
- [ ] Update all `package-scripts.yml` paths
502492
- [ ] Update all CI workflow paths
503493
- [ ] Search codebase for hardcoded `node_package/` references
@@ -511,13 +501,11 @@ GitHub Actions
511501
### Phase 4: Final Monorepo Restructuring
512502

513503
1. **Consolidate Pro Package**
514-
515504
- [ ] Merge `react_on_rails_pro/` into monorepo structure
516505
- [ ] Remove redundant configurations
517506
- [ ] Update gemspec files
518507

519508
2. **CI/CD Consolidation**
520-
521509
- [ ] Move CircleCI jobs to GitHub Actions
522510
- [ ] Update workspace cache strategies
523511
- [ ] Verify all test jobs pass
@@ -534,27 +522,23 @@ GitHub Actions
534522
**Migration will be complete when**:
535523

536524
1. **Structure**
537-
538525
- All JavaScript packages in `packages/` directory
539526
- Yarn workspaces configured and working
540527
- No references to `node_package/src/` in documentation
541528

542529
2. **Build & Package**
543-
544530
- `yarn build` compiles all packages
545531
- `yarn yalc:publish` publishes all packages
546532
- `yarn run prepack` passes pre-publication checks
547533
- All build artifacts in expected locations
548534

549535
3. **Testing**
550-
551536
- All RSpec tests pass (Ruby)
552537
- All Jest tests pass (JavaScript)
553538
- CI/CD pipeline fully operational
554539
- Clean install works for all package types
555540

556541
4. **Documentation**
557-
558542
- All developer instructions updated
559543
- Path references accurate
560544
- Release process documented

.claude/docs/analysis/PHASE_5_COMPLETION_NOTES.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,26 @@
77
### ✅ Successfully Completed
88

99
1. **Created package structure**
10-
1110
- `packages/react-on-rails-pro-node-renderer/` directory
1211
- package.json with correct dependencies
1312
- tsconfig.json configurations
1413

1514
2. **Moved all files with git history preserved**
16-
1715
- 29 source files moved from `react_on_rails_pro/packages/node-renderer/src/`
1816
- 43 test files moved from `react_on_rails_pro/packages/node-renderer/tests/`
1917
- All files tracked as renames (preserves git blame/history)
2018

2119
3. **Updated workspace configuration**
22-
2320
- Added `packages/react-on-rails-pro-node-renderer` to root package.json workspaces
2421
- Updated build script to include node-renderer
2522
- Workspace recognizes all 3 packages with correct dependencies
2623

2724
4. **Fixed .gitignore**
28-
2925
- Removed blanket `packages/` ignore
3026
- Now only ignores `packages/*/lib/` (build outputs)
3127
- Source code is properly tracked
3228

3329
5. **Updated LICENSE.md**
34-
3530
- Added `packages/react-on-rails-pro-node-renderer/` to Pro license section
3631
- License boundaries clear
3732

@@ -51,18 +46,15 @@
5146
The node-renderer package has **pre-existing TypeScript errors** unrelated to the file move:
5247

5348
1. **Missing .js extensions in imports** (ESM requirement)
54-
5549
- ~30+ imports need `.js` extension added
5650
- Example: `import { foo } from './bar'``import { foo } from './bar.js'`
5751

5852
2. **Missing type declarations**
59-
6053
- `fastify` - needs `@types/fastify`
6154
- `@sentry/node` - needs `@sentry/node` installed
6255
- `@honeybadger-io/js` - needs `@honeybadger-io/js` installed
6356

6457
3. **Module export format issues**
65-
6658
- Some files use `export =` which doesn't work with ESM
6759
- Need to convert to `export default`
6860

.claude/docs/analysis/claude-md-improvements.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,18 @@ Based on the CI breakage analysis, here are specific additions to prevent simila
77
**CRITICAL: When working on PRs that change directory structure or move files:**
88

99
1. **Create a comprehensive checklist** of all places that reference the old paths:
10-
1110
- Search for hardcoded paths in all config files (grep -r "old/path" .)
1211
- Check package.json, package-scripts.yml, webpack configs, CI workflows
1312
- Check documentation and example code
1413
- Check generator templates
1514

1615
2. **Run ALL test suites** after directory changes:
17-
1816
- `rake` (all tests)
1917
- `rake run_rspec:example_basic` (generator tests)
2018
- Manual test of `yalc publish` if changing package structure
2119
- Build and test in a fresh clone to catch path issues
2220

2321
3. **Add temporary validation** in CI:
24-
2522
- Add a CI job that explicitly tests the changed paths
2623
- Keep this validation for 2-3 releases after the refactor
2724

@@ -38,7 +35,6 @@ Based on the CI breakage analysis, here are specific additions to prevent simila
3835
**CRITICAL: Build scripts in package.json and package-scripts.yml need validation:**
3936

4037
1. **The prepack/prepare scripts are CRITICAL** - they run during:
41-
4238
- `npm install` / `yarn install` (for git dependencies)
4339
- `yalc publish`
4440
- `npm publish`
@@ -59,7 +55,6 @@ Based on the CI breakage analysis, here are specific additions to prevent simila
5955
```
6056

6157
3. **If you change directory structure:**
62-
6358
- Update ALL path checks in package-scripts.yml
6459
- Test with a clean install: `rm -rf node_modules && yarn install`
6560
- Test yalc publish to ensure it works for users
@@ -73,13 +68,11 @@ Based on the CI breakage analysis, here are specific additions to prevent simila
7368
**CRITICAL: Don't let master stay broken:**
7469

7570
1. **If CI fails on master after your PR merges:**
76-
7771
- Check GitHub Actions within 30 minutes of merge
7872
- Run `gh pr view <pr-number> --json statusCheckRollup` after merge
7973
- Set up GitHub notifications for master branch failures
8074

8175
2. **If you discover master is broken:**
82-
8376
- Investigate IMMEDIATELY - don't assume "someone else will fix it"
8477
- Use `gh run list --branch master --limit 10` to see recent failures
8578
- Check if it's a recurring failure or a new issue
@@ -88,7 +81,6 @@ Based on the CI breakage analysis, here are specific additions to prevent simila
8881
- Consider reverting your PR and re-submitting with the fix
8982

9083
3. **Silent failures are the most dangerous:**
91-
9284
- yalc publish failures won't show up in most CI runs
9385
- Build artifact path issues may only surface during actual usage
9486
- Always test the actual use case (yalc publish, npm install from git, etc.)
@@ -135,13 +127,11 @@ Based on the CI breakage analysis, here are specific additions to prevent simila
135127
**CRITICAL: Hardcoded paths are a major source of bugs:**
136128

137129
1. **Before committing changes to any config file with paths:**
138-
139130
- Verify the path actually exists: `ls -la <path>`
140131
- Test that operations using the path work
141132
- If changing package structure, search for ALL references to old paths
142133

143134
2. **Common files with path references:**
144-
145135
- `package-scripts.yml` - build artifact paths
146136
- `package.json` - "files", "main", "types" fields
147137
- Webpack configs - output.path, resolve.modules

.claude/docs/analysis/github-issue-1765-status-update.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ react_on_rails/
165165
```
166166

167167
2. **Create Workspace Scripts** (20 minutes)
168-
169168
- Add to root `package.json`:
170169

171170
```json

.claude/docs/analysis/github-issue-1765-update.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ The monorepo merger has been successfully completed with full git history preser
2323
### ⚠️ Critical Issues Requiring Immediate Attention
2424

2525
1. **YALC Publishing - Not All Packages Published**
26-
2726
- Currently only publishes main package
2827
- Need to publish: `react-on-rails`, `react-on-rails-pro`, `react-on-rails-pro-rsc`
2928
- Path mismatch in `package-scripts.yml` could cause silent failures
3029

3130
2. **Directory Structure Confusion**
32-
3331
- Pro package nested inside main package (`react_on_rails_pro/` subdirectory)
3432
- Should be siblings under `/packages/` for clearer separation
3533
- Affects mental model and license boundaries

.claude/docs/avoiding-ci-failure-cycles.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,14 @@ commit: "Fix bundle commands" → CI fails (...)
2626
### Why This Happens
2727

2828
1. **Large-scale changes made without comprehensive testing**
29-
3029
- Directory structure changes affect MANY files
3130
- Not understanding full scope of impact
3231

3332
2. **Using CI as the test environment**
34-
3533
- Treating CI like a linter that tells you what to fix
3634
- Not running equivalent tests locally first
3735

3836
3. **Incremental fixing without holistic testing**
39-
4037
- Fix one thing, break another
4138
- Each fix tested in isolation
4239
- Missing interaction effects

0 commit comments

Comments
 (0)