Skip to content

Commit 4f3ca8f

Browse files
hramosfacebook-github-bot
authored andcommitted
cleanup publish-npm.js: --include-hermes is not used anywhere (facebook#35166)
Summary: Pull Request resolved: facebook#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
1 parent a671d61 commit 4f3ca8f

File tree

1 file changed

+5
-62
lines changed

1 file changed

+5
-62
lines changed

scripts/publish-npm.js

Lines changed: 5 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ const otp = process.env.NPM_CONFIG_OTP;
5353
const tmpPublishingFolder = fs.mkdtempSync(
5454
path.join(os.tmpdir(), 'rn-publish-'),
5555
);
56-
echo(`The temp publishing folder is ${tmpPublishingFolder}`);
5756

5857
const argv = yargs
5958
.option('n', {
@@ -66,73 +65,17 @@ const argv = yargs
6665
type: 'boolean',
6766
default: false,
6867
})
69-
.option('h', {
70-
alias: 'include-hermes',
71-
type: 'boolean',
72-
default: false,
73-
}).argv;
68+
.strict().argv;
7469
const nightlyBuild = argv.nightly;
7570
const dryRunBuild = argv.dryRun;
76-
const includeHermes = argv.includeHermes;
7771
const isCommitly = nightlyBuild || dryRunBuild;
7872

79-
saveFilesToRestore(tmpPublishingFolder);
80-
81-
if (includeHermes) {
82-
const HERMES_INSTALL_LOCATION = 'sdks';
83-
const HERMES_SOURCE_DEST_PATH = `${HERMES_INSTALL_LOCATION}/hermes`;
84-
85-
let hermesReleaseTag;
86-
let hermesReleaseURI;
87-
if (isCommitly) {
88-
// use latest commit / tarball
89-
hermesReleaseURI = 'https://github.com/facebook/hermes/tarball/main';
90-
} else {
91-
// use one configured in disk
92-
fs.readFile(
93-
`${HERMES_INSTALL_LOCATION}/.hermesversion`,
94-
{
95-
encoding: 'utf8',
96-
flag: 'r',
97-
},
98-
function (err, data) {
99-
if (err) {
100-
echo('Failed to read current Hermes release tag.');
101-
// TODO: We'll need to make sure every release going forward has one of these.
102-
exit(1);
103-
} else {
104-
hermesReleaseTag = data.trim();
105-
hermesReleaseURI = `https://github.com/facebook/hermes/archive/refs/tags/${hermesReleaseTag}.tar.gz`;
106-
}
107-
},
108-
);
109-
}
110-
111-
const tmpDownloadDir = fs.mkdtempSync(
112-
path.join(os.tmpdir(), 'hermes-tarball'),
113-
);
114-
const tmpExtractDir = fs.mkdtempSync(path.join(os.tmpdir(), 'hermes'));
115-
116-
const hermesInstallScript = `
117-
mkdir -p ${HERMES_SOURCE_DEST_PATH} && \
118-
wget ${hermesReleaseURI} -O ${tmpDownloadDir}/hermes.tar.gz && \
119-
tar -xzf ${tmpDownloadDir}/hermes.tar.gz -C ${tmpExtractDir} && \
120-
HERMES_SOURCE_EXTRACT_PATH=$(ls -d ${tmpExtractDir}/*) && \
121-
mv $HERMES_SOURCE_EXTRACT_PATH ${HERMES_SOURCE_DEST_PATH}
122-
`;
123-
124-
if (fs.existsSync(`${HERMES_SOURCE_DEST_PATH}`)) {
125-
if (exec(`rm -rf ./${HERMES_SOURCE_DEST_PATH}`).code) {
126-
echo('Failed to clean up previous Hermes installation.');
127-
exit(1);
128-
}
129-
}
130-
if (exec(hermesInstallScript).code) {
131-
echo('Failed to include Hermes in release.');
132-
exit(1);
133-
}
73+
if (!argv.help) {
74+
echo(`The temp publishing folder is ${tmpPublishingFolder}`);
13475
}
13576

77+
saveFilesToRestore(tmpPublishingFolder);
78+
13679
// 34c034298dc9cad5a4553964a5a324450fda0385
13780
const currentCommit = getCurrentCommit();
13881
const shortCommit = currentCommit.slice(0, 9);

0 commit comments

Comments
 (0)