Skip to content

Commit

Permalink
feat(react-native): upgrade react-native to 0.71.7 (#16504)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongemi committed Apr 24, 2023
1 parent 808b4d1 commit cc0d912
Show file tree
Hide file tree
Showing 41 changed files with 438 additions and 150 deletions.
2 changes: 1 addition & 1 deletion docs/generated/packages/detox/documents/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ If you need to fine tune your Detox setup, you can do so by modifying `.detoxrc.

#### Change Testing Simulator/Emulator

For iOS, in terminal, run `xcrun simctl list` to view a list of simulators on your Mac. To open your active simulator, `run open -a simulator`. In `frontend-e2e/.detoxrc.json`, you could change the simulator under `devices.simulator.device`.
For iOS, in terminal, run `xcrun simctl list devices available` to view a list of simulators on your Mac. To open your active simulator, `run open -a simulator`. In `frontend-e2e/.detoxrc.json`, you could change the simulator under `devices.simulator.device`.

For Android, in terminal, run `emulator -list-avds` to view a list of emulators installed. To open your emulator, run `emulator -avd <your emulator name>`. In `frontend-e2e/.detoxrc.json`, you could change the simulator under `devices.emulator.device`.

Expand Down
2 changes: 1 addition & 1 deletion docs/generated/packages/expo/executors/run.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
}
},
"required": ["platform"],
"examplesFile": "The `run` command allows you to compile your app locally.\n\n`project.json`:\n\n```json\n{\n \"name\": \"mobile\",\n //...\n \"targets\": {\n //...\n \"run-ios\": {\n \"executor\": \"@nrwl/expo:run\",\n \"options\": {\n \"platform\": \"ios\"\n }\n },\n \"run-android\": {\n \"executor\": \"@nrwl/expo:run\",\n \"options\": {\n \"platform\": \"android\"\n }\n }\n //...\n }\n}\n```\n\n```shell\nnx run mobile:run-ios\nnx run mobile:run-android\n```\n\n## Examples\n\n{% tabs %}\n{% tab label=\"Compile Android with Different Variants\" %}\nThe `variant` option allows you to specify the compile Android app with variants defined in `build.gradle` file (e.g. debug, release).\n\n```json\n \"run-android\": {\n \"executor\": \"@nrwl/expo:run\",\n \"options\": {\n \"platform\": \"android\",\n \"variant\": \"release\"\n }\n }\n```\n\n{% /tab %}\n{% tab label=\"Compile iOS with Different Configurations\" %}\n\nThe `xcodeConfiguration` option allows you to specify Xcode configuration to use (e.g. Debug or Release).\n\n```json\n \"run-ios\": {\n \"executor\": \"@nrwl/expo:run\",\n \"options\": {\n \"platform\": \"ios\",\n \"xcodeConfiguration\": \"Release\"\n }\n }\n```\n\n{% /tab %}\n{% tab label=\"Run on a device\" %}\n\nThe `device` option allows you to launch your app in a specific device name or UDID.\nTo see all your iOS simulators: run `xcrun simctl list`.\nTo see all your Android emulators, run: `emulator -list-avds`.\n\n```json\n \"run-ios\": {\n \"executor\": \"@nrwl/expo:run\",\n \"options\": {\n \"platform\": \"ios\",\n \"device\": \"iPhone 14\"\n }\n },\n \"run-android\": {\n \"executor\": \"@nrwl/expo:run\",\n \"options\": {\n \"platform\": \"android\",\n \"device\": \"Pixel_XL_API_Tiramisu\"\n }\n }\n```\n\n{% /tab %}\n{% /tabs %}\n\n---\n",
"examplesFile": "The `run` command allows you to compile your app locally.\n\n`project.json`:\n\n```json\n{\n \"name\": \"mobile\",\n //...\n \"targets\": {\n //...\n \"run-ios\": {\n \"executor\": \"@nrwl/expo:run\",\n \"options\": {\n \"platform\": \"ios\"\n }\n },\n \"run-android\": {\n \"executor\": \"@nrwl/expo:run\",\n \"options\": {\n \"platform\": \"android\"\n }\n }\n //...\n }\n}\n```\n\n```shell\nnx run mobile:run-ios\nnx run mobile:run-android\n```\n\n## Examples\n\n{% tabs %}\n{% tab label=\"Compile Android with Different Variants\" %}\nThe `variant` option allows you to specify the compile Android app with variants defined in `build.gradle` file (e.g. debug, release).\n\n```json\n \"run-android\": {\n \"executor\": \"@nrwl/expo:run\",\n \"options\": {\n \"platform\": \"android\",\n \"variant\": \"release\"\n }\n }\n```\n\n{% /tab %}\n{% tab label=\"Compile iOS with Different Configurations\" %}\n\nThe `xcodeConfiguration` option allows you to specify Xcode configuration to use (e.g. Debug or Release).\n\n```json\n \"run-ios\": {\n \"executor\": \"@nrwl/expo:run\",\n \"options\": {\n \"platform\": \"ios\",\n \"xcodeConfiguration\": \"Release\"\n }\n }\n```\n\n{% /tab %}\n{% tab label=\"Run on a device\" %}\n\nThe `device` option allows you to launch your app in a specific device name or UDID.\nTo see all your iOS simulators: run `xcrun simctl list devices available`.\nTo see all your Android emulators, run: `emulator -list-avds`.\n\n```json\n \"run-ios\": {\n \"executor\": \"@nrwl/expo:run\",\n \"options\": {\n \"platform\": \"ios\",\n \"device\": \"iPhone 14\"\n }\n },\n \"run-android\": {\n \"executor\": \"@nrwl/expo:run\",\n \"options\": {\n \"platform\": \"android\",\n \"device\": \"Pixel_XL_API_Tiramisu\"\n }\n }\n```\n\n{% /tab %}\n{% /tabs %}\n\n---\n",
"presets": []
},
"description": "Run the Android app binary locally or run the iOS app binary locally",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
}
},
"required": [],
"examplesFile": "`project.json`:\n\n```json\n{\n \"name\": \"mobile\",\n //...\n \"targets\": {\n //...\n \"build-ios\": {\n \"executor\": \"@nrwl/react-native:build-ios\",\n \"options\": {}\n }\n }\n}\n```\n\n```bash\nnx run mobile:build-ios\n```\n\n## Examples\n\n{% tabs %}\n{% tab label=\"Build the Debug/Release app\" %}\nThe `buildFolder` option allows to specify the location for ios build artifacts. It corresponds to Xcode's -derivedDataPath.\n\n```json\n \"build-ios\": {\n \"executor\": \"@nrwl/react-native:build-ios\",\n \"options\": {\n \"buildFolder\": \"dist/ios/build\"\n }\n }\n```\n\n{% /tab %}\n{% tab label=\"Build the Debug/Release app\" %}\nThe `mode` option allows to specify the xcode configuartion, such as `Debug` or `Release`.\n\n```json\n \"build-ios\": {\n \"executor\": \"@nrwl/react-native:build-ios\",\n \"options\": {\n \"mode\": \"Release\"\n }\n }\n```\n\n{% /tab %}\n{% tab label=\"Build for a simulator\" %}\nTo see all the available 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 \"build-ios\": {\n \"executor\": \"@nrwl/react-native:build-ios\",\n \"options\": {\n \"simulator\": \"iPhone 14 Pro\"\n }\n }\n```\n\n{% /tab %}\n{% tab label=\"Build for a device\" %}\nThe `device` option allows you to launch your iOS app in a specific device.\n\nTo see all the available device, run command:\n\n```bash\nxcrun simctl list\n```\n\n```json\n \"build-ios\": {\n \"executor\": \"@nrwl/react-native:build-ios\",\n \"options\": {\n \"device\": \"deviceName\"\n }\n }\n```\n\n{% /tab %}\n{% tab label=\"Set Device by udid\" %}\nThe `udid` option allows you to explicitly set device to use by udid.\n\nTo see all the available simulators and devices with udid, run command:\n\n```bash\nxcrun simctl list\n```\n\n```json\n \"build-ios\": {\n \"executor\": \"@nrwl/react-native:build-ios\",\n \"options\": {\n \"udid\": \"device udid\"\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 \"build-ios\": {\n \"executor\": \"@nrwl/react-native:build-ios\",\n \"options\": {}\n }\n }\n}\n```\n\n```bash\nnx run mobile:build-ios\n```\n\n## Examples\n\n{% tabs %}\n{% tab label=\"Build in Specific Location\" %}\nThe `buildFolder` option allows to specify the location for ios build artifacts. It corresponds to Xcode's -derivedDataPath.\n\n```json\n \"build-ios\": {\n \"executor\": \"@nrwl/react-native:build-ios\",\n \"options\": {\n \"buildFolder\": \"dist/ios/build\"\n }\n }\n```\n\n```bash\nnx build-ios <app-name> --buildFolder=dist/ios/build\n```\n\n{% /tab %}\n{% tab label=\"Build the Debug/Release app\" %}\nThe `mode` option allows to specify the xcode configuartion, such as `Debug` or `Release`.\n\n```json\n \"build-ios\": {\n \"executor\": \"@nrwl/react-native:build-ios\",\n \"options\": {\n \"mode\": \"Release\"\n }\n }\n```\n\n```bash\nnx build-ios <app-name> --mode=Debug\nnx build-ios <app-name> --mode=Release\n```\n\n{% /tab %}\n{% tab label=\"Build for a simulator\" %}\nThe `simulator` option allows you to launch your iOS app in a specific simulator:\n\nTo see all the available simulators, run command:\n\n```bash\nxcrun simctl list devices available\n```\n\n```json\n \"build-ios\": {\n \"executor\": \"@nrwl/react-native:build-ios\",\n \"options\": {\n \"simulator\": \"iPhone 14 Pro\"\n }\n }\n```\n\n```bash\nnx build-ios <app-name> --simulator=\"iPhone 14 Pro\"\n```\n\n{% /tab %}\n{% tab label=\"Build for a device\" %}\nThe `device` option allows you to launch your iOS app in a specific device.\n\nTo see all the available device, run command:\n\n```bash\nxcrun simctl list devices available\n```\n\n```json\n \"build-ios\": {\n \"executor\": \"@nrwl/react-native:build-ios\",\n \"options\": {\n \"device\": \"deviceName\"\n }\n }\n```\n\n```bash\nnx build-ios <app-name> --device=\"deviceName\"\n```\n\n{% /tab %}\n{% tab label=\"Set Device by udid\" %}\nThe `udid` option allows you to explicitly set device to use by udid.\n\nTo see all the available simulators and devices with udid, run command:\n\n```bash\nxcrun simctl list devices available\n```\n\n```json\n \"build-ios\": {\n \"executor\": \"@nrwl/react-native:build-ios\",\n \"options\": {\n \"udid\": \"device udid\"\n }\n }\n```\n\n```bash\nnx build-ios <app-name> --udid=\"device udid\"\n```\n\n{% /tab %}\n{% /tabs %}\n\n---\n"
},
"description": "Build iOS app",
"aliases": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"description": "Path relative to project root where pre-built .app binary lives."
}
},
"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=\"Build the Debug/Release app\" %}\nThe `mode` option allows to specify the xcode configuartion schema, such as `Debug` or `Release`.\n\n```json\n \"run-ios\": {\n \"executor\": \"@nrwl/react-native:run-ios\",\n \"options\": {\n \"mode\": \"Release\"\n }\n }\n```\n\n{% /tab %}\n{% tab label=\"Run on a simulator\" %}\nTo see all the available 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\nTo see all the available devices, run command:\n\n```bash\nxcrun simctl list\n```\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=\"Set Device by udid\" %}\nThe `udid` option allows you to explicitly set device to use by udid.\n\nTo see all the available simulators and devices with udid, run command:\n\n```bash\nxcrun simctl list\n```\n\n```json\n \"run-ios\": {\n \"executor\": \"@nrwl/react-native:run-ios\",\n \"options\": {\n \"udid\": \"device udid\"\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=\"Build the Debug/Release app\" %}\nThe `mode` option allows to specify the xcode configuartion schema, such as `Debug` or `Release`.\n\n```json\n \"run-ios\": {\n \"executor\": \"@nrwl/react-native:run-ios\",\n \"options\": {\n \"mode\": \"Release\"\n }\n }\n```\n\n```bash\nnx run-ios <app-name> --mode=Debug\n```\n\n{% /tab %}\n{% tab label=\"Run on a simulator\" %}\nThe `simulator` option allows you to launch your iOS app in a specific simulator.\n\nTo see all the available simulators, run command:\n\n```bash\nxcrun simctl list devices available\n```\n\n```json\n \"run-ios\": {\n \"executor\": \"@nrwl/react-native:run-ios\",\n \"options\": {\n \"simulator\": \"iPhone 14 Pro (16.2)\"\n }\n }\n```\n\n```bash\nnx run-ios <app-name> --simulator=\"iPhone 14 Pro (16.2)\"\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\nTo see all the available devices, run command:\n\n```bash\nxcrun simctl list devices available\n```\n\n```json\n \"run-ios\": {\n \"executor\": \"@nrwl/react-native:run-ios\",\n \"options\": {\n \"device\": \"deviceName\"\n }\n }\n```\n\n```bash\nnx run-ios <app-name> --device=\"deviceName\"\n```\n\n{% /tab %}\n{% tab label=\"Set Device by udid\" %}\nThe `udid` option allows you to explicitly set device to use by udid.\n\nTo see all the available simulators and devices with udid, run command:\n\n```bash\nxcrun simctl list devices available\n```\n\n```json\n \"run-ios\": {\n \"executor\": \"@nrwl/react-native:run-ios\",\n \"options\": {\n \"udid\": \"device udid\"\n }\n }\n```\n\n```bash\nnx run-ios <app-name> --udid=\"device udid\"\n```\n\n{% /tab %}\n{% /tabs %}\n\n---\n"
},
"description": "Runs iOS application.",
"aliases": [],
Expand Down
2 changes: 1 addition & 1 deletion docs/shared/packages/detox/detox-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ If you need to fine tune your Detox setup, you can do so by modifying `.detoxrc.

#### Change Testing Simulator/Emulator

For iOS, in terminal, run `xcrun simctl list` to view a list of simulators on your Mac. To open your active simulator, `run open -a simulator`. In `frontend-e2e/.detoxrc.json`, you could change the simulator under `devices.simulator.device`.
For iOS, in terminal, run `xcrun simctl list devices available` to view a list of simulators on your Mac. To open your active simulator, `run open -a simulator`. In `frontend-e2e/.detoxrc.json`, you could change the simulator under `devices.simulator.device`.

For Android, in terminal, run `emulator -list-avds` to view a list of emulators installed. To open your emulator, run `emulator -avd <your emulator name>`. In `frontend-e2e/.detoxrc.json`, you could change the simulator under `devices.emulator.device`.

Expand Down
8 changes: 1 addition & 7 deletions e2e/expo/src/expo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@ describe('expo', () => {
runCLI(
`generate @nrwl/expo:component ${componentName} --project=${libName} --export --no-interactive`
);
expectTestsPass(await runCLIAsync(`test ${appName}`));
expectTestsPass(await runCLIAsync(`test ${libName}`));

updateFile(`apps/${appName}/src/app/App.tsx`, (content) => {
let updated = `// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport {${componentName}} from '${proj}/${libName}';\n${content}`;
return updated;
});

expectTestsPass(await runCLIAsync(`test ${appName}`));
expectTestsPass(await runCLIAsync(`test ${libName}`));

const appLintResults = await runCLIAsync(`lint ${appName}`);
expect(appLintResults.combinedOutput).toContain('All files pass linting.');
Expand Down Expand Up @@ -124,11 +123,6 @@ describe('expo', () => {
});

it('should build publishable library', async () => {
const componentName = uniq('component');

runCLI(
`generate @nrwl/expo:component ${componentName} --project=${libName} --export`
);
expect(() => {
runCLI(`build ${libName}`);
checkFilesExist(`dist/libs/${libName}/index.js`);
Expand Down
2 changes: 2 additions & 0 deletions e2e/react-native/src/react-native.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ describe('react native', () => {
json.dependencies['react-native-image-picker'] = '1.0.0';
json.dependencies['react-native-gesture-handler'] = '1.0.0';
json.dependencies['react-native-safe-area-contex'] = '1.0.0';
json.dependencies['react-native-config'] = '1.0.0';
json.dependencies['@react-native-async-storage/async-storage'] = '1.0.0';
return JSON.stringify(json, null, 2);
});
// Add import for Nx to pick up
Expand Down
15 changes: 15 additions & 0 deletions packages/detox/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
"version": "16.0.0-beta.1",
"description": "Replace @nrwl/detox with @nx/detox",
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
},
"update-16-0-0-update-detoxrc": {
"cli": "nx",
"version": "16.0.0-beta.3",
"description": "Update .detoxrc.json and jest.config.json for detox 20",
"implementation": "./src/migrations/update-16-0-0/update-detoxrc-json"
}
},
"packageJsonUpdates": {
Expand Down Expand Up @@ -207,6 +213,15 @@
"alwaysAddToPackageJson": false
}
}
},
"16.0.0": {
"version": "16.0.0-beta.3",
"packages": {
"detox": {
"version": "~20.7.0",
"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 @@
"@nx/react": "file:../react"
},
"peerDependencies": {
"detox": "~20.5.0"
"detox": "~20.7.0"
},
"builders": "./executors.json",
"ng-update": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
"testRunner": "jest",
"runnerConfig": "jest.config.json",
"testRunner": {
"args": {
"$0": "jest",
"config": "./jest.config.json"
},
"jest": {
"setupTimeout": 120000
}
},
"apps": {
"ios.debug": {
"type": "ios.app",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"preset": "<%= offsetFromRoot %>jest.preset",
"rootDir": ".",
"testMatch": [
"<rootDir>/src/**/*.test.ts?(x)",
"<rootDir>/src/**/*.spec.ts?(x)"
],
"testTimeout": 120000,
"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)$)": "@nx/react/plugins/jest",
"^.+\\.[tj]sx?$": "babel-jest"
}
"setupFilesAfterEnv": ["<rootDir>/test-setup.ts"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Tree, formatFiles } from '@nx/devkit';
import { replaceNrwlPackageWithNxPackage } from '@nx/devkit/src/utils/replace-package';

export default async function replacePackage(tree: Tree): Promise<void> {
await replaceNrwlPackageWithNxPackage(tree, '@nrwl/detox', '@nx/detox');
replaceNrwlPackageWithNxPackage(tree, '@nrwl/detox', '@nx/detox');

await formatFiles(tree);
}

1 comment on commit cc0d912

@vercel
Copy link

@vercel vercel bot commented on cc0d912 Apr 24, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-nrwl.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-five.vercel.app
nx.dev

Please sign in to comment.