Use main repo directories for shared dependencies

Simplified the worktree setup to use the main repository's node_modules
and vendor directories directly instead of creating a separate .shared-deps
directory.

Changes:
- Updated conductor-setup.sh to symlink directly to main repo's directories
- Updated CLAUDE.md to reflect the simpler approach
- Symlinks now point to ../../node_modules and ../../vendor

Benefits:
- Simpler setup with no extra directories
- All worktrees share the main repo's dependencies
- No need to add .shared-deps to .gitignore

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai 2025-11-14 13:06:25 +01:00
parent ad148eca60
commit b847e3801a
2 changed files with 14 additions and 17 deletions

View file

@ -17,8 +17,8 @@ ## Git Worktree Shared Dependencies
### How It Works
The `conductor.json` setup script (`scripts/conductor-setup.sh`) automatically:
1. Creates a shared `.shared-deps/` directory in the main repository
2. Creates symlinks from `node_modules` and `vendor` to the shared location
1. Creates symlinks from worktree's `node_modules` and `vendor` to the main repository's directories
2. All worktrees share the same dependencies from the main repository
3. This happens automatically when Conductor creates a new worktree
### Benefits
@ -27,6 +27,7 @@ ### Benefits
- **Faster setup**: No need to run `npm install` or `composer install` for each worktree
- **Consistent versions**: All worktrees use the same dependency versions
- **Auto-configured**: Handled by Conductor's setup script
- **Simple**: Uses the main repo's existing directories, no extra folders
### Manual Setup (If Needed)
@ -34,18 +35,15 @@ ### Manual Setup (If Needed)
```bash
# From the worktree directory
SHARED_DEPS="../../.shared-deps"
mkdir -p "$SHARED_DEPS/node_modules" "$SHARED_DEPS/vendor"
rm -rf node_modules vendor
ln -sf "$SHARED_DEPS/node_modules" node_modules
ln -sf "$SHARED_DEPS/vendor" vendor
ln -sf ../../node_modules node_modules
ln -sf ../../vendor vendor
```
### Important Notes
- Dependencies are shared at `$CONDUCTOR_ROOT_PATH/.shared-deps/`
- Run `npm install` or `composer install` from any worktree to update all
- Ensure `.shared-deps/` is in `.gitignore` (should already be there)
- Dependencies are shared from the main repository (`$CONDUCTOR_ROOT_PATH`)
- Run `npm install` or `composer install` from the main repo or any worktree to update all
- If different branches need different dependency versions, this won't work - remove symlinks and use separate directories
## Development Commands

View file

@ -4,23 +4,22 @@ set -e
# Copy .env file
cp $CONDUCTOR_ROOT_PATH/.env .env
# Setup shared dependencies via symlinks
# Setup shared dependencies via symlinks to main repo
echo "Setting up shared node_modules and vendor directories..."
# Create shared-deps directory in main repository if it doesn't exist
SHARED_DEPS="$CONDUCTOR_ROOT_PATH/.shared-deps"
mkdir -p "$SHARED_DEPS/node_modules"
mkdir -p "$SHARED_DEPS/vendor"
# Ensure main repo has the directories
mkdir -p "$CONDUCTOR_ROOT_PATH/node_modules"
mkdir -p "$CONDUCTOR_ROOT_PATH/vendor"
# Remove existing directories if they exist and are not symlinks
[ -d "node_modules" ] && [ ! -L "node_modules" ] && rm -rf node_modules
[ -d "vendor" ] && [ ! -L "vendor" ] && rm -rf vendor
# Calculate relative path from worktree to shared deps
# Calculate relative path from worktree to main repo
WORKTREE_PATH=$(pwd)
RELATIVE_PATH=$(python3 -c "import os.path; print(os.path.relpath('$SHARED_DEPS', '$WORKTREE_PATH'))")
RELATIVE_PATH=$(python3 -c "import os.path; print(os.path.relpath('$CONDUCTOR_ROOT_PATH', '$WORKTREE_PATH'))")
# Create symlinks
# Create symlinks to main repo's node_modules and vendor
ln -sf "$RELATIVE_PATH/node_modules" node_modules
ln -sf "$RELATIVE_PATH/vendor" vendor