Skip to content

Commit

Permalink
feat(react-native): upgrade react-native to 0.71.1 (#14584)
Browse files Browse the repository at this point in the history
(cherry picked from commit 41fc2eb)
  • Loading branch information
xiongemi authored and FrozenPandaz committed Jan 27, 2023
1 parent 5314c68 commit cb983af
Show file tree
Hide file tree
Showing 62 changed files with 494 additions and 1,162 deletions.
12 changes: 9 additions & 3 deletions docs/generated/packages/react-native/executors/run-ios.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@
"simulator": {
"type": "string",
"description": "Explicitly set simulator to use. Optionally include iOS version between parenthesis at the end to match an exact version: `iPhone X (12.1)`.",
"default": "iPhone 13",
"examples": ["iPhone 13", "iPhone X"],
"default": "iPhone 14",
"examples": [
"iPhone 14",
"iPhone 13",
"iPhone 12",
"iPhone 11",
"iPhone X"
],
"x-priority": "important"
},
"device": {
Expand Down Expand Up @@ -84,7 +90,7 @@
"default": true
}
},
"examplesFile": "`project.json`:\n\n```json\n{\n \"name\": \"mobile\",\n //...\n \"targets\": {\n //...\n \"run-ios\": {\n \"executor\": \"@nrwl/react-native:run-ios\",\n \"options\": {}\n }\n }\n}\n```\n\n```bash\nnx run mobile:run-ios\n```\n\n## Examples\n\n{% tabs %}\n{% tab label=\"Run on a simulator\" %}\nTo see all the avaiable simulators, run command:\n\n```bash\nxcrun simctl list\n```\n\nThe `simulator` option allows you to launch your iOS app in a specific simulator:\n\n```json\n \"run-ios\": {\n \"executor\": \"@nrwl/react-native:run-ios\",\n \"options\": {\n \"simulator\": \"iPhone 13 Pro\"\n }\n }\n```\n\n{% /tab %}\n{% tab label=\"Run on a device\" %}\nThe `device` option allows you to launch your iOS app in a specific device.\n\n```json\n \"run-ios\": {\n \"executor\": \"@nrwl/react-native:run-ios\",\n \"options\": {\n \"device\": \"deviceName\"\n }\n }\n```\n\n{% /tab %}\n{% tab label=\"Run the Debug/Release app\" %}\nThe `xcodeConfiguration` option allows to specify the xcode configuartion, such as `Debug` or `Release`.\n\n```json\n \"run-ios\": {\n \"executor\": \"@nrwl/react-native:run-ios\",\n \"options\": {\n \"xcodeConfiguration\": \"Release\"\n }\n }\n```\n\n{% /tab %}\n{% /tabs %}\n\n---\n"
"examplesFile": "`project.json`:\n\n```json\n{\n \"name\": \"mobile\",\n //...\n \"targets\": {\n //...\n \"run-ios\": {\n \"executor\": \"@nrwl/react-native:run-ios\",\n \"options\": {}\n }\n }\n}\n```\n\n```bash\nnx run mobile:run-ios\n```\n\n## Examples\n\n{% tabs %}\n{% tab label=\"Run on a simulator\" %}\nTo see all the avaiable simulators, run command:\n\n```bash\nxcrun simctl list\n```\n\nThe `simulator` option allows you to launch your iOS app in a specific simulator:\n\n```json\n \"run-ios\": {\n \"executor\": \"@nrwl/react-native:run-ios\",\n \"options\": {\n \"simulator\": \"iPhone 14 Pro\"\n }\n }\n```\n\n{% /tab %}\n{% tab label=\"Run on a device\" %}\nThe `device` option allows you to launch your iOS app in a specific device.\n\n```json\n \"run-ios\": {\n \"executor\": \"@nrwl/react-native:run-ios\",\n \"options\": {\n \"device\": \"deviceName\"\n }\n }\n```\n\n{% /tab %}\n{% tab label=\"Run the Debug/Release app\" %}\nThe `xcodeConfiguration` option allows to specify the xcode configuartion, such as `Debug` or `Release`.\n\n```json\n \"run-ios\": {\n \"executor\": \"@nrwl/react-native:run-ios\",\n \"options\": {\n \"xcodeConfiguration\": \"Release\"\n }\n }\n```\n\n{% /tab %}\n{% /tabs %}\n\n---\n"
},
"description": "Runs iOS application.",
"aliases": [],
Expand Down
14 changes: 7 additions & 7 deletions e2e/react-native/src/react-native.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ describe('react native', () => {
const componentName = uniq('component');

runCLI(
`generate @nrwl/react-native:application ${appName} --install=false`
`generate @nrwl/react-native:application ${appName} --install=false --no-interactive`
);
runCLI(`generate @nrwl/react-native:library ${libName}`);
runCLI(`generate @nrwl/react-native:library ${libName} --no-interactive`);
runCLI(
`generate @nrwl/react-native:component ${componentName} --project=${libName} --export`
`generate @nrwl/react-native:component ${componentName} --project=${libName} --export --no-interactive`
);

updateFile(`apps/${appName}/src/app/App.tsx`, (content) => {
Expand Down Expand Up @@ -70,7 +70,7 @@ describe('react native', () => {
it('should create storybook with application', async () => {
const appName = uniq('my-app');
runCLI(
`generate @nrwl/react-native:application ${appName} --install=false`
`generate @nrwl/react-native:application ${appName} --install=false --no-interactive`
);
runCLI(
`generate @nrwl/react-native:storybook-configuration ${appName} --generateStories --no-interactive`
Expand Down Expand Up @@ -99,7 +99,7 @@ describe('react native', () => {
it('should upgrade native for application', async () => {
const appName = uniq('my-app');
runCLI(
`generate @nrwl/react-native:application ${appName} --install=false`
`generate @nrwl/react-native:application ${appName} --install=false --no-interactive`
);

expect(() =>
Expand All @@ -114,7 +114,7 @@ describe('react native', () => {
const componentName = uniq('component');

runCLI(
`generate @nrwl/react-native:library ${libName} --buildable --publishable --importPath=${proj}/${libName}`
`generate @nrwl/react-native:library ${libName} --buildable --publishable --importPath=${proj}/${libName} --no-interactive`
);
runCLI(
`generate @nrwl/react-native:component ${componentName} --project=${libName} --export`
Expand All @@ -129,7 +129,7 @@ describe('react native', () => {
it('sync npm dependencies for autolink', async () => {
const appName = uniq('my-app');
runCLI(
`generate @nrwl/react-native:application ${appName} --install=false`
`generate @nrwl/react-native:application ${appName} --install=false --no-interactive`
);
// Add npm package with native modules
updateFile(join('package.json'), (content) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
"lockfile-lint": "^4.7.6",
"magic-string": "~0.26.2",
"memfs": "^3.0.1",
"metro-resolver": "^0.73.3",
"metro-resolver": "^0.74.1",
"mini-css-extract-plugin": "~2.4.7",
"minimatch": "3.0.5",
"next-sitemap": "^3.1.10",
Expand Down
9 changes: 9 additions & 0 deletions packages/detox/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,15 @@
"alwaysAddToPackageJson": false
}
}
},
"15.6.2": {
"version": "15.6.2-beta.0",
"packages": {
"detox": {
"version": "20.1.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 @@
"@nrwl/workspace": "file:../workspace"
},
"peerDependencies": {
"detox": "^20.0.3"
"detox": "^20.1.1"
},
"builders": "./executors.json",
"ng-update": {
Expand Down
20 changes: 10 additions & 10 deletions packages/detox/src/generators/application/application.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ describe('detox application generator', () => {
binaryPath:
'../../my-app/ios/build/Build/Products/Debug-iphonesimulator/MyApp.app',
build:
"cd ../../my-app/ios && xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -derivedDataPath ./build -quiet",
"cd ../../my-app/ios && xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
type: 'ios.app',
},
'ios.release': {
binaryPath:
'../../my-app/ios/build/Build/Products/Release-iphonesimulator/MyApp.app',
build:
"cd ../../my-app/ios && xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -derivedDataPath ./build -quiet",
"cd ../../my-app/ios && xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
type: 'ios.app',
},
});
Expand Down Expand Up @@ -134,14 +134,14 @@ describe('detox application generator', () => {
binaryPath:
'../../../my-dir/my-app/ios/build/Build/Products/Debug-iphonesimulator/MyDirMyApp.app',
build:
"cd ../../../my-dir/my-app/ios && xcodebuild -workspace MyDirMyApp.xcworkspace -scheme MyDirMyApp -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -derivedDataPath ./build -quiet",
"cd ../../../my-dir/my-app/ios && xcodebuild -workspace MyDirMyApp.xcworkspace -scheme MyDirMyApp -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
type: 'ios.app',
},
'ios.release': {
binaryPath:
'../../../my-dir/my-app/ios/build/Build/Products/Release-iphonesimulator/MyDirMyApp.app',
build:
"cd ../../../my-dir/my-app/ios && xcodebuild -workspace MyDirMyApp.xcworkspace -scheme MyDirMyApp -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -derivedDataPath ./build -quiet",
"cd ../../../my-dir/my-app/ios && xcodebuild -workspace MyDirMyApp.xcworkspace -scheme MyDirMyApp -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
type: 'ios.app',
},
});
Expand Down Expand Up @@ -208,14 +208,14 @@ describe('detox application generator', () => {
binaryPath:
'../../../my-dir/my-app/ios/build/Build/Products/Debug-iphonesimulator/MyDirMyApp.app',
build:
"cd ../../../my-dir/my-app/ios && xcodebuild -workspace MyDirMyApp.xcworkspace -scheme MyDirMyApp -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -derivedDataPath ./build -quiet",
"cd ../../../my-dir/my-app/ios && xcodebuild -workspace MyDirMyApp.xcworkspace -scheme MyDirMyApp -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
type: 'ios.app',
},
'ios.release': {
binaryPath:
'../../../my-dir/my-app/ios/build/Build/Products/Release-iphonesimulator/MyDirMyApp.app',
build:
"cd ../../../my-dir/my-app/ios && xcodebuild -workspace MyDirMyApp.xcworkspace -scheme MyDirMyApp -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -derivedDataPath ./build -quiet",
"cd ../../../my-dir/my-app/ios && xcodebuild -workspace MyDirMyApp.xcworkspace -scheme MyDirMyApp -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
type: 'ios.app',
},
});
Expand Down Expand Up @@ -282,14 +282,14 @@ describe('detox application generator', () => {
binaryPath:
'../../../my-dir/my-app/ios/build/Build/Products/Debug-iphonesimulator/MyDirMyApp.app',
build:
"cd ../../../my-dir/my-app/ios && xcodebuild -workspace MyDirMyApp.xcworkspace -scheme MyDirMyApp -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -derivedDataPath ./build -quiet",
"cd ../../../my-dir/my-app/ios && xcodebuild -workspace MyDirMyApp.xcworkspace -scheme MyDirMyApp -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
type: 'ios.app',
},
'ios.release': {
binaryPath:
'../../../my-dir/my-app/ios/build/Build/Products/Release-iphonesimulator/MyDirMyApp.app',
build:
"cd ../../../my-dir/my-app/ios && xcodebuild -workspace MyDirMyApp.xcworkspace -scheme MyDirMyApp -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -derivedDataPath ./build -quiet",
"cd ../../../my-dir/my-app/ios && xcodebuild -workspace MyDirMyApp.xcworkspace -scheme MyDirMyApp -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
type: 'ios.app',
},
});
Expand Down Expand Up @@ -368,7 +368,7 @@ describe('detox application generator', () => {
binaryPath:
'../../../my-dir/my-app/ios/build/Build/Products/Debug-iphonesimulator/MyDirMyApp.app',
build:
"cd ../../../my-dir/my-app/ios && xcodebuild -workspace MyDirMyApp.xcworkspace -scheme MyDirMyApp -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -derivedDataPath ./build -quiet",
"cd ../../../my-dir/my-app/ios && xcodebuild -workspace MyDirMyApp.xcworkspace -scheme MyDirMyApp -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
type: 'ios.app',
},
'ios.eas': {
Expand All @@ -387,7 +387,7 @@ describe('detox application generator', () => {
binaryPath:
'../../../my-dir/my-app/ios/build/Build/Products/Release-iphonesimulator/MyDirMyApp.app',
build:
"cd ../../../my-dir/my-app/ios && xcodebuild -workspace MyDirMyApp.xcworkspace -scheme MyDirMyApp -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -derivedDataPath ./build -quiet",
"cd ../../../my-dir/my-app/ios && xcodebuild -workspace MyDirMyApp.xcworkspace -scheme MyDirMyApp -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
type: 'ios.app',
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"apps": {
"ios.debug": {
"type": "ios.app",
"build": "cd <%= offsetFromRoot %><%= appRoot %>/ios && xcodebuild -workspace <%= appClassName %>.xcworkspace -scheme <%= appClassName %> -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -derivedDataPath ./build -quiet",
"build": "cd <%= offsetFromRoot %><%= appRoot %>/ios && xcodebuild -workspace <%= appClassName %>.xcworkspace -scheme <%= appClassName %> -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
"binaryPath": "<%= offsetFromRoot %><%= appRoot %>/ios/build/Build/Products/Debug-iphonesimulator/<%= appClassName %>.app"
},
"ios.release": {
"type": "ios.app",
"build": "cd <%= offsetFromRoot %><%= appRoot %>/ios && xcodebuild -workspace <%= appClassName %>.xcworkspace -scheme <%= appClassName %> -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -derivedDataPath ./build -quiet",
"build": "cd <%= offsetFromRoot %><%= appRoot %>/ios && xcodebuild -workspace <%= appClassName %>.xcworkspace -scheme <%= appClassName %> -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
"binaryPath": "<%= offsetFromRoot %><%= appRoot %>/ios/build/Build/Products/Release-iphonesimulator/<%= appClassName %>.app"
},
<% if (framework === 'expo') { %>
Expand Down Expand Up @@ -51,7 +51,7 @@
"simulator": {
"type": "ios.simulator",
"device": {
"type": "iPhone 13"
"type": "iPhone 14"
}
},
"emulator": {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"preset": "<%= offsetFromRoot %>jest.preset",
"testEnvironment": "./environment",
"testRunner": "jest-circus/runner",
"testTimeout": 120000,
"reporters": ["detox/runners/jest/streamlineReporter"],
"maxWorkers": 1,
"globalSetup": "detox/runners/jest/globalSetup",
"globalTeardown": "detox/runners/jest/globalTeardown",
"reporters": ["detox/runners/jest/reporter"],
"testEnvironment": "detox/runners/jest/testEnvironment",
"verbose": true,
"setupFilesAfterEnv": ["<rootDir>/test-setup.ts"],
"transform": {
"^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "@nrwl/react/plugins/jest",
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 = '20.0.3';
export const detoxVersion = '20.1.1';
export const testingLibraryJestDom = '5.16.5';
2 changes: 1 addition & 1 deletion packages/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"chalk": "^4.1.0",
"enhanced-resolve": "^5.8.3",
"fs-extra": "^11.1.0",
"metro-resolver": "^0.73.3",
"metro-resolver": "^0.74.1",
"node-fetch": "^2.6.7",
"tar-fs": "^2.1.1",
"tsconfig-paths": "^4.1.2",
Expand Down
26 changes: 26 additions & 0 deletions packages/expo/plugins/metro-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ export function getResolveRequest(extensions: string[]) {
const { resolveRequest, ...context } = _context;

const resolvedPath =
resolveRequestFromContext(
resolveRequest,
_context,
realModuleName,
platform,
debug
) ||
defaultMetroResolver(context, realModuleName, platform, debug) ||
tsconfigPathsResolver(
context,
Expand All @@ -42,6 +49,25 @@ export function getResolveRequest(extensions: string[]) {
};
}

function resolveRequestFromContext(
resolveRequest: Function,
context: any,
realModuleName: string,
platform: string,
debug: boolean
) {
try {
return resolveRequest(context, realModuleName, platform);
} catch {
if (debug)
console.log(
chalk.cyan(
`[Nx] Unable to resolve with default resolveRequest: ${realModuleName}`
)
);
}
}

/**
* This function try to resolve path using metro's default resolver
* @returns path if resolved, else undefined
Expand Down
Loading

0 comments on commit cb983af

Please sign in to comment.