Skip to content

Commit 3b0d432

Browse files
committed
fix: run pnpm install during workspace creation
1 parent 3194f78 commit 3b0d432

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

src/crabcode

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,37 @@ create_workspace() {
572572
# Sync .env files (pass workspace number for port calculation)
573573
sync_env_files "$workspace_dir" "$num"
574574

575+
# Install dependencies (force install for new workspaces)
576+
local install_cmd=$(config_get "install_command" "")
577+
if [ -n "$install_cmd" ]; then
578+
echo -e "${YELLOW}Installing dependencies...${NC}"
579+
cd "$workspace_dir"
580+
if eval "$install_cmd"; then
581+
touch "$workspace_dir/node_modules/.crabcode-installed"
582+
echo -e "${GREEN}Dependencies installed${NC}"
583+
else
584+
warn "Failed to install dependencies - run manually: $install_cmd"
585+
fi
586+
587+
# Install submodule dependencies
588+
local submodules_count=$(yq -r '.submodules | length // 0' "$CONFIG_FILE" 2>/dev/null)
589+
for ((i=0; i<submodules_count; i++)); do
590+
local sub_path=$(yq -r ".submodules[$i].path" "$CONFIG_FILE" 2>/dev/null)
591+
local sub_install=$(yq -r ".submodules[$i].install_command // \"\"" "$CONFIG_FILE" 2>/dev/null)
592+
[ -z "$sub_path" ] || [ "$sub_path" = "null" ] && continue
593+
[ -z "$sub_install" ] || [ "$sub_install" = "null" ] && continue
594+
595+
if [ -d "$workspace_dir/$sub_path" ]; then
596+
echo -e "${YELLOW}Installing $sub_path dependencies...${NC}"
597+
cd "$workspace_dir/$sub_path"
598+
if eval "$sub_install"; then
599+
touch "$workspace_dir/$sub_path/node_modules/.crabcode-installed"
600+
fi
601+
cd "$workspace_dir"
602+
fi
603+
done
604+
fi
605+
575606
success "Workspace $num created at $workspace_dir"
576607
}
577608

0 commit comments

Comments
 (0)