-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-setup.sh
More file actions
executable file
·106 lines (95 loc) · 3.34 KB
/
test-setup.sh
File metadata and controls
executable file
·106 lines (95 loc) · 3.34 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
#!/bin/bash
# Test Setup Script for WooCommerce thirdweb Checkout Plugin
# This script helps you set up a local test environment
echo "🧪 WooCommerce thirdweb Checkout - Local Test Setup"
echo ""
# Check if build exists
if [ ! -d "build" ] || [ ! -f "build/index.tsx.js" ]; then
echo "❌ Build files not found. Running build..."
pnpm run build
if [ $? -ne 0 ]; then
echo "❌ Build failed. Please fix errors and try again."
exit 1
fi
fi
echo "✅ Build files exist"
echo ""
# Check PHP syntax
echo "🔍 Checking PHP syntax..."
find . -name "*.php" -not -path "./node_modules/*" -not -path "./vendor/*" | while read file; do
php -l "$file" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "❌ Syntax error in: $file"
php -l "$file"
exit 1
fi
done
echo "✅ PHP syntax OK"
echo ""
# List WordPress installation paths
echo "📂 Common WordPress installation paths:"
echo " - LocalWP: ~/Local Sites/[site-name]/app/public/wp-content/plugins/"
echo " - MAMP: /Applications/MAMP/htdocs/wordpress/wp-content/plugins/"
echo " - Docker: Check your docker-compose volumes"
echo ""
echo "📋 Installation options:"
echo ""
echo "1. Symlink (recommended for development):"
echo " ln -s $(pwd) ~/Local\\ Sites/YOUR_SITE/app/public/wp-content/plugins/thirdweb-woocommerce-checkout"
echo ""
echo "2. Copy (for testing):"
echo " cp -r $(pwd) ~/Local\\ Sites/YOUR_SITE/app/public/wp-content/plugins/thirdweb-woocommerce-checkout"
echo ""
echo "3. Package as ZIP:"
echo " pnpm run package"
echo " Upload: dist/thirdweb-woocommerce-checkout.zip via WordPress Admin"
echo ""
# Check for .env file
if [ -f ".env" ]; then
echo "✅ .env file found"
if grep -q "THIRDWEB_CLIENT_ID=" .env; then
CLIENT_ID=$(grep "THIRDWEB_CLIENT_ID=" .env | cut -d '=' -f 2 | tr -d '"' | tr -d "'")
if [ -n "$CLIENT_ID" ] && [ "$CLIENT_ID" != "your_client_id_here" ]; then
echo " Client ID configured: ${CLIENT_ID:0:20}..."
else
echo "⚠️ Client ID not set in .env file"
fi
fi
else
echo "⚠️ No .env file found (optional for development)"
echo " Create one with: cp .env.example .env"
fi
echo ""
# Check for test app
if [ -d "test-app" ]; then
echo "✅ test-app/ directory found for standalone testing"
if [ -f "test-app/.env" ]; then
echo " Test app configured"
else
echo "⚠️ No .env file in test-app/ (needed for testing)"
echo " Create one with: cd test-app && cp .env.example .env"
fi
else
echo "⚠️ No test-app/ directory found"
fi
echo ""
echo "🎯 Next steps:"
echo ""
echo "Option 1: Test CheckoutWidget standalone (recommended first step)"
echo " cd test-app && pnpm install && cp .env.example .env"
echo " Edit test-app/.env with your credentials"
echo " pnpm dev"
echo ""
echo "Option 2: Test with WordPress"
echo "1. Install WordPress locally (LocalWP, MAMP, or Docker)"
echo "2. Install WooCommerce plugin"
echo "3. Link/copy this plugin to wp-content/plugins/"
echo "4. Activate plugin in WordPress Admin"
echo "5. Configure settings: WooCommerce → Settings → Payments"
echo "6. Create test product and try checkout"
echo ""
echo "📖 For Base Sepolia testnet:"
echo " Chain ID: 84532"
echo " Get testnet ETH: https://www.alchemy.com/faucets/base-sepolia"
echo ""
echo "✅ Setup check complete!"