mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 17:21:04 +00:00
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:
16
CLAUDE.md
16
CLAUDE.md
@@ -17,8 +17,8 @@ This repository uses git worktrees for parallel development with **automatic sha
|
|||||||
### How It Works
|
### How It Works
|
||||||
|
|
||||||
The `conductor.json` setup script (`scripts/conductor-setup.sh`) automatically:
|
The `conductor.json` setup script (`scripts/conductor-setup.sh`) automatically:
|
||||||
1. Creates a shared `.shared-deps/` directory in the main repository
|
1. Creates symlinks from worktree's `node_modules` and `vendor` to the main repository's directories
|
||||||
2. Creates symlinks from `node_modules` and `vendor` to the shared location
|
2. All worktrees share the same dependencies from the main repository
|
||||||
3. This happens automatically when Conductor creates a new worktree
|
3. This happens automatically when Conductor creates a new worktree
|
||||||
|
|
||||||
### Benefits
|
### Benefits
|
||||||
@@ -27,6 +27,7 @@ The `conductor.json` setup script (`scripts/conductor-setup.sh`) automatically:
|
|||||||
- **Faster setup**: No need to run `npm install` or `composer install` for each worktree
|
- **Faster setup**: No need to run `npm install` or `composer install` for each worktree
|
||||||
- **Consistent versions**: All worktrees use the same dependency versions
|
- **Consistent versions**: All worktrees use the same dependency versions
|
||||||
- **Auto-configured**: Handled by Conductor's setup script
|
- **Auto-configured**: Handled by Conductor's setup script
|
||||||
|
- **Simple**: Uses the main repo's existing directories, no extra folders
|
||||||
|
|
||||||
### Manual Setup (If Needed)
|
### Manual Setup (If Needed)
|
||||||
|
|
||||||
@@ -34,18 +35,15 @@ If you need to set up symlinks manually or for non-Conductor worktrees:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# From the worktree directory
|
# From the worktree directory
|
||||||
SHARED_DEPS="../../.shared-deps"
|
|
||||||
mkdir -p "$SHARED_DEPS/node_modules" "$SHARED_DEPS/vendor"
|
|
||||||
rm -rf node_modules vendor
|
rm -rf node_modules vendor
|
||||||
ln -sf "$SHARED_DEPS/node_modules" node_modules
|
ln -sf ../../node_modules node_modules
|
||||||
ln -sf "$SHARED_DEPS/vendor" vendor
|
ln -sf ../../vendor vendor
|
||||||
```
|
```
|
||||||
|
|
||||||
### Important Notes
|
### Important Notes
|
||||||
|
|
||||||
- Dependencies are shared at `$CONDUCTOR_ROOT_PATH/.shared-deps/`
|
- Dependencies are shared from the main repository (`$CONDUCTOR_ROOT_PATH`)
|
||||||
- Run `npm install` or `composer install` from any worktree to update all
|
- Run `npm install` or `composer install` from the main repo or any worktree to update all
|
||||||
- Ensure `.shared-deps/` is in `.gitignore` (should already be there)
|
|
||||||
- If different branches need different dependency versions, this won't work - remove symlinks and use separate directories
|
- If different branches need different dependency versions, this won't work - remove symlinks and use separate directories
|
||||||
|
|
||||||
## Development Commands
|
## Development Commands
|
||||||
|
|||||||
@@ -4,23 +4,22 @@ set -e
|
|||||||
# Copy .env file
|
# Copy .env file
|
||||||
cp $CONDUCTOR_ROOT_PATH/.env .env
|
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..."
|
echo "Setting up shared node_modules and vendor directories..."
|
||||||
|
|
||||||
# Create shared-deps directory in main repository if it doesn't exist
|
# Ensure main repo has the directories
|
||||||
SHARED_DEPS="$CONDUCTOR_ROOT_PATH/.shared-deps"
|
mkdir -p "$CONDUCTOR_ROOT_PATH/node_modules"
|
||||||
mkdir -p "$SHARED_DEPS/node_modules"
|
mkdir -p "$CONDUCTOR_ROOT_PATH/vendor"
|
||||||
mkdir -p "$SHARED_DEPS/vendor"
|
|
||||||
|
|
||||||
# Remove existing directories if they exist and are not symlinks
|
# Remove existing directories if they exist and are not symlinks
|
||||||
[ -d "node_modules" ] && [ ! -L "node_modules" ] && rm -rf node_modules
|
[ -d "node_modules" ] && [ ! -L "node_modules" ] && rm -rf node_modules
|
||||||
[ -d "vendor" ] && [ ! -L "vendor" ] && rm -rf vendor
|
[ -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)
|
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/node_modules" node_modules
|
||||||
ln -sf "$RELATIVE_PATH/vendor" vendor
|
ln -sf "$RELATIVE_PATH/vendor" vendor
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user