Skip to content

Commit

Permalink
feat(react-native): upgrade metro-resolver to 0.69.1 (#9381)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongemi committed Mar 17, 2022
1 parent 83acbaf commit 3627c3a
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 41 deletions.
6 changes: 1 addition & 5 deletions e2e/detox/src/detox.test.ts
Expand Up @@ -31,11 +31,7 @@ describe('Detox', () => {

describe('React Native Detox MACOS-Tests', () => {
if (isOSX()) {
it('should build and test ios MACOS-Tests', async () => {
expect(runCLI(`build-ios ${appName}-e2e --prod`)).toContain(
'Successfully ran target build-ios'
);

it('should test ios MACOS-Tests', async () => {
expect(
runCLI(
`test-ios ${appName}-e2e --prod --debugSynchronization=true --loglevel=trace`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -183,7 +183,7 @@
"license-webpack-plugin": "^4.0.2",
"loader-utils": "1.2.3",
"memfs": "^3.0.1",
"metro-resolver": "^0.67.0",
"metro-resolver": "^0.69.1",
"mime": "2.4.4",
"mini-css-extract-plugin": "~2.4.7",
"minimatch": "3.0.4",
Expand Down
17 changes: 9 additions & 8 deletions packages/detox/migrations.json
Expand Up @@ -38,10 +38,6 @@
"detox": {
"version": "18.22.2",
"alwaysAddToPackageJson": false
},
"@types/detox": {
"version": "17.14.3",
"alwaysAddToPackageJson": false
}
}
},
Expand All @@ -65,10 +61,6 @@
"version": "19.4.1",
"alwaysAddToPackageJson": false
},
"@types/detox": {
"version": "18.1.0",
"alwaysAddToPackageJson": false
},
"@testing-library/jest-dom": {
"version": "5.16.1",
"alwaysAddToPackageJson": false
Expand Down Expand Up @@ -96,6 +88,15 @@
"alwaysAddToPackageJson": false
}
}
},
"13.9.3": {
"version": "13.9.3-beta.0",
"packages": {
"detox": {
"version": "19.5.7",
"alwaysAddToPackageJson": false
}
}
}
}
}
2 changes: 1 addition & 1 deletion packages/detox/package.json
Expand Up @@ -32,7 +32,7 @@
"chalk": "^4.1.0"
},
"peerDependencies": {
"detox": "^19.5.1"
"detox": "^19.5.7"
},
"builders": "./executors.json",
"ng-update": {
Expand Down
2 changes: 1 addition & 1 deletion packages/detox/src/utils/versions.ts
@@ -1,4 +1,4 @@
export const nxVersion = '*';

export const detoxVersion = '19.5.1';
export const detoxVersion = '19.5.7';
export const testingLibraryJestDom = '5.16.2';
33 changes: 33 additions & 0 deletions packages/react-native/migrations.json
Expand Up @@ -407,6 +407,39 @@
"alwaysAddToPackageJson": false
}
}
},
"13.9.3": {
"version": "13.9.3-beta.0",
"packages": {
"@types/react-native": {
"version": "0.67.3",
"alwaysAddToPackageJson": false
},
"metro": {
"version": "0.69.1",
"alwaysAddToPackageJson": false
},
"metro-resolver": {
"version": "0.69.1",
"alwaysAddToPackageJson": false
},
"metro-config": {
"version": "0.69.1",
"alwaysAddToPackageJson": false
},
"metro-react-native-babel-preset": {
"version": "0.69.1",
"alwaysAddToPackageJson": false
},
"@babel/runtime": {
"version": "7.17.7",
"alwaysAddToPackageJson": false
},
"@react-native-async-storage/async-storage": {
"version": "1.16.3",
"alwaysAddToPackageJson": false
}
}
}
}
}
2 changes: 1 addition & 1 deletion packages/react-native/package.json
Expand Up @@ -35,7 +35,7 @@
"enhanced-resolve": "^5.8.3",
"fs-extra": "^9.1.0",
"ignore": "^5.0.4",
"metro-resolver": "^0.67.0",
"metro-resolver": "^0.69.1",
"node-fetch": "^2.6.7",
"tsconfig-paths": "^3.9.0"
},
Expand Down
19 changes: 8 additions & 11 deletions packages/react-native/plugins/metro-resolver.ts
Expand Up @@ -2,7 +2,6 @@ import * as metroResolver from 'metro-resolver';
import type { MatchPath } from 'tsconfig-paths';
import { createMatchPath, loadConfig } from 'tsconfig-paths';
import * as chalk from 'chalk';
import { detectPackageManager } from '@nrwl/devkit';
import { CachedInputFileSystem, ResolverFactory } from 'enhanced-resolve';
import { dirname, join } from 'path';
import * as fs from 'fs';
Expand Down Expand Up @@ -32,16 +31,14 @@ export function getResolveRequest(extensions: string[]) {
return resolvedPath;
}

if (detectPackageManager(appRootPath) === 'pnpm') {
resolvedPath = pnpmResolver(
extensions,
context,
realModuleName,
moduleName
);
if (resolvedPath) {
return resolvedPath;
}
resolvedPath = pnpmResolver(
extensions,
context,
realModuleName,
moduleName
);
if (resolvedPath) {
return resolvedPath;
}

return tsconfigPathsResolver(
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/src/generators/component/schema.json
Expand Up @@ -2,7 +2,7 @@
"cli": "nx",
"$id": "NxReactNativeApplication",
"$schema": "http://json-schema.org/schema",
"title": "Create a React Component for Nx",
"title": "Create a React Native Component for Nx",
"type": "object",
"examples": [
{
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native/src/generators/init/init.ts
Expand Up @@ -22,7 +22,7 @@ import {
metroReactNativeBabelPresetVersion,
metroVersion,
nxVersion,
reactNativeAsyncStorageVersion,
reactNativeAsyncStorageAsyncStorageVersion,
reactNativeCommunityCli,
reactNativeCommunityCliAndroid,
reactNativeCommunityCliIos,
Expand Down Expand Up @@ -90,7 +90,7 @@ export function updateDependencies(host: Tree) {
'react-native-svg': reactNativeSvgVersion,
'react-native-config': reactNativeConfigVersion,
'@react-native-async-storage/async-storage':
reactNativeAsyncStorageVersion,
reactNativeAsyncStorageAsyncStorageVersion,
...(isPnpm
? {
'metro-config': metroVersion, // metro-config is used by metro.config.js
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/src/generators/init/schema.json
Expand Up @@ -2,7 +2,7 @@
"cli": "nx",
"$id": "NxReactNativeInit",
"$schema": "http://json-schema.org/schema",
"title": "Add Nx React Schematics",
"title": "Add Nx React Native Schematics",
"type": "object",
"properties": {
"unitTestRunner": {
Expand Down
10 changes: 5 additions & 5 deletions packages/react-native/src/utils/versions.ts
@@ -1,18 +1,18 @@
export const nxVersion = '*';

export const reactNativeVersion = '0.67.3';
export const typesReactNativeVersion = '0.67.2';
export const typesReactNativeVersion = '0.67.3';

export const metroVersion = '0.69.0';
export const metroVersion = '0.69.1';

export const reactNativeCommunityCli = '7.0.1';
export const reactNativeCommunityCliIos = '7.0.1';
export const reactNativeCommunityCliAndroid = '7.0.1';

export const reactNativeConfigVersion = '1.4.5';
export const reactNativeAsyncStorageVersion = '1.16.1';
export const reactNativeAsyncStorageAsyncStorageVersion = '1.16.3';

export const metroReactNativeBabelPresetVersion = '0.69.0';
export const metroReactNativeBabelPresetVersion = '0.69.1';

export const testingLibraryReactNativeVersion = '9.0.0';
export const testingLibraryJestNativeVersion = '4.0.4';
Expand All @@ -24,4 +24,4 @@ export const reactTestRendererVersion = '17.0.2';
export const reactNativeSvgTransformerVersion = '1.0.0';
export const reactNativeSvgVersion = '12.3.0';

export const babelRuntimeVersion = '7.17.2';
export const babelRuntimeVersion = '7.17.7';
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -16993,10 +16993,10 @@ methods@~1.1.2:
resolved "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz"
integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=

metro-resolver@^0.67.0:
version "0.67.0"
resolved "https://registry.yarnpkg.com/metro-resolver/-/metro-resolver-0.67.0.tgz#8143c716f77e468d1d42eca805243706eb349959"
integrity sha512-d2KS/zAyOA/z/q4/ff41rAp+1txF4H6qItwpsls/RHStV2j6PqgRHUzq/3ga+VIeoUJntYJ8nGW3+3qSrhFlig==
metro-resolver@^0.69.1:
version "0.69.1"
resolved "https://registry.yarnpkg.com/metro-resolver/-/metro-resolver-0.69.1.tgz#0f01285e9e2683debf6599b91e7bf179f94990dd"
integrity sha512-sTUp8n3hP+K6Jm3beqnadPZWj53trzDi0wqLKC2iKNy1+UoBZkiqmHY0dZKaoF8XoOsksoph+aghlBZkchgEng==
dependencies:
absolute-path "^0.0.0"

Expand Down

1 comment on commit 3627c3a

@vercel
Copy link

@vercel vercel bot commented on 3627c3a Mar 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.