From 41fcb07a62d75a7bcbbb8cb3dfcb54fd3b2cbde9 Mon Sep 17 00:00:00 2001 From: shivenmian Date: Tue, 27 Sep 2022 12:25:35 -0700 Subject: [PATCH 1/5] chore: renamed react-native-codegen to @react-native/codegen --- .circleci/verdaccio.yml | 3 --- .gitignore | 2 +- CHANGELOG.md | 16 ++++++++-------- ReactAndroid/build.gradle | 2 +- packages/babel-plugin-codegen/index.js | 6 +++--- packages/babel-plugin-codegen/package.json | 2 +- packages/eslint-plugin-specs/package.json | 2 +- .../eslint-plugin-specs/react-native-modules.js | 6 +++--- packages/react-native-codegen/README.md | 8 ++++---- packages/react-native-codegen/package.json | 2 +- .../kotlin/com/facebook/react/ReactExtension.kt | 6 +++--- packages/rn-tester/android/app/build.gradle | 4 ++-- repo-config/package.json | 2 +- scripts/cocoapods/__tests__/codegen-test.rb | 6 +++--- scripts/cocoapods/codegen.rb | 2 +- scripts/codegen/codegen-utils.js | 4 ++-- scripts/codegen/generate-artifacts-executor.js | 2 +- scripts/generate-provider-cli.js | 2 +- scripts/set-rn-version.js | 6 +++--- template/android/app/build.gradle | 4 ++-- 20 files changed, 42 insertions(+), 45 deletions(-) diff --git a/.circleci/verdaccio.yml b/.circleci/verdaccio.yml index 67f855a75317..cec3a2204759 100644 --- a/.circleci/verdaccio.yml +++ b/.circleci/verdaccio.yml @@ -19,9 +19,6 @@ packages: '@react-native/*': access: $all publish: $all - 'react-native-codegen': - access: $all - publish: $all '@*/*': access: $all publish: $authenticated diff --git a/.gitignore b/.gitignore index 7611c0691d57..ca4b7693511f 100644 --- a/.gitignore +++ b/.gitignore @@ -113,7 +113,7 @@ package-lock.json !/packages/rn-tester/Pods/__offline_mirrors_hermes__ !/packages/rn-tester/Pods/__offline_mirrors_jsc__ -# react-native-codegen +# @react-native/codegen /React/FBReactNativeSpec/FBReactNativeSpec /packages/react-native-codegen/lib /packages/react-native-codegen/tmp/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a3a52574eae..0e853d032148 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,7 +84,7 @@ - Accept TypeScript type `T | null | undefined` as a maybe type of T in turbo module. ([9ecd203eec](https://github.com/facebook/react-native/commit/9ecd203eec97e7d21d10311d950c9f8f30c7a4b1) by [@ZihanChen-MSFT](https://github.com/ZihanChen-MSFT)) - Bump react-native-gradle-plugin to 0.70.3 ([e33633644c](https://github.com/facebook/react-native/commit/e33633644c70ea39af6e450fcf31d9458051fd5f) by [@dmytrorykun](https://github.com/dmytrorykun)) -- Bump react-native-codegen to 0.70.5 ([6a8c38eef2](https://github.com/facebook/react-native/commit/6a8c38eef272e79e52a35941afa9c3fe9e8fc191) by [@dmytrorykun](https://github.com/dmytrorykun)) +- Bump @react-native/codegen to 0.70.5 ([6a8c38eef2](https://github.com/facebook/react-native/commit/6a8c38eef272e79e52a35941afa9c3fe9e8fc191) by [@dmytrorykun](https://github.com/dmytrorykun)) - Hermes version bump for 0.70.1 ([5132211228](https://github.com/facebook/react-native/commit/5132211228a5b9e36d58c1f7e2c99ccaabe1ba3d) by [@dmytrorykun](https://github.com/dmytrorykun)) ### Fixed @@ -317,7 +317,7 @@ ### Changed -- Bump react-native-codegen to 0.69.2 ([df3d52bfbf](https://github.com/facebook/react-native/commit/df3d52bfbf4254cd16e1dc0ca0af2743cd7e11c1) by [@dmytrorykun](https://github.com/dmytrorykun)) +- Bump @react-native/codegen to 0.69.2 ([df3d52bfbf](https://github.com/facebook/react-native/commit/df3d52bfbf4254cd16e1dc0ca0af2743cd7e11c1) by [@dmytrorykun](https://github.com/dmytrorykun)) #### Android specific @@ -634,8 +634,8 @@ ### Changed -- Bump used version of react-native-codegen to 0.0.17 ([dfda480a98](https://github.com/facebook/react-native/commit/dfda480a9888d95c542cea40f25e8e783565c1db) by [@cortinico](https://github.com/cortinico)) -- Bump react-native-codegen to 0.0.17 ([a5ddc2e165](https://github.com/facebook/react-native/commit/a5ddc2e16523ea336ffbecf7acfd4820469a29e7) by [@cortinico](https://github.com/cortinico)) +- Bump used version of @react-native/codegen to 0.0.17 ([dfda480a98](https://github.com/facebook/react-native/commit/dfda480a9888d95c542cea40f25e8e783565c1db) by [@cortinico](https://github.com/cortinico)) +- Bump @react-native/codegen to 0.0.17 ([a5ddc2e165](https://github.com/facebook/react-native/commit/a5ddc2e16523ea336ffbecf7acfd4820469a29e7) by [@cortinico](https://github.com/cortinico)) ### Fixed @@ -734,7 +734,7 @@ - Upgraded packages to the latest versions for ESLint v7. ([cf763cdf81](https://github.com/facebook/react-native/commit/cf763cdf816e1cad20caf2347c54bc96c7f6dd47) by [@yungsters](https://github.com/yungsters)) - Updated the links for the discussions and changelog ([daf37a1fce](https://github.com/facebook/react-native/commit/daf37a1fce43403e6320e1e3023e86fd1b970bdf) by [@MikeyAlmighty](https://github.com/MikeyAlmighty)) - XMLHttpRequest.getAllResponseHeaders() now returns headers with names lowercased and sorted in ascending order, as per specification ([b2415c4866](https://github.com/facebook/react-native/commit/b2415c48669391ee1ab7c6450748c4d91097a666) by [@ascherkus](https://github.com/ascherkus)) -- Bump react-native-codegen to 0.0.9 ([e3a71b019f](https://github.com/facebook/react-native/commit/e3a71b019fa78e2b4b3454ccc59ea9c8cc543b29) by [@cortinico](https://github.com/cortinico)) +- Bump @react-native/codegen to 0.0.9 ([e3a71b019f](https://github.com/facebook/react-native/commit/e3a71b019fa78e2b4b3454ccc59ea9c8cc543b29) by [@cortinico](https://github.com/cortinico)) - Accessing `Image.propTypes`, `Text.propTypes`, `TextInput.propTypes`, `ColorPropType`, `EdgeInsetsPropType`, `PointPropType`, or `ViewPropTypes` now emits a deprecation warning. ([3f629049ba](https://github.com/facebook/react-native/commit/3f629049ba9773793978cf9093c7a71af15e3e8d) by [@yungsters](https://github.com/yungsters)) - Bump `core-workflow-apply-version-label` version ([e973b3afc2](https://github.com/facebook/react-native/commit/e973b3afc274f892a0e5a6fdea9004dc5d84eb2b) by [@lucasbento](https://github.com/lucasbento)) - Add `vendor/bundle` into .gitignore template ([2f67f5d68b](https://github.com/facebook/react-native/commit/2f67f5d68b17010c49f2996a788fe68c1fe2e9f6) by [@MoOx](https://github.com/MoOx)) @@ -1217,7 +1217,7 @@ ### Highlights - Hermes 0.8.1. Please see the highlighted changes from its [0.8.0](https://github.com/facebook/hermes/releases/tag/v0.8.0) and [0.8.1](https://github.com/facebook/hermes/releases/tag/v0.8.1) release notes. -- `react-native-codegen` version `0.0.7` is now needed as a `devDependency` in the `package.json`. +- `@react-native/codegen` version `0.0.7` is now needed as a `devDependency` in the `package.json`. ### Breaking Changes @@ -1257,7 +1257,7 @@ - Added reset method to `RCTFabricSurface` to help with reloads ([53858ceaa3](https://github.com/facebook/react-native/commit/53858ceaa3beab02726b1bd6e125e506477d445e) by [@PeteTheHeat](https://github.com/PeteTheHeat)) - Allow `RCTRootView` to be initialized with a frame ([00bc09c8f7](https://github.com/facebook/react-native/commit/00bc09c8f76879eb1f9a92a6a643191da9355de8) by [@appden](https://github.com/appden)) - Allow for configuring the `NSURLSessionConfiguration` ([58444c74f5](https://github.com/facebook/react-native/commit/58444c74f5c18b74e88a6c1cd0f059fe434c1a21) by [@hakonk](https://github.com/hakonk)) -- Use react-native-codegen in iOS app template ([e99b8bbb40](https://github.com/facebook/react-native/commit/e99b8bbb404f8cd1f11b6c7998083be530d7b8a4) by [@hramos](https://github.com/hramos)) +- Use @react-native/codegen in iOS app template ([e99b8bbb40](https://github.com/facebook/react-native/commit/e99b8bbb404f8cd1f11b6c7998083be530d7b8a4) by [@hramos](https://github.com/hramos)) ### Changed @@ -1275,7 +1275,7 @@ - `DevSettings` no longer inherits from `NativeEventEmitter` ([70cd569e7e](https://github.com/facebook/react-native/commit/70cd569e7e4cceac81023eae4ea5089cff2f9b59) by [@yungsters](https://github.com/yungsters)) - LogBox will not initially collapse stack frames if every frame would be collapsed. ([88a41f180c](https://github.com/facebook/react-native/commit/88a41f180c315bc55e05d77ddc3fc671ad8630e6) by [@yungsters](https://github.com/yungsters)) - Update package name warning of deprecated modules ([34e1b0ef98](https://github.com/facebook/react-native/commit/34e1b0ef981559adc09cd9f994bef9584f1c82b7) by [@Naturalclar](https://github.com/Naturalclar)) -- Update react-native-codegen to 0.0.7 ([cd6c9f3273](https://github.com/facebook/react-native/commit/cd6c9f3273fbe41052c4ec8512d3b1129daf149b) by [@Naturalclar](https://github.com/Naturalclar)) +- Update @react-native/codegen to 0.0.7 ([cd6c9f3273](https://github.com/facebook/react-native/commit/cd6c9f3273fbe41052c4ec8512d3b1129daf149b) by [@Naturalclar](https://github.com/Naturalclar)) - Update template devDependencies ([652e3953f4](https://github.com/facebook/react-native/commit/652e3953f48938580e1bf8ea1ba70105997e59d2) by [@Bardiamist](https://github.com/Bardiamist)) - Don't minify JS bundle by default when using hermes ([1a67dda668](https://github.com/facebook/react-native/commit/1a67dda668c71d961a4bb3b0cdf6aa22c0e5c138) by [@janicduplessis](https://github.com/janicduplessis)) - Migrate warnings in index.js to point to new lean core repos ([4421a64ac1](https://github.com/facebook/react-native/commit/4421a64ac1ea9df3827fb99194c8576a0750beab) by [@Naturalclar](https://github.com/Naturalclar)) diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index 041f546c668f..41a3f559ccf4 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -635,7 +635,7 @@ react { reactNativeDir = file("$projectDir/..") // We search for the codegen in either one of the `node_modules` folder or in the // root packages folder (that's for when we build from source without calling `yarn install`). - codegenDir = file(findNodeModulePath(projectDir, "react-native-codegen") ?: "../packages/react-native-codegen/") + codegenDir = file(findNodeModulePath(projectDir, "@react-native/codegen") ?: "../packages/react-native-codegen/") } apply plugin: "org.jetbrains.kotlin.android" diff --git a/packages/babel-plugin-codegen/index.js b/packages/babel-plugin-codegen/index.js index b1a11612ecae..c148ad79bdf5 100644 --- a/packages/babel-plugin-codegen/index.js +++ b/packages/babel-plugin-codegen/index.js @@ -19,9 +19,9 @@ try { RNCodegen = require('react-native-codegen/src/generators/RNCodegen'); } catch (e) { // Fallback to lib when source doesn't exit (e.g. when installed as a dev dependency) - flowParser = require('react-native-codegen/lib/parsers/flow'); - typeScriptParser = require('react-native-codegen/lib/parsers/typescript'); - RNCodegen = require('react-native-codegen/lib/generators/RNCodegen'); + flowParser = require('@react-native/codegen/lib/parsers/flow'); + typeScriptParser = require('@react-native/codegen/lib/parsers/typescript'); + RNCodegen = require('@react-native/codegen/lib/generators/RNCodegen'); } function parseFile(filename, code) { diff --git a/packages/babel-plugin-codegen/package.json b/packages/babel-plugin-codegen/package.json index 2706e70e2fc3..f91f51da9139 100644 --- a/packages/babel-plugin-codegen/package.json +++ b/packages/babel-plugin-codegen/package.json @@ -11,7 +11,7 @@ "index.js" ], "dependencies": { - "react-native-codegen": "*" + "@react-native/codegen": "*" }, "devDependencies": { "@babel/core": "^7.14.0" diff --git a/packages/eslint-plugin-specs/package.json b/packages/eslint-plugin-specs/package.json index b27d8d7bf2f7..02c383a96ac0 100644 --- a/packages/eslint-plugin-specs/package.json +++ b/packages/eslint-plugin-specs/package.json @@ -17,10 +17,10 @@ "@babel/eslint-parser": "^7.18.2", "@babel/plugin-transform-flow-strip-types": "^7.0.0", "@babel/preset-flow": "^7.17.12", + "@react-native/codegen": "*", "flow-parser": "^0.185.0", "make-dir": "^2.1.0", "pirates": "^4.0.1", - "react-native-codegen": "*", "source-map-support": "0.5.0" }, "license": "MIT" diff --git a/packages/eslint-plugin-specs/react-native-modules.js b/packages/eslint-plugin-specs/react-native-modules.js index f303ab539eba..8020321d0afa 100644 --- a/packages/eslint-plugin-specs/react-native-modules.js +++ b/packages/eslint-plugin-specs/react-native-modules.js @@ -39,13 +39,13 @@ function requireModuleParser() { }); } else { const config = { - only: [/react-native-codegen\/lib\//], + only: [/@react-native\/codegen\/lib\//], plugins: [require('@babel/plugin-transform-flow-strip-types').default], }; withBabelRegister(config, () => { - RNModuleParser = require('react-native-codegen/lib/parsers/flow/modules'); - RNParserUtils = require('react-native-codegen/lib/parsers/utils'); + RNModuleParser = require('@react-native/codegen/lib/parsers/flow/modules'); + RNParserUtils = require('@react-native/codegen/lib/parsers/flow/utils'); }); } } diff --git a/packages/react-native-codegen/README.md b/packages/react-native-codegen/README.md index d1661e4e5bbf..2380d87f716a 100644 --- a/packages/react-native-codegen/README.md +++ b/packages/react-native-codegen/README.md @@ -1,17 +1,17 @@ -# react-native-codegen +# @react-native/codegen [![Version][version-badge]][package] ## Installation ``` -yarn add --dev react-native-codegen +yarn add --dev @react-native/codegen ``` *Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like* -[version-badge]: https://img.shields.io/npm/v/react-native-codegen?style=flat-square -[package]: https://www.npmjs.com/package/react-native-codegen +[version-badge]: https://img.shields.io/npm/v/@react-native/codegen?style=flat-square +[package]: https://www.npmjs.com/package/@react-native/codegen ## Testing diff --git a/packages/react-native-codegen/package.json b/packages/react-native-codegen/package.json index 485356731f0b..da20ee595627 100644 --- a/packages/react-native-codegen/package.json +++ b/packages/react-native-codegen/package.json @@ -1,5 +1,5 @@ { - "name": "react-native-codegen", + "name": "@react-native/codegen", "version": "0.72.0", "description": "⚛️ Code generation tools for React Native", "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-codegen", diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt index 5dfb3737ee9d..553bc1750209 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt @@ -31,7 +31,7 @@ abstract class ReactExtension @Inject constructor(project: Project) { /** * The path to the react-native NPM package folder. * - * Default: ${rootProject.dir}/../node_modules/react-native-codegen + * Default: ${rootProject.dir}/../node_modules/react-native */ val reactNativeDir: DirectoryProperty = objects.directoryProperty().convention(root.dir("node_modules/react-native")) @@ -121,10 +121,10 @@ abstract class ReactExtension @Inject constructor(project: Project) { /** * The path to the react-native-codegen NPM package folder. * - * Default: ${rootProject.dir}/../node_modules/react-native-codegen + * Default: ${rootProject.dir}/../node_modules/@react-native/codegen */ val codegenDir: DirectoryProperty = - objects.directoryProperty().convention(root.dir("node_modules/react-native-codegen")) + objects.directoryProperty().convention(root.dir("node_modules/@react-native/codegen")) /** * The root directory for all JS files for the app. diff --git a/packages/rn-tester/android/app/build.gradle b/packages/rn-tester/android/app/build.gradle index bbe757547912..964948984f04 100644 --- a/packages/rn-tester/android/app/build.gradle +++ b/packages/rn-tester/android/app/build.gradle @@ -20,8 +20,8 @@ react { root = file("../../") // The folder where the react-native NPM package is. Default is ../node_modules/react-native reactNativeDir = rootDir - // The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen - codegenDir = file("$rootDir/node_modules/react-native-codegen") + // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen + codegenDir = file("$rootDir/node_modules/@react-native/codegen") // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js cliFile = file("$rootDir/cli.js") diff --git a/repo-config/package.json b/repo-config/package.json index 1c7678440938..1c91d260d31c 100644 --- a/repo-config/package.json +++ b/repo-config/package.json @@ -14,6 +14,7 @@ "@babel/generator": "^7.14.0", "@babel/plugin-transform-regenerator": "^7.0.0", "@definitelytyped/dtslint": "^0.0.127", + "@react-native/codegen": "^0.72.0", "@react-native/eslint-config": "*", "@react-native/eslint-plugin": "*", "@react-native/eslint-plugin-specs": "^0.72.0", @@ -47,7 +48,6 @@ "mkdirp": "^0.5.1", "prettier": "^2.4.1", "react": "18.2.0", - "react-native-codegen": "^0.72.0", "react-test-renderer": "18.2.0", "shelljs": "^0.8.5", "signedsource": "^1.0.0", diff --git a/scripts/cocoapods/__tests__/codegen-test.rb b/scripts/cocoapods/__tests__/codegen-test.rb index ef574251c366..ce1f3b700db2 100644 --- a/scripts/cocoapods/__tests__/codegen-test.rb +++ b/scripts/cocoapods/__tests__/codegen-test.rb @@ -90,7 +90,7 @@ def testCheckAndGenerateEmptyThirdPartyProvider_whenHeaderMissingAndCodegenMissi ]) assert_equal(Dir.exist_invocation_params, [ @base_path + "/"+ @prefix + "/packages/react-native-codegen", - @base_path + "/"+ @prefix + "/../react-native-codegen", + @base_path + "/"+ @prefix + "/../@react-native/codegen", ]) assert_equal(Pod::UI.collected_messages, []) assert_equal($collected_commands, []) @@ -147,7 +147,7 @@ def testCheckAndGenerateEmptyThirdPartyProvider_whenImplementationMissingAndCode def testCheckAndGenerateEmptyThirdPartyProvider_whenBothMissing_buildCodegen() # Arrange - codegen_cli_path = @base_path + "/" + @prefix + "/../react-native-codegen" + codegen_cli_path = @base_path + "/" + @prefix + "/../@react-native/codegen" Dir.mocked_existing_dirs([ codegen_cli_path, ]) @@ -170,7 +170,7 @@ def testCheckAndGenerateEmptyThirdPartyProvider_whenBothMissing_buildCodegen() "[Codegen] building #{codegen_cli_path}.", "[Codegen] generating an empty RCTThirdPartyFabricComponentsProvider" ]) - assert_equal($collected_commands, ["~/app/ios/../../../react-native-codegen/scripts/oss/build.sh"]) + assert_equal($collected_commands, ["~/app/ios/../../../@react-native/codegen/scripts/oss/build.sh"]) assert_equal(File.open_files[0].collected_write, ["[]"]) assert_equal(File.open_files[0].fsync_invocation_count, 1) assert_equal(Pod::Executable.executed_commands[0], { diff --git a/scripts/cocoapods/codegen.rb b/scripts/cocoapods/codegen.rb index f3c214de8193..0d1dd5ffc6ab 100644 --- a/scripts/cocoapods/codegen.rb +++ b/scripts/cocoapods/codegen.rb @@ -10,7 +10,7 @@ # @throws an error if it could not find the codegen folder. def build_codegen!(react_native_path, relative_installation_root) codegen_repo_path = "#{relative_installation_root}/#{react_native_path}/packages/react-native-codegen"; - codegen_npm_path = "#{relative_installation_root}/#{react_native_path}/../react-native-codegen"; + codegen_npm_path = "#{relative_installation_root}/#{react_native_path}/../@react-native/codegen"; codegen_cli_path = "" if Dir.exist?(codegen_repo_path) diff --git a/scripts/codegen/codegen-utils.js b/scripts/codegen/codegen-utils.js index 469f426bb79b..b739d81c5a40 100644 --- a/scripts/codegen/codegen-utils.js +++ b/scripts/codegen/codegen-utils.js @@ -12,7 +12,7 @@ /** * Wrapper required to abstract away from the actual codegen. * This is needed because, when running tests in Sandcastle, not everything is setup as usually. - * For example, the `react-native-codegen` lib is not present. + * For example, the `@react-native/codegen` lib is not present. * * Thanks to this wrapper, we are able to mock the getter for the codegen in a way that allow us to return * a custom object which mimics the Codegen interface. @@ -24,7 +24,7 @@ function getCodegen() { try { RNCodegen = require('../../packages/react-native-codegen/lib/generators/RNCodegen.js'); } catch (e) { - RNCodegen = require('react-native-codegen/lib/generators/RNCodegen.js'); + RNCodegen = require('@react-native/codegen/lib/generators/RNCodegen.js'); } if (!RNCodegen) { throw 'RNCodegen not found.'; diff --git a/scripts/codegen/generate-artifacts-executor.js b/scripts/codegen/generate-artifacts-executor.js index 68a47b6fab5b..757ce492c5ae 100644 --- a/scripts/codegen/generate-artifacts-executor.js +++ b/scripts/codegen/generate-artifacts-executor.js @@ -24,7 +24,7 @@ const path = require('path'); const RN_ROOT = path.join(__dirname, '../..'); const CODEGEN_REPO_PATH = `${RN_ROOT}/packages/react-native-codegen`; -const CODEGEN_NPM_PATH = `${RN_ROOT}/../react-native-codegen`; +const CODEGEN_NPM_PATH = `${RN_ROOT}/../@react-native/codegen`; const CORE_LIBRARIES = new Set(['rncore', 'FBReactNativeSpec']); const REACT_NATIVE_DEPENDENCY_NAME = 'react-native'; diff --git a/scripts/generate-provider-cli.js b/scripts/generate-provider-cli.js index 9b7744c5c922..852a8d300093 100644 --- a/scripts/generate-provider-cli.js +++ b/scripts/generate-provider-cli.js @@ -13,7 +13,7 @@ let RNCodegen; try { RNCodegen = require('../packages/react-native-codegen/lib/generators/RNCodegen.js'); } catch (e) { - RNCodegen = require('react-native-codegen/lib/generators/RNCodegen.js'); + RNCodegen = require('@react-native/codegen/lib/generators/RNCodegen.js'); if (!RNCodegen) { throw 'RNCodegen not found.'; } diff --git a/scripts/set-rn-version.js b/scripts/set-rn-version.js index 44f9ae4764a4..4e04fe2fe649 100755 --- a/scripts/set-rn-version.js +++ b/scripts/set-rn-version.js @@ -121,11 +121,11 @@ packageJson.devDependencies = { ...packageJson.devDependencies, ...repoConfigJson.dependencies, }; -// Make react-native-codegen a direct dependency of react-native -delete packageJson.devDependencies['react-native-codegen']; +// Make @react-native/codegen a direct dependency of react-native +delete packageJson.devDependencies['@react-native/codegen']; packageJson.dependencies = { ...packageJson.dependencies, - 'react-native-codegen': repoConfigJson.dependencies['react-native-codegen'], + '@react-native/codegen': repoConfigJson.dependencies['@react-native/codegen'], }; fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2), 'utf-8'); diff --git a/template/android/app/build.gradle b/template/android/app/build.gradle index 71195c76234a..096417b06c75 100644 --- a/template/android/app/build.gradle +++ b/template/android/app/build.gradle @@ -13,8 +13,8 @@ react { // root = file("../") // The folder where the react-native NPM package is. Default is ../node_modules/react-native // reactNativeDir = file("../node_modules/react-native") - // The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen - // codegenDir = file("../node_modules/react-native-codegen") + // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen + // codegenDir = file("../node_modules/@react-native/codegen") // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js // cliFile = file("../node_modules/react-native/cli.js") From 01ce8e4a4009961bde9d8eed3033354e891f9d9f Mon Sep 17 00:00:00 2001 From: shivenmian Date: Wed, 28 Sep 2022 09:35:29 -0700 Subject: [PATCH 2/5] fix: restored CHANGELOG --- CHANGELOG.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e853d032148..2a3a52574eae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,7 +84,7 @@ - Accept TypeScript type `T | null | undefined` as a maybe type of T in turbo module. ([9ecd203eec](https://github.com/facebook/react-native/commit/9ecd203eec97e7d21d10311d950c9f8f30c7a4b1) by [@ZihanChen-MSFT](https://github.com/ZihanChen-MSFT)) - Bump react-native-gradle-plugin to 0.70.3 ([e33633644c](https://github.com/facebook/react-native/commit/e33633644c70ea39af6e450fcf31d9458051fd5f) by [@dmytrorykun](https://github.com/dmytrorykun)) -- Bump @react-native/codegen to 0.70.5 ([6a8c38eef2](https://github.com/facebook/react-native/commit/6a8c38eef272e79e52a35941afa9c3fe9e8fc191) by [@dmytrorykun](https://github.com/dmytrorykun)) +- Bump react-native-codegen to 0.70.5 ([6a8c38eef2](https://github.com/facebook/react-native/commit/6a8c38eef272e79e52a35941afa9c3fe9e8fc191) by [@dmytrorykun](https://github.com/dmytrorykun)) - Hermes version bump for 0.70.1 ([5132211228](https://github.com/facebook/react-native/commit/5132211228a5b9e36d58c1f7e2c99ccaabe1ba3d) by [@dmytrorykun](https://github.com/dmytrorykun)) ### Fixed @@ -317,7 +317,7 @@ ### Changed -- Bump @react-native/codegen to 0.69.2 ([df3d52bfbf](https://github.com/facebook/react-native/commit/df3d52bfbf4254cd16e1dc0ca0af2743cd7e11c1) by [@dmytrorykun](https://github.com/dmytrorykun)) +- Bump react-native-codegen to 0.69.2 ([df3d52bfbf](https://github.com/facebook/react-native/commit/df3d52bfbf4254cd16e1dc0ca0af2743cd7e11c1) by [@dmytrorykun](https://github.com/dmytrorykun)) #### Android specific @@ -634,8 +634,8 @@ ### Changed -- Bump used version of @react-native/codegen to 0.0.17 ([dfda480a98](https://github.com/facebook/react-native/commit/dfda480a9888d95c542cea40f25e8e783565c1db) by [@cortinico](https://github.com/cortinico)) -- Bump @react-native/codegen to 0.0.17 ([a5ddc2e165](https://github.com/facebook/react-native/commit/a5ddc2e16523ea336ffbecf7acfd4820469a29e7) by [@cortinico](https://github.com/cortinico)) +- Bump used version of react-native-codegen to 0.0.17 ([dfda480a98](https://github.com/facebook/react-native/commit/dfda480a9888d95c542cea40f25e8e783565c1db) by [@cortinico](https://github.com/cortinico)) +- Bump react-native-codegen to 0.0.17 ([a5ddc2e165](https://github.com/facebook/react-native/commit/a5ddc2e16523ea336ffbecf7acfd4820469a29e7) by [@cortinico](https://github.com/cortinico)) ### Fixed @@ -734,7 +734,7 @@ - Upgraded packages to the latest versions for ESLint v7. ([cf763cdf81](https://github.com/facebook/react-native/commit/cf763cdf816e1cad20caf2347c54bc96c7f6dd47) by [@yungsters](https://github.com/yungsters)) - Updated the links for the discussions and changelog ([daf37a1fce](https://github.com/facebook/react-native/commit/daf37a1fce43403e6320e1e3023e86fd1b970bdf) by [@MikeyAlmighty](https://github.com/MikeyAlmighty)) - XMLHttpRequest.getAllResponseHeaders() now returns headers with names lowercased and sorted in ascending order, as per specification ([b2415c4866](https://github.com/facebook/react-native/commit/b2415c48669391ee1ab7c6450748c4d91097a666) by [@ascherkus](https://github.com/ascherkus)) -- Bump @react-native/codegen to 0.0.9 ([e3a71b019f](https://github.com/facebook/react-native/commit/e3a71b019fa78e2b4b3454ccc59ea9c8cc543b29) by [@cortinico](https://github.com/cortinico)) +- Bump react-native-codegen to 0.0.9 ([e3a71b019f](https://github.com/facebook/react-native/commit/e3a71b019fa78e2b4b3454ccc59ea9c8cc543b29) by [@cortinico](https://github.com/cortinico)) - Accessing `Image.propTypes`, `Text.propTypes`, `TextInput.propTypes`, `ColorPropType`, `EdgeInsetsPropType`, `PointPropType`, or `ViewPropTypes` now emits a deprecation warning. ([3f629049ba](https://github.com/facebook/react-native/commit/3f629049ba9773793978cf9093c7a71af15e3e8d) by [@yungsters](https://github.com/yungsters)) - Bump `core-workflow-apply-version-label` version ([e973b3afc2](https://github.com/facebook/react-native/commit/e973b3afc274f892a0e5a6fdea9004dc5d84eb2b) by [@lucasbento](https://github.com/lucasbento)) - Add `vendor/bundle` into .gitignore template ([2f67f5d68b](https://github.com/facebook/react-native/commit/2f67f5d68b17010c49f2996a788fe68c1fe2e9f6) by [@MoOx](https://github.com/MoOx)) @@ -1217,7 +1217,7 @@ ### Highlights - Hermes 0.8.1. Please see the highlighted changes from its [0.8.0](https://github.com/facebook/hermes/releases/tag/v0.8.0) and [0.8.1](https://github.com/facebook/hermes/releases/tag/v0.8.1) release notes. -- `@react-native/codegen` version `0.0.7` is now needed as a `devDependency` in the `package.json`. +- `react-native-codegen` version `0.0.7` is now needed as a `devDependency` in the `package.json`. ### Breaking Changes @@ -1257,7 +1257,7 @@ - Added reset method to `RCTFabricSurface` to help with reloads ([53858ceaa3](https://github.com/facebook/react-native/commit/53858ceaa3beab02726b1bd6e125e506477d445e) by [@PeteTheHeat](https://github.com/PeteTheHeat)) - Allow `RCTRootView` to be initialized with a frame ([00bc09c8f7](https://github.com/facebook/react-native/commit/00bc09c8f76879eb1f9a92a6a643191da9355de8) by [@appden](https://github.com/appden)) - Allow for configuring the `NSURLSessionConfiguration` ([58444c74f5](https://github.com/facebook/react-native/commit/58444c74f5c18b74e88a6c1cd0f059fe434c1a21) by [@hakonk](https://github.com/hakonk)) -- Use @react-native/codegen in iOS app template ([e99b8bbb40](https://github.com/facebook/react-native/commit/e99b8bbb404f8cd1f11b6c7998083be530d7b8a4) by [@hramos](https://github.com/hramos)) +- Use react-native-codegen in iOS app template ([e99b8bbb40](https://github.com/facebook/react-native/commit/e99b8bbb404f8cd1f11b6c7998083be530d7b8a4) by [@hramos](https://github.com/hramos)) ### Changed @@ -1275,7 +1275,7 @@ - `DevSettings` no longer inherits from `NativeEventEmitter` ([70cd569e7e](https://github.com/facebook/react-native/commit/70cd569e7e4cceac81023eae4ea5089cff2f9b59) by [@yungsters](https://github.com/yungsters)) - LogBox will not initially collapse stack frames if every frame would be collapsed. ([88a41f180c](https://github.com/facebook/react-native/commit/88a41f180c315bc55e05d77ddc3fc671ad8630e6) by [@yungsters](https://github.com/yungsters)) - Update package name warning of deprecated modules ([34e1b0ef98](https://github.com/facebook/react-native/commit/34e1b0ef981559adc09cd9f994bef9584f1c82b7) by [@Naturalclar](https://github.com/Naturalclar)) -- Update @react-native/codegen to 0.0.7 ([cd6c9f3273](https://github.com/facebook/react-native/commit/cd6c9f3273fbe41052c4ec8512d3b1129daf149b) by [@Naturalclar](https://github.com/Naturalclar)) +- Update react-native-codegen to 0.0.7 ([cd6c9f3273](https://github.com/facebook/react-native/commit/cd6c9f3273fbe41052c4ec8512d3b1129daf149b) by [@Naturalclar](https://github.com/Naturalclar)) - Update template devDependencies ([652e3953f4](https://github.com/facebook/react-native/commit/652e3953f48938580e1bf8ea1ba70105997e59d2) by [@Bardiamist](https://github.com/Bardiamist)) - Don't minify JS bundle by default when using hermes ([1a67dda668](https://github.com/facebook/react-native/commit/1a67dda668c71d961a4bb3b0cdf6aa22c0e5c138) by [@janicduplessis](https://github.com/janicduplessis)) - Migrate warnings in index.js to point to new lean core repos ([4421a64ac1](https://github.com/facebook/react-native/commit/4421a64ac1ea9df3827fb99194c8576a0750beab) by [@Naturalclar](https://github.com/Naturalclar)) From 820104f5901e411b21ee2446ea594886b6c9278f Mon Sep 17 00:00:00 2001 From: shivenmian Date: Tue, 4 Oct 2022 23:32:46 -0700 Subject: [PATCH 3/5] fix: updated codegen src paths --- packages/babel-plugin-codegen/index.js | 6 +++--- packages/eslint-plugin-specs/react-native-modules.js | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/babel-plugin-codegen/index.js b/packages/babel-plugin-codegen/index.js index c148ad79bdf5..bb83feb4070e 100644 --- a/packages/babel-plugin-codegen/index.js +++ b/packages/babel-plugin-codegen/index.js @@ -14,9 +14,9 @@ let flowParser, typeScriptParser, RNCodegen; const {basename} = require('path'); try { - flowParser = require('react-native-codegen/src/parsers/flow'); - typeScriptParser = require('react-native-codegen/src/parsers/typescript'); - RNCodegen = require('react-native-codegen/src/generators/RNCodegen'); + flowParser = require('@react-native/codegen/src/parsers/flow'); + typeScriptParser = require('@react-native/codegen/src/parsers/typescript'); + RNCodegen = require('@react-native/codegen/src/generators/RNCodegen'); } catch (e) { // Fallback to lib when source doesn't exit (e.g. when installed as a dev dependency) flowParser = require('@react-native/codegen/lib/parsers/flow'); diff --git a/packages/eslint-plugin-specs/react-native-modules.js b/packages/eslint-plugin-specs/react-native-modules.js index 8020321d0afa..1656123e1b7b 100644 --- a/packages/eslint-plugin-specs/react-native-modules.js +++ b/packages/eslint-plugin-specs/react-native-modules.js @@ -26,16 +26,16 @@ let RNParserUtils; function requireModuleParser() { if (RNModuleParser == null || RNParserUtils == null) { - // If using this externally, we leverage react-native-codegen as published form + // If using this externally, we leverage @react-native/codegen as published form if (!PACKAGE_USAGE) { const config = { - only: [/react-native-codegen\/src\//], + only: [/@react-native\/codegen\/src\//], plugins: [require('@babel/plugin-transform-flow-strip-types').default], }; withBabelRegister(config, () => { - RNModuleParser = require('react-native-codegen/src/parsers/flow/modules'); - RNParserUtils = require('react-native-codegen/src/parsers/utils'); + RNModuleParser = require('@react-native/codegen/src/parsers/flow/modules'); + RNParserUtils = require('@react-native/codegen/src/parsers/flow/utils'); }); } else { const config = { From 720b05d5e4ecdb94158842d62a9c67337dab4d0a Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Fri, 25 Nov 2022 17:27:52 +0000 Subject: [PATCH 4/5] fix: update codegen location in scripts/react_native_pods_utils/script_phases.sh --- scripts/react_native_pods_utils/script_phases.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/react_native_pods_utils/script_phases.sh b/scripts/react_native_pods_utils/script_phases.sh index 08efd2afbde0..f1f5b809ed8f 100755 --- a/scripts/react_native_pods_utils/script_phases.sh +++ b/scripts/react_native_pods_utils/script_phases.sh @@ -31,9 +31,9 @@ find_node () { } find_codegen () { - CODEGEN_CLI_PATH=$("$NODE_BINARY" --print "require('path').dirname(require.resolve('react-native-codegen/package.json'))") + CODEGEN_CLI_PATH=$("$NODE_BINARY" --print "require('path').dirname(require.resolve('@react-native/codegen/package.json'))") if ! [ -d "$CODEGEN_CLI_PATH" ]; then - error "error: Could not determine react-native-codegen location, using node module resolution. Try running 'yarn install' or 'npm install' in your project root." + error "error: Could not determine @react-native/codegen location, using node module resolution. Try running 'yarn install' or 'npm install' in your project root." fi } From 512523e787d3ceb3a54142aaa978a2ea3bb49e83 Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Sat, 26 Nov 2022 10:44:18 +0000 Subject: [PATCH 5/5] fix: update eslint-plugin-specs paths for react-native/codegen in react-native-modules --- packages/eslint-plugin-specs/react-native-modules.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin-specs/react-native-modules.js b/packages/eslint-plugin-specs/react-native-modules.js index 1656123e1b7b..19584626f95c 100644 --- a/packages/eslint-plugin-specs/react-native-modules.js +++ b/packages/eslint-plugin-specs/react-native-modules.js @@ -29,13 +29,13 @@ function requireModuleParser() { // If using this externally, we leverage @react-native/codegen as published form if (!PACKAGE_USAGE) { const config = { - only: [/@react-native\/codegen\/src\//], + only: [/react-native-codegen\/src\//], plugins: [require('@babel/plugin-transform-flow-strip-types').default], }; withBabelRegister(config, () => { RNModuleParser = require('@react-native/codegen/src/parsers/flow/modules'); - RNParserUtils = require('@react-native/codegen/src/parsers/flow/utils'); + RNParserUtils = require('@react-native/codegen/src/parsers/utils'); }); } else { const config = {