mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Use react-native-codegen@0.0.6 in new app template
Summary: Use pre-built react-native-codegen library from npm in the iOS app template. Built react-native-codegen from source when used with RNTester. Published react-native-codegen@0.0.6. Changelog: [iOS][Added] - Use react-native-codegen in iOS app template [Internal] - Bump react-native-codegen: 0.0.6 Reviewed By: fkgozali Differential Revision: D25128036 fbshipit-source-id: f294c23b9b911aae6f404edc01b62426fb578477
This commit is contained in:
committed by
Mike Grabowski
parent
727d755441
commit
65003d7436
@@ -28,7 +28,6 @@
|
||||
"Libraries",
|
||||
"LICENSE",
|
||||
"local-cli",
|
||||
"packages/react-native-codegen",
|
||||
"React-Core.podspec",
|
||||
"react-native.config.js",
|
||||
"react.gradle",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-codegen",
|
||||
"version": "0.0.5",
|
||||
"version": "0.0.6",
|
||||
"description": "⚛️ Code generation tools for React Native",
|
||||
"homepage": "https://github.com/facebook/react-native/tree/master/packages/react-native-codegen",
|
||||
"repository": {
|
||||
|
||||
@@ -15,7 +15,13 @@ CODEGEN_DIR="$THIS_DIR/../.."
|
||||
|
||||
rm -rf "${CODEGEN_DIR:?}/lib" "${CODEGEN_DIR:?}/node_modules"
|
||||
|
||||
YARN_BINARY="${YARN_BINARY:-$(command -v yarn)}"
|
||||
# Fallback to npm if yarn is not available
|
||||
if [ -x "$(command -v yarn)" ]; then
|
||||
YARN_OR_NPM=$(command -v yarn)
|
||||
else
|
||||
YARN_OR_NPM=$(command -v npm)
|
||||
fi
|
||||
YARN_BINARY="${YARN_BINARY:-$YARN_OR_NPM}"
|
||||
|
||||
if [[ ${FBSOURCE_ENV:-0} -eq 1 ]]; then
|
||||
# Custom FB-specific setup
|
||||
|
||||
@@ -64,7 +64,9 @@ pre_install do |installer|
|
||||
frameworks_pre_install(installer) if ENV['USE_FRAMEWORKS'] == '1'
|
||||
if ENV['USE_CODEGEN'] != '0'
|
||||
prefix_path = "../.."
|
||||
codegen_pre_install(installer, {path:prefix_path})
|
||||
codegen_path = "../../packages/react-native-codegen"
|
||||
system("./#{codegen_path}/scripts/oss/build.sh") or raise "Could not build react-native-codegen package"
|
||||
codegen_pre_install(installer, {path:prefix_path, codegen_path:codegen_path})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -528,6 +528,6 @@ SPEC CHECKSUMS:
|
||||
Yoga: 69ef0b2bba5387523f793957a9f80dbd61e89631
|
||||
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
|
||||
|
||||
PODFILE CHECKSUM: 961e081223f82b7e9208869de4d73534d949ae9e
|
||||
PODFILE CHECKSUM: cd671238f92c51cd349a1c778fd089994174b101
|
||||
|
||||
COCOAPODS: 1.10.0
|
||||
|
||||
@@ -111,14 +111,18 @@ end
|
||||
|
||||
# Pre Install processing for Native Modules
|
||||
def codegen_pre_install(installer, options={})
|
||||
# Path to React Native
|
||||
prefix = options[:path] ||= "../node_modules/react-native"
|
||||
system("./#{prefix}/packages/react-native-codegen/scripts/oss/build.sh")
|
||||
|
||||
# Path to react-native-codegen
|
||||
codegen_path = options[:codegen_path] ||= "#{prefix}/../react-native-codegen"
|
||||
|
||||
# Handle Core Modules
|
||||
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 #{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}")
|
||||
schema_generated = system("node #{codegen_path}/lib/cli/combine/combine-js-to-schema-cli.js #{schema_file} #{srcs_dir}") or raise "Could not generate Native Module schema"
|
||||
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}") or raise "Could not generate code for #{native_module_spec_name}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
"eslint": "^6.5.1",
|
||||
"jest": "^25.1.0",
|
||||
"metro-react-native-babel-preset": "^0.64.0",
|
||||
"react-native-codegen": "^0.0.6",
|
||||
"react-test-renderer": "17.0.1"
|
||||
},
|
||||
"jest": {
|
||||
|
||||
Reference in New Issue
Block a user