mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
cleanup publish-npm.js: --include-hermes is not used anywhere (#35166)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/35166 The Hermes source code is not included in the RN npm package. This piece of code is a remnant from an early experimentation into integrating Hermes more tightly with React Native. We ended up using a combination of the scripts in `scripts/hermes` to fetch the source code from GitHub and relying on prebuilts for stable releases. Added `strict()` flag to ensure the script fails immediately if an unrecognized flag is passed. Avoid logging temp publishing folder value to console when `--help` is used. Changelog: [internal] Reviewed By: cortinico Differential Revision: D40918939 fbshipit-source-id: 2e62ab16467c4c67f03efdf5211a156cb70e0b11
This commit is contained in:
1 parent
a671d61b6d
commit
4f3ca8facf
1 file changed
+5
-62
+5
-62
@@ -53,7 +53,6 @@ const otp = process.env.NPM_CONFIG_OTP;
|
||||
const tmpPublishingFolder = fs.mkdtempSync(
|
||||
path.join(os.tmpdir(), 'rn-publish-'),
|
||||
);
|
||||
echo(`The temp publishing folder is ${tmpPublishingFolder}`);
|
||||
|
||||
const argv = yargs
|
||||
.option('n', {
|
||||
@@ -66,73 +65,17 @@ const argv = yargs
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
})
|
||||
.option('h', {
|
||||
alias: 'include-hermes',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
}).argv;
|
||||
.strict().argv;
|
||||
const nightlyBuild = argv.nightly;
|
||||
const dryRunBuild = argv.dryRun;
|
||||
const includeHermes = argv.includeHermes;
|
||||
const isCommitly = nightlyBuild || dryRunBuild;
|
||||
|
||||
saveFilesToRestore(tmpPublishingFolder);
|
||||
|
||||
if (includeHermes) {
|
||||
const HERMES_INSTALL_LOCATION = 'sdks';
|
||||
const HERMES_SOURCE_DEST_PATH = `${HERMES_INSTALL_LOCATION}/hermes`;
|
||||
|
||||
let hermesReleaseTag;
|
||||
let hermesReleaseURI;
|
||||
if (isCommitly) {
|
||||
// use latest commit / tarball
|
||||
hermesReleaseURI = 'https://github.com/facebook/hermes/tarball/main';
|
||||
} else {
|
||||
// use one configured in disk
|
||||
fs.readFile(
|
||||
`${HERMES_INSTALL_LOCATION}/.hermesversion`,
|
||||
{
|
||||
encoding: 'utf8',
|
||||
flag: 'r',
|
||||
},
|
||||
function (err, data) {
|
||||
if (err) {
|
||||
echo('Failed to read current Hermes release tag.');
|
||||
// TODO: We'll need to make sure every release going forward has one of these.
|
||||
exit(1);
|
||||
} else {
|
||||
hermesReleaseTag = data.trim();
|
||||
hermesReleaseURI = `https://github.com/facebook/hermes/archive/refs/tags/${hermesReleaseTag}.tar.gz`;
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
const tmpDownloadDir = fs.mkdtempSync(
|
||||
path.join(os.tmpdir(), 'hermes-tarball'),
|
||||
);
|
||||
const tmpExtractDir = fs.mkdtempSync(path.join(os.tmpdir(), 'hermes'));
|
||||
|
||||
const hermesInstallScript = `
|
||||
mkdir -p ${HERMES_SOURCE_DEST_PATH} && \
|
||||
wget ${hermesReleaseURI} -O ${tmpDownloadDir}/hermes.tar.gz && \
|
||||
tar -xzf ${tmpDownloadDir}/hermes.tar.gz -C ${tmpExtractDir} && \
|
||||
HERMES_SOURCE_EXTRACT_PATH=$(ls -d ${tmpExtractDir}/*) && \
|
||||
mv $HERMES_SOURCE_EXTRACT_PATH ${HERMES_SOURCE_DEST_PATH}
|
||||
`;
|
||||
|
||||
if (fs.existsSync(`${HERMES_SOURCE_DEST_PATH}`)) {
|
||||
if (exec(`rm -rf ./${HERMES_SOURCE_DEST_PATH}`).code) {
|
||||
echo('Failed to clean up previous Hermes installation.');
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if (exec(hermesInstallScript).code) {
|
||||
echo('Failed to include Hermes in release.');
|
||||
exit(1);
|
||||
}
|
||||
if (!argv.help) {
|
||||
echo(`The temp publishing folder is ${tmpPublishingFolder}`);
|
||||
}
|
||||
|
||||
saveFilesToRestore(tmpPublishingFolder);
|
||||
|
||||
// 34c034298dc9cad5a4553964a5a324450fda0385
|
||||
const currentCommit = getCurrentCommit();
|
||||
const shortCommit = currentCommit.slice(0, 9);
|
||||
|
||||
Reference in new issue
Block a user