Files
react-native/scripts/try-set-hermes-compiler-prebuilt.js
T
Riccardo Cipolleschi ac48b56a1a 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
2026-05-11 12:55:12 -07:00

27 lines
916 B
JavaScript

/**
* 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();