Skip to content

Commit

Permalink
feat(react-native): upgrade react-native to 0.72.1
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongemi committed Jul 5, 2023
1 parent b093306 commit 5e7b845
Show file tree
Hide file tree
Showing 51 changed files with 1,258 additions and 750 deletions.
17 changes: 12 additions & 5 deletions docs/generated/packages/react-native/executors/build-android.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@
"default": 8081
},
"tasks": {
"type": "array",
"items": { "type": "string" },
"oneOf": [
{ "type": "array", "items": { "type": "string" } },
{ "type": "string" }
],
"description": "Run custom Gradle tasks. By default it's \"assembleDebug\". Will override passed mode and variant arguments.",
"examples": [
"assembleDebug",
Expand All @@ -71,8 +73,12 @@
"default": false
},
"extraParams": {
"type": "string",
"description": "Custom params passed to gradle build command"
"oneOf": [
{ "type": "array", "items": { "type": "string" } },
{ "type": "string" }
],
"description": "Custom params passed to gradle build command",
"examples": ["-x lint -x test"]
},
"interactive": {
"type": "boolean",
Expand All @@ -81,7 +87,8 @@
"sync": {
"type": "boolean",
"description": "Syncs npm dependencies to `package.json` (for React Native autolink).",
"default": true
"default": true,
"x-deprecated": "Add sync-deps to dependsOn instead"
},
"resetCache": {
"type": "boolean",
Expand Down
13 changes: 7 additions & 6 deletions docs/generated/packages/react-native/executors/build-ios.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
"presets": [
{ "name": "Build iOS for a simulator", "keys": ["simulator"] },
{ "name": "Build iOS for a device", "keys": ["device"] },
{ "name": "Build iOS for a device with udid", "keys": ["udid"] },
{
"name": "Run `pod install` before building iOS app",
"keys": ["install"]
}
{ "name": "Build iOS for a device with udid", "keys": ["udid"] }
],
"properties": {
"simulator": {
Expand Down Expand Up @@ -72,17 +68,22 @@
"description": "Explicitly select which scheme and configuration to use before running a build"
},
"extraParams": {
"type": "string",
"oneOf": [
{ "type": "array", "items": { "type": "string" } },
{ "type": "string" }
],
"description": "Custom params that will be passed to xcodebuild command."
},
"install": {
"type": "boolean",
"description": "Runs `pod install` for native modules before building iOS app.",
"x-deprecated": "Add pod-install to dependsOn in project.json for this target instead",
"default": true
},
"sync": {
"type": "boolean",
"description": "Syncs npm dependencies to `package.json` (for React Native autolink).",
"x-deprecated": "Add sync-deps to dependsOn in project.json for this target instead",
"default": true
},
"resetCache": {
Expand Down
12 changes: 11 additions & 1 deletion docs/generated/packages/react-native/executors/pod-install.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,19 @@
"type": "object",
"properties": {
"buildFolder": {
"description": "Location for iOS build artifacts. Corresponds to Xcode's \"-derivedDataPath\". Relative to ios directory",
"description": "Location for iOS build artifacts. Corresponds to Xcode's \"-derivedDataPath\". Relative to ios directory.",
"type": "string",
"default": "./build"
},
"repoUpdate": {
"description": "Force running `pod repo update` before install.",
"type": "boolean",
"default": false
},
"deployment": {
"description": "Disallow any changes to the Podfile or the Podfile.lock during installation.",
"type": "boolean",
"default": false
}
},
"required": ["buildFolder"],
Expand Down
12 changes: 9 additions & 3 deletions docs/generated/packages/react-native/executors/run-android.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@
"default": 8081
},
"tasks": {
"type": "array",
"items": { "type": "string" },
"oneOf": [
{ "type": "array", "items": { "type": "string" } },
{ "type": "string" }
],
"description": "Run custom Gradle tasks. By default it's \"assembleDebug\". Will override passed mode and variant arguments.",
"examples": [
"assembleDebug",
Expand All @@ -95,7 +97,10 @@
"default": false
},
"extraParams": {
"type": "string",
"oneOf": [
{ "type": "array", "items": { "type": "string" } },
{ "type": "string" }
],
"description": "Custom params passed to gradle build command"
},
"interactive": {
Expand All @@ -105,6 +110,7 @@
"sync": {
"type": "boolean",
"description": "Syncs npm dependencies to `package.json` (for React Native autolink).",
"x-deprecated": "Add sync-deps to dependsOn for this target in project.json instead",
"default": true
},
"resetCache": {
Expand Down
9 changes: 7 additions & 2 deletions docs/generated/packages/react-native/executors/run-ios.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,22 @@
"description": "Explicitly select which scheme and configuration to use before running a build"
},
"extraParams": {
"type": "string",
"oneOf": [
{ "type": "array", "items": { "type": "string" } },
{ "type": "string" }
],
"description": "Custom params that will be passed to xcodebuild command."
},
"install": {
"type": "boolean",
"description": "Runs `pod install` for native modules before building iOS app.",
"default": true
"default": true,
"x-deprecated": "Add `pod-install` to dependsOn for this target in project.json instead."
},
"sync": {
"type": "boolean",
"description": "Syncs npm dependencies to `package.json` (for React Native autolink).",
"x-deprecated": "Add `sync-deps` to dependsOn for this target in project.json instead.",
"default": true
},
"resetCache": {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@
"magic-string": "~0.26.2",
"markdown-factory": "^0.0.6",
"memfs": "^3.0.1",
"metro-resolver": "^0.74.1",
"metro-config": "0.76.5",
"metro-resolver": "0.76.5",
"mini-css-extract-plugin": "~2.4.7",
"minimatch": "3.0.5",
"next-sitemap": "^3.1.10",
Expand Down
5 changes: 3 additions & 2 deletions packages/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"chalk": "^4.1.0",
"enhanced-resolve": "^5.8.3",
"fs-extra": "^11.1.0",
"metro-resolver": "^0.74.1",
"metro-config": "0.76.5",
"metro-resolver": "0.76.5",
"node-fetch": "^2.6.7",
"tar-fs": "^2.1.1",
"tsconfig-paths": "^4.1.2",
Expand All @@ -43,7 +44,7 @@
"@nx/webpack": "file:../webpack"
},
"peerDependencies": {
"expo": "^48.0.19"
"expo": "^49.0.0-beta.4"
},
"builders": "./executors.json",
"ng-update": {
Expand Down
34 changes: 20 additions & 14 deletions packages/expo/plugins/with-nx-metro.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { workspaceLayout, workspaceRoot } from '@nx/devkit';
import { mergeConfig } from 'metro-config';
import type { MetroConfig } from 'metro-config';
import { join } from 'path';
import { existsSync } from 'fs-extra';

Expand All @@ -7,35 +9,39 @@ import { getResolveRequest } from './metro-resolver';
interface WithNxOptions {
debug?: boolean;
extensions?: string[];
/**
* @deprecated in the metro.config.js, pass in to the getDefaultConfig instead: getDefaultConfig(__dirname)
*/
projectRoot?: string;
watchFolders?: string[];
}

export function withNxMetro(config: any, opts: WithNxOptions = {}) {
export async function withNxMetro(
userConfig: MetroConfig,
opts: WithNxOptions = {}
) {
const extensions = ['', 'ts', 'tsx', 'js', 'jsx', 'json'];
if (opts.debug) process.env.NX_REACT_NATIVE_DEBUG = 'true';
if (opts.extensions) extensions.push(...opts.extensions);

config.projectRoot = opts.projectRoot || workspaceRoot;

// Add support for paths specified by tsconfig
config.resolver = {
...config.resolver,
resolveRequest: getResolveRequest(extensions),
};

let watchFolders = config.watchFolders || [];
watchFolders = watchFolders.concat([
let watchFolders = [
join(workspaceRoot, 'node_modules'),
join(workspaceRoot, workspaceLayout().libsDir),
join(workspaceRoot, 'packages'),
]);
join(workspaceRoot, '.storybook'),
];
if (opts.watchFolders?.length) {
watchFolders = watchFolders.concat(opts.watchFolders);
}

watchFolders = watchFolders.filter((folder) => existsSync(folder));
config.watchFolders = watchFolders;

return config;
const nxConfig: MetroConfig = {
resolver: {
resolveRequest: getResolveRequest(extensions),
},
watchFolders,
};

return mergeConfig(userConfig, nxConfig);
}
20 changes: 10 additions & 10 deletions packages/expo/src/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export const nxVersion = require('../../package.json').version;

export const expoVersion = '48.0.19';
export const expoMetroConfigVersion = '0.7.1';
export const expoSplashScreenVersion = '~0.18.2';
export const expoStatusBarVersion = '~1.4.4';
export const expoUpdatesVersion = '~0.16.4';
export const expoCliVersion = '~0.7.3'; // @expo/cli
export const easCliVersion = '~3.13.3';
export const babelPresetExpoVersion = '~9.3.2';
export const expoVersion = '49.0.0-beta.4';
export const expoMetroConfigVersion = '~0.10.6';
export const expoSplashScreenVersion = '~0.20.3';
export const expoStatusBarVersion = '~1.6.0';
export const expoUpdatesVersion = '~0.18.7';
export const expoCliVersion = '~0.10.7'; // @expo/cli
export const easCliVersion = '~3.15.0';
export const babelPresetExpoVersion = '~9.5.0';

export const reactVersion = '18.2.0';
export const reactDomVersion = '18.2.0';
Expand All @@ -21,8 +21,8 @@ export const reactNativeWebVersion = '~0.18.12';
export const reactNativeSvgTransformerVersion = '1.0.0';
export const reactNativeSvgVersion = '13.4.0';

export const metroVersion = '0.74.1';
export const metroVersion = '0.76.5';

export const testingLibraryReactNativeVersion = '12.1.2';
export const testingLibraryJestNativeVersion = '5.4.2';
export const jestExpoVersion = '~48.0.2';
export const jestExpoVersion = '~49.0.0';
72 changes: 72 additions & 0 deletions packages/react-native/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@
"version": "16.1.0-beta.0",
"description": "Upgrade @storybook/react-native to 6.5",
"implementation": "./src/migrations/update-16-1-0/upgrade-storybook-6-5"
},
"update-16-5-0-add-dependsOn": {
"cli": "nx",
"version": "16.1.0-beta.0",
"description": "Add dependsOn like ensure-symlink or sync-deps to targets",
"implementation": "./src/migrations/update-16-5-0/add-depends-on"
}
},
"packageJsonUpdates": {
Expand Down Expand Up @@ -1348,6 +1354,72 @@
"alwaysAddToPackageJson": false
}
}
},
"16.5.0-beta.4": {
"version": "16.5.0-beta.4",
"packages": {
"react-native": {
"version": "0.72.1",
"alwaysAddToPackageJson": false
},
"@types/react-native": {
"version": "0.72.2",
"alwaysAddToPackageJson": false
},
"metro": {
"version": "0.76.5",
"alwaysAddToPackageJson": false
},
"metro-resolver": {
"version": "0.76.5",
"alwaysAddToPackageJson": false
},
"metro-config": {
"version": "0.76.5",
"alwaysAddToPackageJson": false
},
"metro-react-native-babel-preset": {
"version": "0.76.5",
"alwaysAddToPackageJson": false
},
"metro-babel-register": {
"version": "0.76.5",
"alwaysAddToPackageJson": false
},
"metro-react-native-babel-transformer": {
"version": "0.76.5",
"alwaysAddToPackageJson": false
},
"@react-native/metro-config": {
"version": "0.72.7",
"alwaysAddToPackageJson": false,
"addToPackageJson": "devDependencies"
},
"@react-native-community/cli": {
"version": "11.3.3",
"alwaysAddToPackageJson": false
},
"@react-native-community/cli-platform-android": {
"version": "11.3.3",
"alwaysAddToPackageJson": false
},
"@react-native-community/cli-platform-ios": {
"version": "11.3.3",
"alwaysAddToPackageJson": false
},
"@babel/runtime": {
"version": "7.22.6",
"alwaysAddToPackageJson": false
},
"@react-native-async-storage/async-storage": {
"version": "1.19.0",
"alwaysAddToPackageJson": false
},
"react-native-safe-area-context": {
"version": "4.6.4",
"alwaysAddToPackageJson": false
}
}
}
}
}
5 changes: 3 additions & 2 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"fs-extra": "^11.1.0",
"glob": "7.1.4",
"ignore": "^5.0.4",
"metro-resolver": "^0.74.1",
"metro-config": "0.76.5",
"metro-resolver": "0.76.5",
"minimatch": "3.0.5",
"node-fetch": "^2.6.7",
"tsconfig-paths": "^4.1.2",
Expand All @@ -43,7 +44,7 @@
"@nx/workspace": "file:../workspace"
},
"peerDependencies": {
"react-native": ">= 0.71.0"
"react-native": ">= 0.72.0 < 0.73.0"
},
"builders": "./executors.json",
"ng-update": {
Expand Down
Loading

0 comments on commit 5e7b845

Please sign in to comment.