analysis/monorepo/YALC_ALTERNATIVES_ANALYSIS.md
Purpose: Evaluate alternatives to YALC for local package development in the React on Rails monorepo
Current Pain Points with YALC:
yalc publish required after changes.yalc directory and lock file managementpnpm is a fast, disk-space-efficient package manager with excellent monorepo support built-in.
"react-on-rails": "workspace:*" for local depspnpm --filter <package> for targeted operations# 1. Install pnpm
npm install -g pnpm
# 2. Import yarn.lock (converts to pnpm-lock.yaml)
pnpm import
# 3. Update package.json workspaces (syntax is the same)
# No changes needed to workspace configuration
# 4. Update dependencies in package.json
# Change from:
# "react-on-rails": "16.2.0-beta.10"
# To:
# "react-on-rails": "workspace:*"
# 5. Install
pnpm install
# 6. Update scripts
# Replace "yarn" with "pnpm" in scripts and CI
# Install dependencies
pnpm install
# Build specific package
pnpm --filter react-on-rails build
# Build all packages
pnpm -r build # recursive
# Run tests in specific package
pnpm --filter react-on-rails-pro test
# Add dependency to specific package
pnpm --filter react-on-rails-pro add lodash
# No yalc needed - changes are automatically linked!
Use built-in yarn link instead of yalc, leveraging existing Yarn workspaces.
yarn link)Current Problem: Why is yalc needed if workspaces exist?
Answer: Workspace packages are auto-linked by Yarn! You might not need yalc OR yarn link.
# In a workspace, packages should auto-link
cd packages/react-on-rails-pro
yarn install
# Check if react-on-rails is linked
ls -la node_modules/react-on-rails
# Should be a symlink to ../../react-on-rails
If auto-linking works: Remove yalc entirely!
If you need to link to external projects:
# In package directory
cd packages/react-on-rails
yarn link
# In external project
cd ~/my-rails-app
yarn link react-on-rails
npm 7+ has built-in workspace support similar to Yarn.
Build orchestration tool that wraps pnpm/yarn/npm with caching and task scheduling.
Original JavaScript monorepo tool, now maintained by Nx team.
Keep yalc but integrate into workspace scripts for automatic publishing.
// In each package.json
{
"scripts": {
"dev": "concurrently \"yarn build-watch\" \"yarn yalc:publish:watch\"",
"yalc:publish:watch": "nodemon --watch lib --exec 'yalc publish'"
}
}
Or use onchange package:
{
"scripts": {
"yalc:auto": "onchange 'lib/**' -- yalc publish"
}
}
| Feature | YALC (Current) | pnpm | Yarn + link | npm | Turborepo |
|---|---|---|---|---|---|
| Auto-linking | ❌ Manual | ✅ Yes | ✅ Yes* | ✅ Yes* | ✅ Yes |
| Speed | ⚠️ Medium | 🚀 Fast | ⚠️ Medium | 🐌 Slow | 🚀 Fast |
| Disk Usage | ➖ Normal | ✅ Efficient | ➖ Normal | ❌ Wasteful | ➖ Normal |
| Caching | ❌ No | ✅ Yes | ❌ No | ⚠️ Basic | 🚀 Advanced |
| Learning Curve | ⚠️ Medium | ⚠️ Medium | ✅ Low | ✅ Low | ❌ High |
| Migration Effort | - | ⚠️ 2-4h | ✅ 1-2h | ⚠️ 4-6h | ❌ 8-16h |
| Recommendation | ❌ Replace | ⭐ Best | ✅ Quick win | ❌ Skip | ⚠️ Overkill |
*Workspaces auto-link within monorepo; yarn/npm link needed for external projects only
✅ Do: Remove yalc reliance within monorepo
yarn install automatically links packages⭐ Recommended: Migrate to pnpm
✅ Acceptable: Keep Yarn workspaces, remove yalc
yarn link only for external testingIf auto-linking works:
If auto-linking doesn't work:
Before removing yalc, verify:
Workspace packages auto-link:
cd packages/react-on-rails-pro
yarn install
ls -la node_modules/react-on-rails # Should be symlink
Changes propagate without republish:
# Make change in react-on-rails
# Build react-on-rails
yarn workspace react-on-rails build
# Verify change visible in react-on-rails-pro without yalc publish
Builds work in correct order:
yarn build # Should build core first, then pro packages
For React on Rails Monorepo:
Bottom line: You probably don't need yalc for a 3-package monorepo with Yarn workspaces. Fix auto-linking if it's not working, don't add more tools.