Rename try-set-nightly-hermes-compiler.js (#56758)

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

Rename scripts/try-set-nightly-hermes-compiler.js to
scripts/try-set-hermes-compiler-prebuilt.js. The script sets the hermes-compiler
version to the latest prebuilt (latest-v1 on npm), not a nightly build.
Update the preinstall script reference in the root package.json.

## Changelog:
[Internal] -

Reviewed By: cortinico

Differential Revision: D104649635

fbshipit-source-id: 8375d0518ea8c9ca99a59fd65366210eeea91e50
This commit is contained in:
Riccardo Cipolleschi authored and meta-codesync[bot] committed 2026-05-11 12:55:12 -07:00
1 parent f37513595f
commit ac48b56a1a
2 files changed
+27 -1

No files matched your search

+1 -1
View File
@@ -23,7 +23,7 @@
"lint-kotlin": "./gradlew ktfmtFormat",
"lint-markdown": "markdownlint-cli2 2>&1",
"lint": "eslint --max-warnings 0 .",
"preinstall": "node ./scripts/try-set-nightly-hermes-compiler.js",
"preinstall": "node ./scripts/try-set-hermes-compiler-prebuilt.js",
"prettier": "prettier --write \"./**/*.{js,md,yml,ts,tsx}\"",
"shellcheck": "./.github/workflow-scripts/analyze_scripts.sh",
"start": "yarn --cwd packages/rn-tester start",
@@ -0,0 +1,26 @@
/**
* 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.
*/
// @flow
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');
function main() {
const packageJsonPath = path.join(__dirname, '../packages/react-native/package.json');
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
const hermesCompilerVersion = packageJson.dependencies['hermes-compiler'];
if (hermesCompilerVersion === '0.0.0') {
console.log(`Hermes compiler version not set. Updating to the latest-v1 release.`);
execSync('yarn workspace react-native add hermes-compiler@latest-v1 --exact', { stdio: 'inherit' });
} else {
console.log(`Hermes compiler version set to ${hermesCompilerVersion}. Not setting hermes.`);
}
}
main();