Skip to content

Commit 47c0962

Browse files
committed
fix: compatible with [email protected], check hermesc for hermes executable
1 parent 722f722 commit 47c0962

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

src/script/command-executor.ts

+38-7
Original file line numberDiff line numberDiff line change
@@ -1868,12 +1868,21 @@ export var releaseReact = (
18681868
: getReactNativeProjectAppVersion(command, projectName);
18691869

18701870
if (command.sourcemapOutputDir && command.sourcemapOutput) {
1871-
log('\n"sourcemap-output-dir" argument will be ignored as "sourcemap-output" argument is provided.\n');
1871+
log(
1872+
'\n"sourcemap-output-dir" argument will be ignored as "sourcemap-output" argument is provided.\n'
1873+
);
18721874
}
18731875

1874-
if ((command.outputDir || command.sourcemapOutputDir) && !command.sourcemapOutput) {
1875-
const sourcemapDir = command.sourcemapOutputDir || releaseCommand.package;
1876-
command.sourcemapOutput = path.join(sourcemapDir, bundleName + ".map");
1876+
if (
1877+
(command.outputDir || command.sourcemapOutputDir) &&
1878+
!command.sourcemapOutput
1879+
) {
1880+
const sourcemapDir =
1881+
command.sourcemapOutputDir || releaseCommand.package;
1882+
command.sourcemapOutput = path.join(
1883+
sourcemapDir,
1884+
bundleName + ".map"
1885+
);
18771886
}
18781887

18791888
return appVersionPromise;
@@ -2198,6 +2207,15 @@ function getHermesOSExe(): string {
21982207
}
21992208
}
22002209

2210+
function getHermescOSExe(): string {
2211+
switch (process.platform) {
2212+
case "win32":
2213+
return "hermesc.exe";
2214+
default:
2215+
return "hermesc";
2216+
}
2217+
}
2218+
22012219
function getHermesCommand(): string {
22022220
const fileExists = (file: string): boolean => {
22032221
try {
@@ -2207,15 +2225,28 @@ function getHermesCommand(): string {
22072225
}
22082226
};
22092227
// assume if hermes-engine exists it should be used instead of hermesvm
2210-
const hermesEngine = path.join(
2228+
// check hermes-engine/hermesc [email protected]+
2229+
const hermesEngineHermesc = path.join(
2230+
"node_modules",
2231+
"hermes-engine",
2232+
getHermesOSBin(),
2233+
getHermescOSExe()
2234+
);
2235+
if (fileExists(hermesEngineHermesc)) {
2236+
return hermesEngineHermesc;
2237+
}
2238+
// checke hermes-engine/hermes
2239+
const hermesEngineHermes = path.join(
22112240
"node_modules",
22122241
"hermes-engine",
22132242
getHermesOSBin(),
22142243
getHermesOSExe()
22152244
);
2216-
if (fileExists(hermesEngine)) {
2217-
return hermesEngine;
2245+
if (fileExists(hermesEngineHermes)) {
2246+
return hermesEngineHermes;
22182247
}
2248+
2249+
// fallback to hermesvm
22192250
return path.join("node_modules", "hermesvm", getHermesOSBin(), "hermes");
22202251
}
22212252

0 commit comments

Comments
 (0)