diff --git a/.gitignore b/.gitignore index 9aea329a6c35fd..4f47d314cfb085 100644 --- a/.gitignore +++ b/.gitignore @@ -100,7 +100,6 @@ package-lock.json !/packages/rn-tester/Pods/__offline_mirrors__ # react-native-codegen -/React/FBReactNativeSpec/FBReactNativeSpec /packages/react-native-codegen/lib /ReactCommon/react/renderer/components/rncore/ diff --git a/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm b/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h b/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/package.json b/package.json index 25f41b42b82ce5..e3693f8219befe 100644 --- a/package.json +++ b/package.json @@ -105,6 +105,7 @@ "promise": "^8.0.3", "prop-types": "^15.7.2", "react-devtools-core": "^4.6.0", + "react-native-codegen": "^0.0.7", "react-refresh": "^0.4.0", "regenerator-runtime": "^0.13.2", "scheduler": "^0.20.1", @@ -155,4 +156,4 @@ } } } -} \ No newline at end of file +} diff --git a/scripts/generate-specs.sh b/scripts/generate-specs.sh index ab297fd18d7fb2..808830c8bd2008 100755 --- a/scripts/generate-specs.sh +++ b/scripts/generate-specs.sh @@ -53,33 +53,19 @@ main() { TEMP_OUTPUT_DIR="$TEMP_DIR/out" SCHEMA_FILE="$TEMP_DIR/schema.json" - CODEGEN_REPO_PATH="$RN_DIR/packages/react-native-codegen" - CODEGEN_NPM_PATH="$RN_DIR/../react-native-codegen" - -if [ -z "$NODE_BINARY" ]; then + if [ -z "$NODE_BINARY" ]; then echo "Error: Could not find node. Make sure it is in bash PATH or set the NODE_BINARY environment variable." 1>&2 exit 1 fi - if [ -d "$CODEGEN_REPO_PATH" ]; then - CODEGEN_PATH=$(cd "$CODEGEN_REPO_PATH" && pwd) - elif [ -d "$CODEGEN_NPM_PATH" ]; then - CODEGEN_PATH=$(cd "$CODEGEN_NPM_PATH" && pwd) - else - echo "Error: Could not determine react-native-codegen location. Try running 'yarn install' or 'npm install' in your project root." 1>&2 - exit 1 - fi + CODEGEN_PATH=$("$NODE_BINARY" -e "console.log(require('path').dirname(require.resolve('react-native-codegen/package.json')))") + # Special case for running CodeGen from source: build it if [ ! -d "$CODEGEN_PATH/lib" ]; then describe "Building react-native-codegen package" bash "$CODEGEN_PATH/scripts/oss/build.sh" fi - if [ -z "$NODE_BINARY" ]; then - echo "Error: Could not find node. Make sure it is in bash PATH or set the NODE_BINARY environment variable." 1>&2 - exit 1 - fi - describe "Generating schema from flow types" "$NODE_BINARY" "$CODEGEN_PATH/lib/cli/combine/combine-js-to-schema-cli.js" "$SCHEMA_FILE" "$SRCS_DIR" diff --git a/template/package.json b/template/package.json index e4bde1985d64a2..5705a7487966f7 100644 --- a/template/package.json +++ b/template/package.json @@ -21,7 +21,6 @@ "eslint": "7.14.0", "jest": "^26.6.3", "metro-react-native-babel-preset": "^0.64.0", - "react-native-codegen": "^0.0.7", "react-test-renderer": "17.0.1" }, "jest": {