Skip to content

Commit 33bac5f

Browse files
authored
Merge pull request #21 from sunzhongliangde/master
feat: 添加getCliPath()判断platform使用不同的cli
2 parents 52d9808 + e7a3de9 commit 33bac5f

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/lib/react-native-utils.ts

Lines changed: 11 additions & 1 deletion
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)