-
-
Notifications
You must be signed in to change notification settings - Fork 352
Expand file tree
/
Copy pathconductor-setup.sh
More file actions
executable file
·223 lines (182 loc) · 6.9 KB
/
conductor-setup.sh
File metadata and controls
executable file
·223 lines (182 loc) · 6.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
#!/usr/bin/env zsh
# Conductor workspace setup script for react-native-reanimated-carousel
# This script initializes a new worktree by installing dependencies,
# building the library, and copying environment/config files not tracked by git.
set -e
echo "Setting up Conductor workspace..."
echo "Root path: $CONDUCTOR_ROOT_PATH"
echo "Workspace path: $CONDUCTOR_WORKSPACE_PATH"
# =============================================================================
# Reusable utility functions
# =============================================================================
# Function to copy a single file if it exists in the root worktree
copy_env_file() {
local relative_path="$1"
local source="$CONDUCTOR_ROOT_PATH/$relative_path"
local dest="$CONDUCTOR_WORKSPACE_PATH/$relative_path"
if [ -f "$source" ]; then
# Create parent directory if it doesn't exist
mkdir -p "$(dirname "$dest")"
cp "$source" "$dest"
echo " Copied: $relative_path"
fi
}
# Function to copy/sync a directory from root to workspace
copy_dir() {
local relative_path="$1"
local source="$CONDUCTOR_ROOT_PATH/$relative_path"
local dest="$CONDUCTOR_WORKSPACE_PATH/$relative_path"
if [ ! -d "$source" ]; then
echo " Warning: $relative_path not found in root, skipping"
return 0
fi
# Ensure parent exists
mkdir -p "$(dirname "$dest")"
# If dest exists but is not a directory, remove it
if [ -e "$dest" ] && [ ! -d "$dest" ]; then
echo " Warning: $relative_path exists as a non-directory, removing"
rm -f "$dest"
fi
# Ensure destination directory exists
mkdir -p "$dest"
# Sync contents (exclude git-tracked subdirectories to avoid deleting them)
local exclude_args=()
if [ "$relative_path" = ".claude" ]; then
exclude_args=(--exclude='skills/')
fi
if ! rsync -a --delete "${exclude_args[@]}" "$source/" "$dest/"; then
echo " Warning: rsync failed for $relative_path (broken symlink or missing file?)"
echo " Continuing setup..."
return 0
fi
echo " Synced: $relative_path"
}
# =============================================================================
# Install dependencies
# =============================================================================
# Install root library dependencies
echo ""
echo "Installing root library dependencies..."
cd "$CONDUCTOR_WORKSPACE_PATH"
yarn install
echo "Root dependencies installed successfully!"
# Build the library (needed because example/app links via "link:../..")
echo ""
echo "Building library (yarn prepare)..."
cd "$CONDUCTOR_WORKSPACE_PATH"
yarn prepare
echo "Library built successfully!"
# Install example app dependencies
echo ""
echo "Installing example app dependencies..."
if [ -d "$CONDUCTOR_WORKSPACE_PATH/example/app" ]; then
cd "$CONDUCTOR_WORKSPACE_PATH/example/app"
yarn install
cd "$CONDUCTOR_WORKSPACE_PATH"
echo "Example app dependencies installed successfully!"
else
echo "Warning: example/app directory not found, skipping"
fi
# Install example website dependencies
echo ""
echo "Installing example website dependencies..."
if [ -d "$CONDUCTOR_WORKSPACE_PATH/example/website" ]; then
cd "$CONDUCTOR_WORKSPACE_PATH/example/website"
yarn install
cd "$CONDUCTOR_WORKSPACE_PATH"
echo "Example website dependencies installed successfully!"
else
echo "Warning: example/website directory not found, skipping"
fi
# =============================================================================
# Copy environment files (git-ignored)
# =============================================================================
echo ""
echo "Copying environment files..."
env_files_to_copy=(
# Root env file (contains GITHUB_TOKEN, NPM_TOKEN — in .gitignore)
".env"
# Example app local env files (matched by .env*.local in example/app/.gitignore)
"example/app/.env.local"
"example/app/.env.development.local"
"example/app/.env.production.local"
)
for file in "${env_files_to_copy[@]}"; do
copy_env_file "$file"
done
echo "Environment files copied successfully!"
# =============================================================================
# Copy development tool configurations (git-ignored)
# =============================================================================
echo ""
echo "Copying development tool configurations..."
# .cursorrules — project-level Cursor rules (in .gitignore)
copy_env_file ".cursorrules"
# .cursorignore — Cursor ignore patterns (in .gitignore)
copy_env_file ".cursorignore"
# CLAUDE.md — Claude Code guidance file (in .gitignore)
copy_env_file "CLAUDE.md"
# Local markdown docs (matched by *.local.md in .gitignore)
# Find and copy any .local.md files from root
if compgen -G "$CONDUCTOR_ROOT_PATH"/*.local.md > /dev/null 2>&1; then
for f in "$CONDUCTOR_ROOT_PATH"/*.local.md; do
local_md_name="$(basename "$f")"
cp "$f" "$CONDUCTOR_WORKSPACE_PATH/$local_md_name"
echo " Copied: $local_md_name"
done
fi
# .claude/ directory (in .gitignore)
if [ -d "$CONDUCTOR_ROOT_PATH/.claude" ]; then
echo ""
echo "Syncing .claude directory..."
copy_dir ".claude"
fi
# .vscode/ directory (in .gitignore)
if [ -d "$CONDUCTOR_ROOT_PATH/.vscode" ]; then
echo ""
echo "Syncing .vscode directory..."
copy_dir ".vscode"
fi
# .cursor/ directory (settings, rules, etc.)
if [ -d "$CONDUCTOR_ROOT_PATH/.cursor" ]; then
echo ""
echo "Syncing .cursor directory..."
copy_dir ".cursor"
fi
# .codex/ directory (if exists)
if [ -d "$CONDUCTOR_ROOT_PATH/.codex" ]; then
echo ""
echo "Syncing .codex directory..."
copy_dir ".codex"
fi
# .issue-tasks/ directory (in .gitignore)
if [ -d "$CONDUCTOR_ROOT_PATH/.issue-tasks" ]; then
echo ""
echo "Syncing .issue-tasks directory..."
copy_dir ".issue-tasks"
fi
# .conductor/ directory (conductor config)
if [ -d "$CONDUCTOR_ROOT_PATH/.conductor" ]; then
echo ""
echo "Syncing .conductor directory..."
copy_dir ".conductor"
fi
# =============================================================================
# Copy iOS native dependencies (CocoaPods Pods) to avoid re-installation
# =============================================================================
echo ""
echo "Copying iOS native dependencies (CocoaPods Pods)..."
# Copy example/app iOS Pods directory if it exists
if [ -d "$CONDUCTOR_ROOT_PATH/example/app/ios/Pods" ]; then
echo " Found Pods directory in root, copying to workspace..."
copy_dir "example/app/ios/Pods"
# Also copy Podfile.lock if it exists (ensures version consistency)
if [ -f "$CONDUCTOR_ROOT_PATH/example/app/ios/Podfile.lock" ]; then
copy_env_file "example/app/ios/Podfile.lock"
fi
echo " iOS Pods copied successfully! This will skip CocoaPods installation."
else
echo " No Pods directory found in root, CocoaPods will install on first run."
fi
echo ""
echo "🎉 Conductor workspace setup complete!"