feat(dev): enhance development environment and dependency management

- Add comprehensive environment setup documentation to README.md
- Add check:dependencies npm script for environment validation
- Update build scripts to use npx for local dependencies
- Enhance Android build script with dependency validation
- Add new check-dependencies.sh script for environment diagnostics
This commit is contained in:
Matthew Raymer
2025-08-19 03:36:57 +00:00
parent d39e21394c
commit bc1214e9db
4 changed files with 174 additions and 2 deletions

View File

@@ -49,6 +49,31 @@ set -e
# Source common utilities
source "$(dirname "$0")/common.sh"
# Function to validate critical dependencies
validate_dependencies() {
log_info "Validating critical dependencies..."
# Check if node_modules exists
if [ ! -d "node_modules" ]; then
log_error "node_modules directory not found. Please run 'npm install' first."
exit 1
fi
# Check if tsx is available
if [ ! -f "node_modules/.bin/tsx" ]; then
log_error "tsx dependency not found. Please run 'npm install' first."
exit 1
fi
# Check if capacitor-assets is available
if [ ! -f "node_modules/.bin/capacitor-assets" ]; then
log_error "capacitor-assets dependency not found. Please run 'npm install' first."
exit 1
fi
log_success "All critical dependencies validated successfully"
}
# Default values
BUILD_MODE="development"
BUILD_TYPE="debug"
@@ -179,6 +204,11 @@ parse_android_args "$@"
# Print build header
print_header "TimeSafari Android Build Process"
# Validate dependencies before proceeding
validate_dependencies
# Log build start
log_info "Starting Android build process at $(date)"
log_info "Build mode: $BUILD_MODE"
log_info "Build type: $BUILD_TYPE"
@@ -257,6 +287,7 @@ fi
# Step 1: Validate asset configuration
safe_execute "Validating asset configuration" "npm run assets:validate" || {
log_warn "Asset validation found issues, but continuing with build..."
log_info "If you encounter build failures, please run 'npm install' first to ensure all dependencies are available."
}
# Step 2: Clean Android app
@@ -337,6 +368,9 @@ if [ "$OPEN_STUDIO" = true ]; then
log_info "Android Studio: opened"
fi
# Reminder about dependency management
log_info "💡 Tip: If you encounter dependency issues, run 'npm install' to ensure all packages are up to date."
print_footer "Android Build"
# Exit with success