Skip to content

Commit 68110d4

Browse files
fkgozalialloy
authored andcommitted
Use codegen from source in default iOS template apps
Summary: Add the `react-native-codegen` source to the `react-native` npm package. Instead of using `react-native-codegen` from npm, the iOS app template will now build the package from source. Doing so removes the need to carefully time `react-native-codegen` npm releases to oss `react-native` releases, as the codegen and the oss release will be cut at the same time. Changelog: [Internal] - Removed react-native-codegen dependency from iOS app template Reviewed By: TheSavior Differential Revision: D24904655 fbshipit-source-id: a07932bc748e2afb9359de584181bcb9dd0810ea
1 parent 0f5fb5e commit 68110d4

File tree

6 files changed

+7
-9
lines changed

6 files changed

+7
-9
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"Libraries",
2828
"LICENSE",
2929
"local-cli",
30+
"packages/react-native-codegen",
3031
"React-Core.podspec",
3132
"react-native.config.js",
3233
"react.gradle",

packages/rn-tester/Podfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ pre_install do |installer|
6464
frameworks_pre_install(installer) if ENV['USE_FRAMEWORKS'] == '1'
6565
if ENV['USE_CODEGEN'] != '0'
6666
prefix_path = "../.."
67-
codegen_path = "../../packages/react-native-codegen"
68-
system("(cd #{codegen_path} && yarn install && yarn run build)")
69-
codegen_pre_install(installer, {path:prefix_path, codegen_path:codegen_path})
67+
codegen_pre_install(installer, {path:prefix_path})
7068
end
7169
end
7270

packages/rn-tester/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,6 @@ SPEC CHECKSUMS:
528528
Yoga: 69ef0b2bba5387523f793957a9f80dbd61e89631
529529
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
530530

531-
PODFILE CHECKSUM: 497dba59a3312b3cb22d518b96672409db90460d
531+
PODFILE CHECKSUM: 961e081223f82b7e9208869de4d73534d949ae9e
532532

533533
COCOAPODS: 1.10.0

scripts/generate-native-modules-specs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ RN_DIR=$(cd "$THIS_DIR/.." && pwd)
2525
CODEGEN_DIR=$(cd "$RN_DIR/packages/react-native-codegen" && pwd)
2626
OUTPUT_DIR="${1:-$RN_DIR/Libraries/FBReactNativeSpec/FBReactNativeSpec}"
2727
SCHEMA_FILE="$RN_DIR/schema-native-modules.json"
28-
YARN_BINARY="${YARN_BINARY:-yarn}"
28+
YARN_BINARY="${YARN_BINARY:-$(command -v yarn)}"
2929

3030
describe () {
3131
printf "\\n\\n>>>>> %s\\n\\n\\n" "$1"

scripts/react_native_pods.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ def flipper_post_install(installer)
112112
# Pre Install processing for Native Modules
113113
def codegen_pre_install(installer, options={})
114114
prefix = options[:path] ||= "../node_modules/react-native"
115-
codegen_path = options[:codegen_path] ||= "../node_modules/react-native-codegen"
115+
system("./#{prefix}/packages/react-native-codegen/scripts/oss/build.sh")
116116

117117
Dir.mktmpdir do |dir|
118118
native_module_spec_name = "FBReactNativeSpec"
119119
schema_file = dir + "/schema-#{native_module_spec_name}.json"
120120
srcs_dir = "#{prefix}/Libraries"
121-
schema_generated = system("node #{codegen_path}/lib/cli/combine/combine-js-to-schema-cli.js #{schema_file} #{srcs_dir}")
121+
schema_generated = system("node #{prefix}/packages/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js #{schema_file} #{srcs_dir}")
122122
specs_generated = system("node #{prefix}/scripts/generate-native-modules-specs-cli.js ios #{schema_file} #{srcs_dir}/#{native_module_spec_name}/#{native_module_spec_name}")
123123
end
124124
end

template/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
"eslint": "^6.5.1",
2222
"jest": "^25.1.0",
2323
"metro-react-native-babel-preset": "^0.64.0",
24-
"react-test-renderer": "17.0.1",
25-
"react-native-codegen": "0.0.4"
24+
"react-test-renderer": "17.0.1"
2625
},
2726
"jest": {
2827
"preset": "react-native"

0 commit comments

Comments
 (0)