diff --git a/.npmrc b/.npmrc index 7f9d7c584..e31fa41db 100644 --- a/.npmrc +++ b/.npmrc @@ -2,3 +2,10 @@ # npm config set //nexus.ext.meawallet.com/repository/react-native-mpp/:username $NEXUS_USERNAME # npm config set //nexus.ext.meawallet.com/repository/react-native-mpp/:_password $(echo -n $NEXUS_PASSWORD | base64) @meawallet:registry=https://nexus.ext.meawallet.com/repository/react-native-mpp/ + +# Allow temporary registry rate limits to recover during clean installs. +fetch-retries=5 +fetch-retry-factor=2 +fetch-retry-mintimeout=20000 +fetch-retry-maxtimeout=120000 +maxsockets=5 diff --git a/scripts/update-assets.ts b/scripts/update-assets.ts index b95dd4812..87dc46717 100644 --- a/scripts/update-assets.ts +++ b/scripts/update-assets.ts @@ -1,3 +1,4 @@ +import { getDefaultConfig } from 'expo/metro-config'; import { execSync } from 'child_process'; import * as crypto from 'crypto'; import * as fs from 'fs'; @@ -9,6 +10,8 @@ const __dirname = path.dirname(__filename); const ASSETS_DIR = path.join(__dirname, '../assets'); const ASSETS_FILE = path.join(__dirname, '../lib/assets.ts'); +const { assetExts, sourceExts } = getDefaultConfig(path.join(__dirname, '..')).resolver; +const BUNDLEABLE_EXTENSIONS = new Set([...assetExts, ...sourceExts]); function getFiles(dir: string): string[] { const files: string[] = []; @@ -48,10 +51,15 @@ function isDensityVariant(filePath: string): boolean { } function updateRegistry() { + // Documentation and licenses stay in the assets folder, but Metro cannot + // import them. Use its supported extensions to keep them out of every bundle. // Metro resolves @2x/@3x files automatically from the base asset. Requiring // those variants directly makes native bundling fail. const allFiles = getFiles(ASSETS_DIR).filter( - file => !isDensityVariant(file) && !isPlatformSpecificVideo(file), + file => + BUNDLEABLE_EXTENSIONS.has(path.extname(file).slice(1).toLowerCase()) && + !isDensityVariant(file) && + !isPlatformSpecificVideo(file), ); const registryEntries: string[] = [];