Skip to content

Commit 6cf8d05

Browse files
committed
1,新增使用新版hermesCommand路径
`node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc` 2,新增从xcodeProjectConfig中读取版本
1 parent bab6a9c commit 6cf8d05

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

src/lib/react-native-utils.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,28 @@ export function getReactNativeProjectAppVersion(
7676
}
7777

7878
if (parsedPlist && parsedPlist.CFBundleShortVersionString) {
79+
if (/MARKETING_VERSION/i.test(parsedPlist.CFBundleShortVersionString)) {
80+
try {
81+
const xcodeProjectConfig =
82+
path.resolve(resolvedPlistFile, "../") +
83+
".xcodeproj/project.pbxproj";
84+
out.text(
85+
'Using xcodeProjectConfig version, file path "'
86+
.concat(xcodeProjectConfig, '".\n')
87+
);
88+
const xcodeContents = fs.readFileSync(xcodeProjectConfig).toString();
89+
const xcodeVersion = [...xcodeContents.matchAll(/Release[\s\S]*MARKETING_VERSION = (\d+\.\d+\.\d+)/gm)][0][1];
90+
out.text(
91+
'Using xcodeProjectConfig version, version "'.concat(
92+
xcodeVersion,
93+
'".\n'
94+
)
95+
);
96+
parsedPlist.CFBundleShortVersionString = xcodeVersion;
97+
} catch (error) {
98+
99+
}
100+
}
79101
if (isValidVersion(parsedPlist.CFBundleShortVersionString)) {
80102
out.text(
81103
`Using the target binary version value "${parsedPlist.CFBundleShortVersionString}" from "${resolvedPlistFile}".\n`,
@@ -538,6 +560,17 @@ function getHermesCommand(): string {
538560
}
539561
};
540562
// assume if hermes-engine exists it should be used instead of hermesvm
563+
const hermesEngineNew = path.join(
564+
'node_modules',
565+
'react-native',
566+
'sdks',
567+
'hermesc',
568+
getHermesOSBin(),
569+
getHermesOSExe()
570+
);
571+
if (fileExists(hermesEngineNew)) {
572+
return hermesEngineNew;
573+
}
541574
const hermesEngine = path.join(
542575
'node_modules',
543576
'hermes-engine',

0 commit comments

Comments
 (0)