mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
"Libraries",
|
||||
"LICENSE",
|
||||
"local-cli",
|
||||
"packages/react-native-codegen",
|
||||
"React-Core.podspec",
|
||||
"react-native.config.js",
|
||||
"react.gradle",
|
||||
|
||||
@@ -64,9 +64,7 @@ pre_install do |installer|
|
||||
frameworks_pre_install(installer) if ENV['USE_FRAMEWORKS'] == '1'
|
||||
if ENV['USE_CODEGEN'] != '0'
|
||||
prefix_path = "../.."
|
||||
codegen_path = "../../packages/react-native-codegen"
|
||||
system("(cd #{codegen_path} && yarn install && yarn run build)")
|
||||
codegen_pre_install(installer, {path:prefix_path, codegen_path:codegen_path})
|
||||
codegen_pre_install(installer, {path:prefix_path})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -528,6 +528,6 @@ SPEC CHECKSUMS:
|
||||
Yoga: 69ef0b2bba5387523f793957a9f80dbd61e89631
|
||||
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
|
||||
|
||||
PODFILE CHECKSUM: 497dba59a3312b3cb22d518b96672409db90460d
|
||||
PODFILE CHECKSUM: 961e081223f82b7e9208869de4d73534d949ae9e
|
||||
|
||||
COCOAPODS: 1.10.0
|
||||
|
||||
@@ -25,7 +25,7 @@ RN_DIR=$(cd "$THIS_DIR/.." && pwd)
|
||||
CODEGEN_DIR=$(cd "$RN_DIR/packages/react-native-codegen" && pwd)
|
||||
OUTPUT_DIR="${1:-$RN_DIR/Libraries/FBReactNativeSpec/FBReactNativeSpec}"
|
||||
SCHEMA_FILE="$RN_DIR/schema-native-modules.json"
|
||||
YARN_BINARY="${YARN_BINARY:-yarn}"
|
||||
YARN_BINARY="${YARN_BINARY:-$(command -v yarn)}"
|
||||
|
||||
describe () {
|
||||
printf "\\n\\n>>>>> %s\\n\\n\\n" "$1"
|
||||
|
||||
@@ -112,13 +112,13 @@ end
|
||||
# Pre Install processing for Native Modules
|
||||
def codegen_pre_install(installer, options={})
|
||||
prefix = options[:path] ||= "../node_modules/react-native"
|
||||
codegen_path = options[:codegen_path] ||= "../node_modules/react-native-codegen"
|
||||
system("./#{prefix}/packages/react-native-codegen/scripts/oss/build.sh")
|
||||
|
||||
Dir.mktmpdir do |dir|
|
||||
native_module_spec_name = "FBReactNativeSpec"
|
||||
schema_file = dir + "/schema-#{native_module_spec_name}.json"
|
||||
srcs_dir = "#{prefix}/Libraries"
|
||||
schema_generated = system("node #{codegen_path}/lib/cli/combine/combine-js-to-schema-cli.js #{schema_file} #{srcs_dir}")
|
||||
schema_generated = system("node #{prefix}/packages/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js #{schema_file} #{srcs_dir}")
|
||||
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}")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
"eslint": "^6.5.1",
|
||||
"jest": "^25.1.0",
|
||||
"metro-react-native-babel-preset": "^0.64.0",
|
||||
"react-test-renderer": "17.0.1",
|
||||
"react-native-codegen": "0.0.4"
|
||||
"react-test-renderer": "17.0.1"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "react-native"
|
||||
|
||||
Reference in New Issue
Block a user