Switch module codegen to use yarn_workspace_binary. (#34015)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34015

I noticed this was a very slow part of my build because each instance of the binary would run its own yarn install. Instead use the yarn_workspace approach to share a single yarn setup.
Changelog: [Internal]

Reviewed By: IanChilds

Differential Revision: D37178005

fbshipit-source-id: cba51e168c5a2f2ee6468acb8c144db4ad352d95
This commit is contained in:
Dustin Shahidehpour authored and Facebook GitHub Bot committed 2022-06-15 13:12:14 -07:00
1 parent d1321d88bd
commit dbe6fab063
2 files changed
+5 -29

No files matched your search

+5 -10
View File
@@ -43,17 +43,12 @@ def rn_codegen_cli():
],
visibility = ["PUBLIC"],
)
fb_native.sh_binary(
yarn_workspace_binary(
name = "generate_all_from_schema",
main = "src/cli/generators/generate-all.sh",
resources = native.glob(
[
"buck_tests/**/*.js",
"src/**/*.js",
],
) + [
"package.json",
"//xplat/js:setup_env",
main = "src/cli/generators/generate-all.js",
root = "//xplat/js:workspace",
deps = [
":yarn-workspace",
],
visibility = ["PUBLIC"],
)
@@ -1,19 +0,0 @@
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
set -e
set -u
THIS_DIR=$(cd -P "$(dirname "$(realpath "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
# shellcheck source=xplat/js/env-utils/setup_env_vars.sh
source "$THIS_DIR/../../../../../../env-utils/setup_env_vars.sh"
pushd "$JS_DIR" >/dev/null
"$INSTALL_NODE_MODULES"
popd >/dev/null
exec "$FLOW_NODE_BINARY" "$THIS_DIR/generate-all.js" "$@"