Skip to content

Commit

Permalink
feat(react-native): upgrade metro to 0.71.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongemi committed Jun 6, 2022
1 parent 339b129 commit 0b27b15
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 29 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
"license-webpack-plugin": "^4.0.2",
"loader-utils": "1.2.3",
"memfs": "^3.0.1",
"metro-resolver": "^0.70.3",
"metro-resolver": "^0.71.0",
"mime": "2.4.4",
"mini-css-extract-plugin": "~2.4.7",
"minimatch": "3.0.5",
Expand Down
9 changes: 9 additions & 0 deletions packages/detox/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@
"alwaysAddToPackageJson": false
}
}
},
"14.2.1": {
"version": "14.2.1-beta.0",
"packages": {
"detox": {
"version": "19.7.1",
"alwaysAddToPackageJson": false
}
}
}
}
}
2 changes: 1 addition & 1 deletion packages/detox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"chalk": "^4.1.0"
},
"peerDependencies": {
"detox": "^19.6.9"
"detox": "^19.7.1"
},
"builders": "./executors.json",
"ng-update": {
Expand Down
2 changes: 1 addition & 1 deletion packages/detox/src/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const nxVersion = require('../../package.json').version;

export const detoxVersion = '19.6.9';
export const detoxVersion = '19.7.1';
export const testingLibraryJestDom = '5.16.4';
37 changes: 37 additions & 0 deletions packages/react-native/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,43 @@
"alwaysAddToPackageJson": false
}
}
},
"14.2.1": {
"version": "14.2.1-beta.0",
"packages": {
"metro": {
"version": "0.71.0",
"alwaysAddToPackageJson": false
},
"metro-resolver": {
"version": "0.71.0",
"alwaysAddToPackageJson": false
},
"metro-babel-register": {
"version": "0.71.0",
"alwaysAddToPackageJson": false
},
"metro-config": {
"version": "0.71.0",
"alwaysAddToPackageJson": false
},
"metro-react-native-babel-preset": {
"version": "0.71.0",
"alwaysAddToPackageJson": false
},
"@testing-library/jest-native": {
"version": "4.0.5",
"alwaysAddToPackageJson": false
},
"@babel/runtime": {
"version": "7.18.3",
"alwaysAddToPackageJson": false
},
"@types/react-native": {
"version": "0.67.8",
"alwaysAddToPackageJson": false
}
}
}
}
}
2 changes: 1 addition & 1 deletion packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"enhanced-resolve": "^5.8.3",
"fs-extra": "^10.1.0",
"ignore": "^5.0.4",
"metro-resolver": "^0.70.3",
"metro-resolver": "^0.71.0",
"node-fetch": "^2.6.7",
"tsconfig-paths": "^3.9.0"
},
Expand Down
16 changes: 6 additions & 10 deletions packages/react-native/plugins/metro-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ export function getResolveRequest(extensions: string[]) {
return function (
_context: any,
realModuleName: string,
platform: string | null,
moduleName: string
platform: string | null
) {
const DEBUG = process.env.NX_REACT_NATIVE_DEBUG === 'true';

if (DEBUG) console.log(chalk.cyan(`[Nx] Resolving: ${moduleName}`));
if (DEBUG) console.log(chalk.cyan(`[Nx] Resolving: ${realModuleName}`));

const { resolveRequest, ...context } = _context;

Expand All @@ -32,15 +31,14 @@ export function getResolveRequest(extensions: string[]) {
context,
extensions,
realModuleName,
moduleName,
platform,
DEBUG
) ||
pnpmResolver(extensions, context, realModuleName, moduleName, DEBUG);
pnpmResolver(extensions, context, realModuleName, DEBUG);
if (resolvedPath) {
return resolvedPath;
}
throw new Error(`Cannot resolve ${chalk.bold(moduleName)}`);
throw new Error(`Cannot resolve ${chalk.bold(realModuleName)}`);
};
}

Expand Down Expand Up @@ -75,7 +73,6 @@ function pnpmResolver(
extensions: string[],
context: any,
realModuleName: string,
moduleName: string,
debug: boolean
) {
try {
Expand All @@ -93,7 +90,7 @@ function pnpmResolver(
if (debug)
console.log(
chalk.cyan(
`[Nx] Unable to resolve with default PNPM resolver: ${moduleName}`
`[Nx] Unable to resolve with default PNPM resolver: ${realModuleName}`
)
);
}
Expand All @@ -107,7 +104,6 @@ function tsconfigPathsResolver(
context: any,
extensions: string[],
realModuleName: string,
moduleName: string,
platform: string,
debug: boolean
) {
Expand All @@ -124,7 +120,7 @@ function tsconfigPathsResolver(
} else {
if (debug) {
console.log(
chalk.red(`[Nx] Failed to resolve ${chalk.bold(moduleName)}`)
chalk.red(`[Nx] Failed to resolve ${chalk.bold(realModuleName)}`)
);
console.log(
chalk.cyan(
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/src/generators/init/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { runTasksInSerial } from '@nrwl/workspace/src/utilities/run-tasks-in-ser
import { jestInitGenerator } from '@nrwl/jest';
import { detoxInitGenerator } from '@nrwl/detox';
import {
reactTestRendererVersion,
reactVersion,
typesReactVersion,
} from '@nrwl/react/src/utils/versions';
Expand All @@ -29,7 +30,6 @@ import {
reactNativeSvgTransformerVersion,
reactNativeSvgVersion,
reactNativeVersion,
reactTestRendererVersion,
testingLibraryJestNativeVersion,
testingLibraryReactNativeVersion,
typesNodeVersion,
Expand Down
18 changes: 8 additions & 10 deletions packages/react-native/src/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
export const nxVersion = require('../../package.json').version;

export const reactNativeVersion = '0.68.2';
export const typesReactNativeVersion = '0.67.7';
export const typesReactNativeVersion = '0.67.8';

export const typesNodeVersion = '16.11.7';

export const metroVersion = '0.70.3';
export const metroVersion = '0.71.0';

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

export const reactNativeConfigVersion = '1.4.5';
export const reactNativeAsyncStorageAsyncStorageVersion = '1.16.3';
export const reactNativeAsyncStorageAsyncStorageVersion = '1.17.5';

export const testingLibraryReactNativeVersion = '9.1.0';
export const testingLibraryJestNativeVersion = '4.0.4';
export const testingLibraryJestNativeVersion = '4.0.5';

export const jestReactNativeVersion = '18.0.0';

export const reactTestRendererVersion = '18.1.0';

export const reactNativeSvgTransformerVersion = '1.0.0';
export const reactNativeSvgVersion = '12.3.0';

export const babelRuntimeVersion = '7.17.9';
export const babelRuntimeVersion = '7.18.3';
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16895,10 +16895,10 @@ methods@~1.1.2:
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=

metro-resolver@^0.70.3:
version "0.70.3"
resolved "https://registry.yarnpkg.com/metro-resolver/-/metro-resolver-0.70.3.tgz#c64fdd6d0a88fa62f3f99f87e539b5f603bd47bf"
integrity sha512-5Pc5S/Gs4RlLbziuIWtvtFd9GRoILlaRC8RZDVq5JZWcWHywKy/PjNmOBNhpyvtRlzpJfy/ssIfLhu8zINt1Mw==
metro-resolver@^0.71.0:
version "0.71.0"
resolved "https://registry.yarnpkg.com/metro-resolver/-/metro-resolver-0.71.0.tgz#2eee9c04055fbb043b3a97d6fd7a27b221b8748c"
integrity sha512-VUc7+nPOb/pthwDNMsulAWu63QqRa6O7/hW8J/jXYXR7cnkjF1vV08KT+28smrvb/jEKS8Saqn08pcqF/uxkuQ==
dependencies:
absolute-path "^0.0.0"

Expand Down

0 comments on commit 0b27b15

Please sign in to comment.