Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 9 additions & 1 deletion scripts/update-assets.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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[] = [];
Expand Down Expand Up @@ -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[] = [];

Expand Down
Loading