Fix displayed name when codegen dependency is not found (#36013)

Summary:
The fixed error guides users toward the right missing dependency. The original error pointed to the old name.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[INTERNAL] [FIXED] - Display correct codegen dependency name when not found

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[INTERNAL] [FIXED] - Display correct codegen dependency name when not found

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

Test Plan: This is an error message wording change.

Reviewed By: jacdebug

Differential Revision: D42881807

Pulled By: cipolleschi

fbshipit-source-id: d96fb867cfe27ae922d398ab981f5797cb51a269
This commit is contained in:
Krystof Woldrich
2023-01-31 02:54:19 -08:00
committed by Facebook GitHub Bot
parent 83743e1edf
commit 86852f8cb5
@@ -22,9 +22,9 @@ const os = require('os');
const path = require('path');
const RN_ROOT = path.join(__dirname, '../..');
const CODEGEN_DEPENDENCY_NAME = '@react-native/codegen';
const CODEGEN_REPO_PATH = `${RN_ROOT}/packages/react-native-codegen`;
const CODEGEN_NPM_PATH = `${RN_ROOT}/../@react-native/codegen`;
const CODEGEN_NPM_PATH = `${RN_ROOT}/../${CODEGEN_DEPENDENCY_NAME}`;
const CORE_LIBRARIES = new Set(['rncore', 'FBReactNativeSpec']);
const REACT_NATIVE_DEPENDENCY_NAME = 'react-native';
@@ -293,7 +293,7 @@ function getCodeGenCliPath() {
} else if (fs.existsSync(CODEGEN_NPM_PATH)) {
codegenCliPath = CODEGEN_NPM_PATH;
} else {
throw "error: Could not determine react-native-codegen location. Try running 'yarn install' or 'npm install' in your project root.";
throw `error: Could not determine ${CODEGEN_DEPENDENCY_NAME} location. Try running 'yarn install' or 'npm install' in your project root.`;
}
return codegenCliPath;
}