Browse Source
Reviewed-on: https://gitea.anomalistdesign.com/trent_larson/crowd-funder-for-time-pwa/pulls/172didview-invalid-did-handling
19 changed files with 415 additions and 125 deletions
@ -0,0 +1,110 @@ |
|||||
|
#!/bin/bash |
||||
|
# check-dependencies.sh |
||||
|
# Author: Matthew Raymer |
||||
|
# Date: 2025-08-19 |
||||
|
# Description: Dependency validation script for TimeSafari development environment |
||||
|
# This script checks for critical dependencies required for building the application. |
||||
|
|
||||
|
# Exit on any error |
||||
|
set -e |
||||
|
|
||||
|
# Source common utilities |
||||
|
source "$(dirname "$0")/common.sh" |
||||
|
|
||||
|
print_header "TimeSafari Dependency Validation" |
||||
|
|
||||
|
log_info "Checking development environment dependencies..." |
||||
|
|
||||
|
# Check Node.js version |
||||
|
if command -v node &> /dev/null; then |
||||
|
NODE_VERSION=$(node --version) |
||||
|
log_info "Node.js version: $NODE_VERSION" |
||||
|
|
||||
|
# Extract major version number |
||||
|
MAJOR_VERSION=$(echo $NODE_VERSION | sed 's/v\([0-9]*\)\..*/\1/') |
||||
|
if [ "$MAJOR_VERSION" -lt 18 ]; then |
||||
|
log_error "Node.js version $NODE_VERSION is too old. Please upgrade to Node.js 18 or later." |
||||
|
exit 1 |
||||
|
fi |
||||
|
else |
||||
|
log_error "Node.js is not installed. Please install Node.js 18 or later." |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
# Check npm version |
||||
|
if command -v npm &> /dev/null; then |
||||
|
NPM_VERSION=$(npm --version) |
||||
|
log_info "npm version: $NPM_VERSION" |
||||
|
else |
||||
|
log_error "npm is not installed. Please install npm." |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
# Check if node_modules exists |
||||
|
if [ ! -d "node_modules" ]; then |
||||
|
log_error "node_modules directory not found." |
||||
|
log_info "Please run: npm install" |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
# Check critical dependencies |
||||
|
log_info "Validating critical packages..." |
||||
|
|
||||
|
CRITICAL_DEPS=("tsx" "capacitor-assets" "vite") |
||||
|
|
||||
|
for dep in "${CRITICAL_DEPS[@]}"; do |
||||
|
if [ -f "node_modules/.bin/$dep" ]; then |
||||
|
log_success "✓ $dep found" |
||||
|
else |
||||
|
log_error "✗ $dep not found in node_modules/.bin" |
||||
|
log_info "This usually means the package wasn't installed properly." |
||||
|
log_info "Try running: npm install" |
||||
|
exit 1 |
||||
|
fi |
||||
|
done |
||||
|
|
||||
|
# Check TypeScript via npx |
||||
|
if npx tsc --version &> /dev/null; then |
||||
|
TSC_VERSION=$(npx tsc --version) |
||||
|
log_success "✓ TypeScript found: $TSC_VERSION" |
||||
|
else |
||||
|
log_error "✗ TypeScript not accessible via npx" |
||||
|
log_info "Try running: npm install" |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
# Check Capacitor CLI |
||||
|
if command -v npx &> /dev/null; then |
||||
|
if npx cap --version &> /dev/null; then |
||||
|
CAP_VERSION=$(npx cap --version) |
||||
|
log_success "✓ Capacitor CLI version: $CAP_VERSION" |
||||
|
else |
||||
|
log_error "✗ Capacitor CLI not accessible via npx" |
||||
|
log_info "Try running: npm install @capacitor/cli" |
||||
|
exit 1 |
||||
|
fi |
||||
|
else |
||||
|
log_error "npx is not available. Please ensure npm is properly installed." |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
# Check Android development tools |
||||
|
if command -v adb &> /dev/null; then |
||||
|
log_success "✓ Android Debug Bridge (adb) found" |
||||
|
else |
||||
|
log_warn "⚠ Android Debug Bridge (adb) not found" |
||||
|
log_info "This is only needed for Android development and testing." |
||||
|
fi |
||||
|
|
||||
|
if command -v gradle &> /dev/null; then |
||||
|
GRADLE_VERSION=$(gradle --version | head -n 1) |
||||
|
log_success "✓ Gradle found: $GRADLE_VERSION" |
||||
|
else |
||||
|
log_warn "⚠ Gradle not found in PATH" |
||||
|
log_info "This is only needed if building outside of Android Studio." |
||||
|
fi |
||||
|
|
||||
|
log_success "Dependency validation completed successfully!" |
||||
|
log_info "Your development environment is ready for TimeSafari development." |
||||
|
|
||||
|
print_footer "Dependency Validation" |
@ -0,0 +1,62 @@ |
|||||
|
#!/bin/bash |
||||
|
# clean-android.sh |
||||
|
# Author: Matthew Raymer |
||||
|
# Date: 2025-08-19 |
||||
|
# Description: Clean Android app with timeout protection to prevent hanging |
||||
|
# This script safely uninstalls the TimeSafari app from connected Android devices |
||||
|
# with a 30-second timeout to prevent indefinite hanging. |
||||
|
|
||||
|
# Exit on any error |
||||
|
set -e |
||||
|
|
||||
|
# Source common utilities |
||||
|
source "$(dirname "$0")/common.sh" |
||||
|
|
||||
|
# Function to implement timeout for systems without timeout command |
||||
|
timeout_command() { |
||||
|
local timeout_seconds="$1" |
||||
|
shift |
||||
|
|
||||
|
# Check if timeout command exists |
||||
|
if command -v timeout &> /dev/null; then |
||||
|
timeout "$timeout_seconds" "$@" |
||||
|
else |
||||
|
# Fallback for systems without timeout (like macOS) |
||||
|
# Use perl to implement timeout |
||||
|
perl -e ' |
||||
|
eval { |
||||
|
local $SIG{ALRM} = sub { die "timeout" }; |
||||
|
alarm shift; |
||||
|
system @ARGV; |
||||
|
alarm 0; |
||||
|
}; |
||||
|
if ($@) { exit 1; } |
||||
|
' "$timeout_seconds" "$@" |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
log_info "Starting Android cleanup process..." |
||||
|
|
||||
|
# Check if adb is available |
||||
|
if ! command -v adb &> /dev/null; then |
||||
|
log_error "adb command not found. Please install Android SDK Platform Tools." |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
# Check for connected devices |
||||
|
log_info "Checking for connected Android devices..." |
||||
|
if adb devices | grep -q 'device$'; then |
||||
|
log_info "Android device(s) found. Attempting to uninstall app..." |
||||
|
|
||||
|
# Try to uninstall with timeout |
||||
|
if timeout_command 30 adb uninstall app.timesafari.app; then |
||||
|
log_success "Successfully uninstalled TimeSafari app" |
||||
|
else |
||||
|
log_warn "Uninstall failed or timed out after 30 seconds" |
||||
|
log_info "This is normal if the app wasn't installed or device is unresponsive" |
||||
|
fi |
||||
|
else |
||||
|
log_info "No Android devices connected. Skipping uninstall." |
||||
|
fi |
||||
|
|
||||
|
log_success "Android cleanup process completed" |
Loading…
Reference in new issue