-
-
Save cbh123/10b4e522252eb9d900872921fbeb736d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Script to set up an isolated development instance of Conductor | |
| # Usage: pnpm run setup [workspace-name] | |
| # Get the directory containing this script | |
| SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
| # Get the parent directory (the repo root) | |
| REPO_DIR="$( cd "$SCRIPT_DIR/.." && pwd )" | |
| # Get just the directory name | |
| DEFAULT_WORKSPACE_NAME="$(basename "$REPO_DIR")" | |
| # Get the workspace name name from the first argument, or use the directory name if not provided | |
| WORKSPACE_NAME="${1:-$DEFAULT_WORKSPACE_NAME}" | |
| # If the workspace name is not filesystem-safe, abort | |
| if ! echo "$WORKSPACE_NAME" | sed 's/[^a-zA-Z0-9_-]/_/g' >/dev/null 2>&1; then | |
| echo "Workspace name is not filesystem-safe" | |
| exit 1 | |
| fi | |
| # Create the unique identifier | |
| IDENTIFIER="com.conductor.app.dev.$WORKSPACE_NAME" | |
| echo "Setting up Conductor development workspace: $WORKSPACE_NAME" | |
| echo "App identifier: $IDENTIFIER" | |
| # Install dependencies | |
| echo "Installing dependencies..." | |
| pnpm i | |
| # Initialize sidecar | |
| pnpm run build:sidecar | |
| # Create the Application Support directory | |
| APP_SUPPORT_DIR="$HOME/Library/Application Support" | |
| WORKSPACE_DIR="$APP_SUPPORT_DIR/$IDENTIFIER" | |
| if [ ! -d "$WORKSPACE_DIR" ]; then | |
| echo "Creating data directory: $WORKSPACE_DIR" | |
| mkdir -p "$WORKSPACE_DIR" | |
| else | |
| echo "Data directory already exists: $WORKSPACE_DIR" | |
| fi | |
| # Generate custom icon with ImageMagick if available | |
| if command -v magick >/dev/null 2>&1; then | |
| echo "" | |
| echo "Generating custom icon..." | |
| # Create workspace icons directory | |
| ICONS_DIR="$WORKSPACE_DIR/icons" | |
| mkdir -p "$ICONS_DIR" | |
| # Generate icon with workspace name overlay | |
| # Use the dev icon as base | |
| BASE_ICON="$REPO_DIR/src-tauri/icons/icon_dev.png" | |
| OUTPUT_ICON="$ICONS_DIR/icon.png" | |
| # Create icon with text overlay | |
| # Position text in the bottom third of the icon | |
| magick "$BASE_ICON" \ | |
| -gravity South \ | |
| -pointsize 86 \ | |
| -font Arial-Bold \ | |
| -fill white \ | |
| -stroke black \ | |
| -strokewidth 2 \ | |
| -annotate +0+60 "$WORKSPACE_NAME" \ | |
| "$OUTPUT_ICON" | |
| # Also create the .icns file for macOS | |
| # First create required sizes | |
| mkdir -p "$ICONS_DIR/icon.iconset" | |
| # Generate all required sizes for iconset | |
| magick "$OUTPUT_ICON" -resize 16x16 "$ICONS_DIR/icon.iconset/icon_16x16.png" | |
| magick "$OUTPUT_ICON" -resize 32x32 "$ICONS_DIR/icon.iconset/icon_16x16@2x.png" | |
| magick "$OUTPUT_ICON" -resize 32x32 "$ICONS_DIR/icon.iconset/icon_32x32.png" | |
| magick "$OUTPUT_ICON" -resize 64x64 "$ICONS_DIR/icon.iconset/icon_32x32@2x.png" | |
| magick "$OUTPUT_ICON" -resize 128x128 "$ICONS_DIR/icon.iconset/icon_128x128.png" | |
| magick "$OUTPUT_ICON" -resize 256x256 "$ICONS_DIR/icon.iconset/icon_128x128@2x.png" | |
| magick "$OUTPUT_ICON" -resize 256x256 "$ICONS_DIR/icon.iconset/icon_256x256.png" | |
| magick "$OUTPUT_ICON" -resize 512x512 "$ICONS_DIR/icon.iconset/icon_256x256@2x.png" | |
| magick "$OUTPUT_ICON" -resize 512x512 "$ICONS_DIR/icon.iconset/icon_512x512.png" | |
| magick "$OUTPUT_ICON" -resize 1024x1024 "$ICONS_DIR/icon.iconset/icon_512x512@2x.png" | |
| # Convert to .icns | |
| iconutil -c icns "$ICONS_DIR/icon.iconset" -o "$ICONS_DIR/icon.icns" 2>/dev/null || true | |
| # Clean up iconset | |
| rm -rf "$ICONS_DIR/icon.iconset" | |
| echo "✓ Custom icon generated!" | |
| else | |
| echo "" | |
| echo "⚠ ImageMagick not found - skipping icon generation" | |
| echo " Install with: brew install imagemagick" | |
| fi | |
| echo "" | |
| echo "✅ Setup complete! You can now run:" | |
| echo " pnpm run dev" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment