Skip to content

Commit 93cbce6

Browse files
Add critical lessons learned and corrections to Phase 2 plan
Based on Phase 2 implementation experience, add crucial guidance: CORRECTIONS: - Fix git subtree command (remove --squash to preserve individual commits) - Correct branch workflow (create branch FIRST before any work) - Update duration estimate (2-3 days, 1-2 with lessons learned) LESSONS LEARNED: 1. Branch management workflow corrections 2. Git subtree best practices 3. Complete linting tool configuration requirements 4. Yalc vs file: dependency management approach 5. Multiple dummy apps that need updates 6. CircleCI optimization strategies 7. Local dependency management patterns These lessons will significantly speed up future monorepo merger implementations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> Correct Phase 2 git strategy to use filter-repo approach Update merger plan to reflect the actual commands used: STRATEGY CHANGE: - Replace git subtree approach with git filter-repo + merge - Use git filter-repo --to-subdirectory-filter for better file history - Use git merge --allow-unrelated-histories for clean integration BENEFITS OF FILTER-REPO APPROACH: - Better file history browsing with git log --follow - Cleaner history integration compared to subtree prefixing - No issues with path-based git operations - Easier to browse pro file history with no problems This approach was actually used in the implementation and provides superior file history preservation and browsing experience. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3d7eb90 commit 93cbce6

File tree

1 file changed

+51
-8
lines changed

1 file changed

+51
-8
lines changed

docs/MONOREPO_MERGER_PLAN.md

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ react_on_rails/ (monorepo root)
144144

145145
---
146146

147-
### Phase 2: Git Subtree Merger (Keep Original Structure)
147+
### Phase 2: Git Repository Merger (Keep Original Structure)
148148

149-
#### PR #2: Merge react_on_rails_pro via Git Subtree + Fix CI
149+
#### PR #2: Merge react_on_rails_pro via Git Filter-Repo + Fix CI
150150

151151
**Branch:** `merge-pro-subtree-with-ci`
152152
**Target:** react_on_rails repository
@@ -159,18 +159,36 @@ react_on_rails/ (monorepo root)
159159

160160
**Git Strategy:**
161161

162+
⚠️ **CRITICAL: Create feature branch FIRST before any work!**
163+
162164
```bash
163-
# Add react_on_rails_pro as remote
164-
git remote add pro-origin https://github.com/shakacode/react_on_rails_pro.git
165+
# 1. FIRST: Create and checkout feature branch
166+
git checkout -b merge-pro-subtree-with-ci
167+
168+
# 2. Clone and prepare pro repository with filter-repo (better for file history browsing)
169+
git clone https://github.com/shakacode/react_on_rails_pro.git /tmp/react_on_rails_pro
170+
cd /tmp/react_on_rails_pro
171+
git filter-repo --to-subdirectory-filter react_on_rails_pro
172+
173+
# 3. Add the prepared pro repo as remote and merge
174+
cd /path/to/react_on_rails
175+
git remote add pro-origin /tmp/react_on_rails_pro
165176
git fetch pro-origin
177+
git merge pro-origin/master --allow-unrelated-histories
166178

167-
# Merge using subtree (preserves history)
168-
git subtree add --prefix=react_on_rails_pro pro-origin/main --squash
179+
# 4. Push branch and create PR
180+
git push -u origin merge-pro-subtree-with-ci
169181
```
170182

183+
**Why filter-repo instead of subtree:**
184+
185+
- Better file history browsing
186+
- Cleaner history integration compared to subtree prefixing
187+
- No issues with path-based git operations
188+
171189
**Tasks:**
172190

173-
- [x] Execute git subtree merge into `react_on_rails_pro/` directory
191+
- [x] Execute git filter-repo + merge into `react_on_rails_pro/` directory
174192
- [x] **CRITICAL: Update CI to run tests for both packages**
175193
- [x] Keep GitHub Actions for core package tests
176194
- [x] Keep CircleCI for pro package tests (temporarily)
@@ -230,7 +248,7 @@ After the initial merge, the following CI adjustments may be needed:
230248

231249
**Success Criteria:****ALL CI jobs pass for both core and pro packages independently**
232250

233-
**Estimated Duration:** 3-5 days
251+
**Estimated Duration:** 2-3 days (with lessons learned above: 1-2 days)
234252

235253
**Risk Level:** High (first major structural change)
236254

@@ -241,6 +259,31 @@ After the initial merge, the following CI adjustments may be needed:
241259
- Verify no pro files accidentally ended up in MIT-licensed directories during the merge
242260
- Both CI systems (GitHub Actions + CircleCI) must pass independently
243261

262+
**Critical Lessons Learned (Phase 2 Implementation):**
263+
264+
1. **Branch Management**: ALWAYS create the feature branch BEFORE starting any work, not after commits
265+
2. **Git Merge Strategy**: Use `git filter-repo --to-subdirectory-filter` + `git merge --allow-unrelated-histories` instead of subtree for better file history browsing
266+
3. **Linting Tool Configuration**: ALL linting tools must exclude pro directory:
267+
- Update `.rubocop.yml` with `'react_on_rails_pro/**/*'` exclusion
268+
- Update `eslint.config.ts` with `'react_on_rails_pro/'` exclusion
269+
- Update `.prettierignore` with `react_on_rails_pro/` exclusion
270+
- Update `knip.ts` with `'react_on_rails_pro/**'` in ignore patterns
271+
4. **Local Dependencies**: Use yalc for JS packages, path references for Ruby gems:
272+
- Add `preinstall` scripts to all package.json files that need local react-on-rails
273+
- Use `link-source` scripts to build and publish packages with yalc
274+
- Avoid `file:` paths in package.json - use `link:.yalc/package-name` instead
275+
5. **Multiple Dummy Apps**: Don't forget to update ALL dummy apps:
276+
- `spec/dummy/` (main dummy app)
277+
- `react_on_rails_pro/spec/dummy/` (pro dummy app)
278+
- `react_on_rails_pro/spec/execjs-compatible-dummy/` (ExecJS dummy app)
279+
6. **CircleCI Optimization**: When using yalc with preinstall hooks:
280+
- Remove build-core-package job (handled by preinstall scripts)
281+
- Remove workspace sharing (yalc handles package distribution)
282+
- Keep existing cache strategy for performance
283+
7. **Dependency Management**: Update both Ruby and JS dependencies to use local versions:
284+
- Ruby: `path: "../.."` in gemspec and development dependencies
285+
- JS: `yalc add --link package-name` in preinstall hooks
286+
244287
---
245288

246289
### Phase 3: Pre-Monorepo Structure Preparation

0 commit comments

Comments
 (0)