From 3e084bc15994cf5b549d1104e906e5dbb2df4417 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen <4123478+tido64@users.noreply.github.com> Date: Tue, 13 Aug 2024 06:31:42 -0700 Subject: [PATCH] fix(react-native-codegen): scripts require `yargs` (#45994) Summary: Android fails to build in a pnpm monorepo setup because `yargs` cannot be found: ``` % yarn android info Installing the app... > Configure project :app WARNING: The option setting 'android.jetifier.ignorelist=hermes-android' is experimental. Signing config for 'release' build type not found; reusing debug config > Task :react-native-webapis_web-storage:generateCodegenSchemaFromJavaScript FAILED 28 actionable tasks: 6 executed, 22 up-to-date node:internal/modules/cjs/loader:1148 throw err; ^ Error: Cannot find module 'yargs' Require stack: - /~/node_modules/.store/react-native-codegen-virtual-39ff8dcc54/package/lib/cli/combine/combine-js-to-schema-cli.js at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15) at Module._load (node:internal/modules/cjs/loader:986:27) at Module.require (node:internal/modules/cjs/loader:1233:19) at require (node:internal/modules/helpers:179:18) ``` ## Changelog: [GENERAL] [FIXED] - Fix codegen failing in a pnpm monorepo because of missing `yargs` Pull Request resolved: https://github.com/facebook/react-native/pull/45994 Test Plan: Tested in https://github.com/microsoft/rnx-kit/pull/3290 Reviewed By: dmytrorykun Differential Revision: D61201420 Pulled By: cortinico fbshipit-source-id: aac3704ae7f200db827b14c8362f83a5e66ad08e --- packages/react-native-codegen/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react-native-codegen/package.json b/packages/react-native-codegen/package.json index a8dfbeba3cdd89..3c2bc667128bb4 100644 --- a/packages/react-native-codegen/package.json +++ b/packages/react-native-codegen/package.json @@ -35,7 +35,8 @@ "invariant": "^2.2.4", "jscodeshift": "^0.14.0", "mkdirp": "^0.5.1", - "nullthrows": "^1.1.1" + "nullthrows": "^1.1.1", + "yargs": "^17.6.2" }, "devDependencies": { "@babel/core": "^7.20.0", @@ -52,8 +53,7 @@ "hermes-estree": "0.23.1", "micromatch": "^4.0.4", "prettier": "2.8.8", - "rimraf": "^3.0.2", - "yargs": "^17.6.2" + "rimraf": "^3.0.2" }, "peerDependencies": { "@babel/preset-env": "^7.1.6"