fix(build): handle missing dependencies and Capacitor files during iOS build

Fixed build failures when test app dependencies aren't installed and when
Capacitor files don't exist during initial install.

Changes:
- Use `npx run-p` in test app build script to work without local install
- Add dependency check in build-native.sh before building Vue app
- Make fix-capacitor-plugins.js resilient to missing files during postinstall
  - Gracefully handles missing capacitor.plugins.json on first install
  - Provides clear messaging about when fixes will be applied
  - No longer exits with error when Capacitor hasn't been synced yet

This allows the build to complete successfully even when:
- npm dependencies aren't installed in test app
- Capacitor files don't exist yet (will be created during cap:sync:ios)

Files modified:
- scripts/build-native.sh
- test-apps/daily-notification-test/package.json
- test-apps/daily-notification-test/scripts/fix-capacitor-plugins.js
This commit is contained in:
Jose Olarte III
2026-01-15 15:37:32 +08:00
parent 630fd3de81
commit 20b33f6e31
3 changed files with 23 additions and 8 deletions
+9
View File
@@ -171,6 +171,15 @@ build_plugin_for_test_app_ios() {
# Navigate to test app directory
cd test-apps/daily-notification-test || exit 1
# Install dependencies if node_modules doesn't exist or is missing key packages
if [ ! -d "node_modules" ] || [ ! -f "node_modules/.bin/run-p" ]; then
log_info "Installing test app dependencies..."
if ! npm install; then
log_error "Failed to install test app dependencies"
exit 1
fi
fi
# Build Vue app
log_info "Building Vue app..."
if ! npm run build; then