fix(ios): validate resources/ and warn if assets/ shadows it

Point iOS asset checks at resources/ and document that a leftover assets/
directory makes @capacitor/assets ignore the canonical sources.
This commit is contained in:
Jose Olarte III
2026-07-17 17:48:40 +08:00
parent 6d221ee1ca
commit fb9da10fd2
3 changed files with 18 additions and 5 deletions

View File

@@ -1604,6 +1604,11 @@ Use the commands above to check and fix code quality issues.
4. **Native Build**: Platform-specific compilation
5. **Package Creation**: APK/IPA generation
`resources/` is the canonical source for app icons and splash screens.
Do not keep a legacy top-level `assets/` directory unless it is intentionally
used: `@capacitor/assets` prioritizes `assets/` over `resources/`, which can
prevent the canonical assets from being discovered.
## Architecture Environment Configuration
### Environment Files

View File

@@ -56,7 +56,10 @@ npx capacitor-assets generate --web
## Configuration
Asset generation is configured in `capacitor-assets.config.json` at the project root.
`resources/` is this project's canonical asset source. `@capacitor/assets`
prioritizes a top-level `assets/` directory over `resources/`, so a legacy
`assets/` directory can prevent these assets from being discovered. Remove that
directory when it is empty or obsolete.
## Version Control

View File

@@ -172,12 +172,12 @@ check_ios_resources() {
log_info "Checking iOS resources..."
# Check for required assets
if [ ! -f "assets/icon.png" ]; then
log_warn "App icon not found at assets/icon.png"
if [ ! -f "resources/icon.png" ]; then
log_warn "App icon not found at resources/icon.png"
fi
if [ ! -f "assets/splash.png" ]; then
log_warn "Splash screen not found at assets/splash.png"
if [ ! -f "resources/splash.png" ]; then
log_warn "Splash screen not found at resources/splash.png"
fi
# Check for iOS-specific files
@@ -295,6 +295,11 @@ apply_ios_app_icon_appearances() {
# Generate iOS assets (capacitor-assets), then apply optional appearance variants.
generate_ios_assets() {
ensure_ios_capacitor_asset_directories
if [ -d "assets" ]; then
log_warn "@capacitor/assets prioritizes the top-level assets/ directory over resources/."
log_warn "This project intentionally uses resources/ as the canonical asset source."
log_warn "Remove the legacy assets/ directory if it is empty or obsolete."
fi
npx capacitor-assets generate --ios
apply_ios_app_icon_appearances
}