mirror of
https://github.com/tiennm99/coolify.git
synced 2026-05-05 21:35:40 +00:00
Add automatic shared dependencies for worktrees
Setup Conductor to automatically share node_modules and vendor directories across all git worktrees to save disk space and speed up development. Changes: - Updated conductor-setup.sh to create symlinks to shared dependencies - Added documentation to CLAUDE.md explaining the system - Dependencies now stored in .shared-deps/ in main repository - All worktrees use the same dependency versions automatically Benefits: - Saves hundreds of MBs to GBs of disk space - No need to run npm install/composer install for each worktree - Consistent dependency versions across all worktrees Note: Add .shared-deps/ to .gitignore in the main repository 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,44 @@ This file provides guidance to **Claude Code** (claude.ai/code) when working wit
|
|||||||
|
|
||||||
Coolify is an open-source, self-hostable platform for deploying applications and managing servers - an alternative to Heroku/Netlify/Vercel. It's built with Laravel (PHP) and uses Docker for containerization.
|
Coolify is an open-source, self-hostable platform for deploying applications and managing servers - an alternative to Heroku/Netlify/Vercel. It's built with Laravel (PHP) and uses Docker for containerization.
|
||||||
|
|
||||||
|
## Git Worktree Shared Dependencies
|
||||||
|
|
||||||
|
This repository uses git worktrees for parallel development with **automatic shared dependency setup** via Conductor.
|
||||||
|
|
||||||
|
### 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
|
||||||
|
3. This happens automatically when Conductor creates a new worktree
|
||||||
|
|
||||||
|
### Benefits
|
||||||
|
|
||||||
|
- **Save disk space**: Only one copy of dependencies across all worktrees
|
||||||
|
- **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
|
||||||
|
|
||||||
|
### Manual Setup (If Needed)
|
||||||
|
|
||||||
|
If you need to set up symlinks manually or for non-Conductor worktrees:
|
||||||
|
|
||||||
|
```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
|
||||||
|
```
|
||||||
|
|
||||||
|
### 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)
|
||||||
|
- If different branches need different dependency versions, this won't work - remove symlinks and use separate directories
|
||||||
|
|
||||||
## Development Commands
|
## Development Commands
|
||||||
|
|
||||||
### Frontend Development
|
### Frontend Development
|
||||||
|
|||||||
@@ -1 +1,29 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Copy .env file
|
||||||
cp $CONDUCTOR_ROOT_PATH/.env .env
|
cp $CONDUCTOR_ROOT_PATH/.env .env
|
||||||
|
|
||||||
|
# Setup shared dependencies via symlinks
|
||||||
|
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"
|
||||||
|
|
||||||
|
# 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
|
||||||
|
WORKTREE_PATH=$(pwd)
|
||||||
|
RELATIVE_PATH=$(python3 -c "import os.path; print(os.path.relpath('$SHARED_DEPS', '$WORKTREE_PATH'))")
|
||||||
|
|
||||||
|
# Create symlinks
|
||||||
|
ln -sf "$RELATIVE_PATH/node_modules" node_modules
|
||||||
|
ln -sf "$RELATIVE_PATH/vendor" vendor
|
||||||
|
|
||||||
|
echo "✓ Shared dependencies linked successfully"
|
||||||
|
echo " node_modules -> $RELATIVE_PATH/node_modules"
|
||||||
|
echo " vendor -> $RELATIVE_PATH/vendor"
|
||||||
Reference in New Issue
Block a user