11#! /bin/bash
22set -e
33
4- echo " Claude Code GitHub Bot Setup Script"
5- echo " ==================================="
4+ # Colors for output
5+ RED=' \033[0;31m'
6+ GREEN=' \033[0;32m'
7+ YELLOW=' \033[1;33m'
8+ BLUE=' \033[0;34m'
9+ NC=' \033[0m' # No Color
10+
11+ # Function to print colored output
12+ print_info () { echo -e " ${BLUE} ℹ${NC} $1 " ; }
13+ print_success () { echo -e " ${GREEN} ✓${NC} $1 " ; }
14+ print_warning () { echo -e " ${YELLOW} ⚠${NC} $1 " ; }
15+ print_error () { echo -e " ${RED} ✗${NC} $1 " ; }
16+
17+ echo -e " ${BLUE} Ftv Extension Setup Script${NC} "
18+ echo " =========================="
619echo " "
720
21+ # Check Node.js version
22+ print_info " Checking Node.js version..."
23+ if ! command -v node & > /dev/null; then
24+ print_error " Node.js is not installed. Please install Node.js 18+ first."
25+ exit 1
26+ fi
27+
28+ NODE_VERSION=$( node --version | cut -d' v' -f2)
29+ REQUIRED_VERSION=" 18.0.0"
30+
31+ if ! node -p " process.exit(process.version.slice(1) >= '$REQUIRED_VERSION ' ? 0 : 1)" 2> /dev/null; then
32+ print_warning " Node.js version $NODE_VERSION detected. Node.js 18+ is recommended."
33+ else
34+ print_success " Node.js version $NODE_VERSION is compatible"
35+ fi
36+
837# Check if pnpm is available
38+ print_info " Checking pnpm installation..."
939if ! command -v pnpm & > /dev/null; then
10- echo " Installing pnpm..."
11- npm install -g pnpm
40+ print_info " Installing pnpm..."
41+ if npm install -g pnpm; then
42+ print_success " pnpm installed successfully"
43+ else
44+ print_error " Failed to install pnpm"
45+ exit 1
46+ fi
1247else
13- echo " ✓ pnpm is already installed ($( pnpm --version) )"
48+ print_success " pnpm is already installed ($( pnpm --version) )"
1449fi
1550
1651# Install dependencies if package.json exists
1752if [ -f " package.json" ]; then
1853 echo " "
19- echo " Installing project dependencies..."
54+ print_info " Installing project dependencies..."
2055
2156 # Check if it's a pnpm project
2257 if [ -f " pnpm-lock.yaml" ]; then
23- echo " Detected pnpm project, installing with pnpm..."
24- pnpm install
58+ print_info " Detected pnpm project, installing with pnpm..."
59+ if pnpm install; then
60+ print_success " Dependencies installed successfully"
61+ else
62+ print_error " Failed to install dependencies"
63+ exit 1
64+ fi
2565 else
26- echo " No pnpm-lock.yaml found, skipping dependency installation"
66+ print_warning " No pnpm-lock.yaml found, skipping dependency installation"
2767 fi
2868else
29- echo " No package.json found, skipping dependency installation"
69+ print_error " No package.json found in current directory"
70+ print_info " Please run this script from the project root directory"
71+ exit 1
3072fi
3173
3274echo " "
33- echo " Setup complete!"
75+ print_success " Setup complete!"
76+
77+ # Optional verification step
78+ print_info " Running verification checks..."
79+
80+ print_info " Running Svelte type checking..."
81+ if pnpm check; then
82+ print_success " Type checking passed"
83+ else
84+ print_warning " Type checking failed - you may need to fix type errors"
85+ fi
86+
87+ print_info " Running code formatting..."
88+ if pnpm lint; then
89+ print_success " Code formatting completed"
90+ else
91+ print_warning " Code formatting encountered issues"
92+ fi
93+
94+ print_success " Verification complete!"
95+
96+ echo " "
97+ echo -e " ${BLUE} Available commands:${NC} "
98+ echo " ${GREEN} pnpm dev${NC} - Start development server"
99+ echo " ${GREEN} pnpm dev:firefox${NC} - Start development server for Firefox"
100+ echo " ${GREEN} pnpm build${NC} - Build extension for Chrome (MV3)"
101+ echo " ${GREEN} pnpm build:firefox${NC} - Build extension for Firefox (MV2)"
102+ echo " ${GREEN} pnpm check${NC} - Run Svelte type checking"
103+ echo " ${GREEN} pnpm lint${NC} - Format code with Prettier"
104+ echo " ${GREEN} pnpm zip${NC} - Create distribution zip files"
105+ echo " ${GREEN} pnpm release${NC} - Build and zip for both browsers"
34106echo " "
35- echo " Available commands:"
36- echo " - pnpm check (for Ftv extension project)"
107+ echo -e " ${BLUE} Next steps:${NC} "
108+ echo " 1. Run ${GREEN} pnpm check && pnpm lint${NC} to verify everything is working"
109+ echo " 2. Run ${GREEN} pnpm dev${NC} to start development"
110+ echo " 3. Load the extension in your browser's developer mode"
0 commit comments