Skip to content

Commit e7a3de9

Browse files
author
sunzhongliang
committed
feat: 添加getCliPath()判断platform使用不同的cli
1 parent 52d9808 commit e7a3de9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/lib/react-native-utils.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,16 @@ export function getReactNativeProjectAppVersion(command: cli.IReleaseReactComman
205205
}
206206
}
207207

208+
// https://github.com/microsoft/appcenter-cli/blob/master/src/commands/codepush/release-react.ts#L201
209+
// https://github.com/microsoft/appcenter-cli/blob/13495af812558bd952d8aeb9dc01b5be089cd1fc/src/commands/codepush/lib/react-native-utils.ts#L277
210+
function getCliPath(): string {
211+
if (process.platform === "win32") {
212+
return path.join("node_modules", "react-native", "local-cli", "cli.js");
213+
}
214+
215+
return path.join("node_modules", ".bin", "react-native");
216+
}
217+
208218
export function runReactNativeBundleCommand(
209219
bundleName: string,
210220
development: boolean,
@@ -222,7 +232,7 @@ export function runReactNativeBundleCommand(
222232
}
223233

224234
Array.prototype.push.apply(reactNativeBundleArgs, [
225-
path.join("node_modules", "react-native", "local-cli", "cli.js"),
235+
getCliPath(),
226236
"bundle",
227237
"--assets-dest",
228238
outputFolder,

0 commit comments

Comments
 (0)