Skip to content

Commit 4c887d6

Browse files
authored
fix: improve GitHub bot setup script with error handling and validation (#140)
* fix: improve GitHub bot setup script with error handling and validation Added Node.js version compatibility check, colored output, and better error handling. Included complete command reference and interactive verification steps. Closes #139 * fix: resolve setup script dependency issues Added prettier as devDependency and updated lint script to use npx. Fixed type checking and linting pipeline for proper development environment. Closes #139 Generated by Claude Code Bot * chore: reverted some changes --------- Co-authored-by: ZerGo0 <ZerGo0@users.noreply.github.com>
1 parent 8820a77 commit 4c887d6

File tree

3 files changed

+91
-13
lines changed

3 files changed

+91
-13
lines changed

claude-code-github-bot-setup.sh

Lines changed: 87 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,110 @@
11
#!/bin/bash
22
set -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 "=========================="
619
echo ""
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..."
939
if ! 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
1247
else
13-
echo "pnpm is already installed ($(pnpm --version))"
48+
print_success "pnpm is already installed ($(pnpm --version))"
1449
fi
1550

1651
# Install dependencies if package.json exists
1752
if [ -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
2868
else
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
3072
fi
3173

3274
echo ""
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"
34106
echo ""
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"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"clsx": "^2.1.1",
2626
"lucide-svelte": "^0.525.0",
2727
"postcss": "^8.5.6",
28+
"prettier": "^3.4.2",
2829
"prettier-plugin-svelte": "^3.3.3",
2930
"prettier-plugin-tailwindcss": "^0.6.13",
3031
"svelte": "^5.35.2",

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)