Skip to content

Commit 8ae3f0c

Browse files
Riccardo Cipolleschimeta-codesync[bot]
authored andcommitted
Rename try-set-nightly-hermes-compiler.js
Summary: 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. Differential Revision: D104649635
1 parent c267df6 commit 8ae3f0c

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"lint-kotlin": "./gradlew ktfmtFormat",
2424
"lint-markdown": "markdownlint-cli2 2>&1",
2525
"lint": "eslint --max-warnings 0 .",
26-
"preinstall": "node ./scripts/try-set-nightly-hermes-compiler.js",
26+
"preinstall": "node ./scripts/try-set-hermes-compiler-prebuilt.js",
2727
"prettier": "prettier --write \"./**/*.{js,md,yml,ts,tsx}\"",
2828
"shellcheck": "./.github/workflow-scripts/analyze_scripts.sh",
2929
"start": "yarn --cwd packages/rn-tester start",
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
// @flow
9+
const { execSync } = require('child_process');
10+
const fs = require('fs');
11+
const path = require('path');
12+
13+
function main() {
14+
const packageJsonPath = path.join(__dirname, '../packages/react-native/package.json');
15+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
16+
const hermesCompilerVersion = packageJson.dependencies['hermes-compiler'];
17+
18+
if (hermesCompilerVersion === '0.0.0') {
19+
console.log(`Hermes compiler version not set. Updating to the latest-v1 release.`);
20+
execSync('yarn workspace react-native add hermes-compiler@latest-v1 --exact', { stdio: 'inherit' });
21+
} else {
22+
console.log(`Hermes compiler version set to ${hermesCompilerVersion}. Not setting hermes.`);
23+
}
24+
}
25+
26+
main();

0 commit comments

Comments
 (0)