Skip to content

Commit

Permalink
feat: 添加getCliPath()判断platform使用不同的cli
Browse files Browse the repository at this point in the history
  • Loading branch information
sunzhongliang committed Apr 2, 2021
1 parent 52d9808 commit e7a3de9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/lib/react-native-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ export function getReactNativeProjectAppVersion(command: cli.IReleaseReactComman
}
}

// https://github.com/microsoft/appcenter-cli/blob/master/src/commands/codepush/release-react.ts#L201
// https://github.com/microsoft/appcenter-cli/blob/13495af812558bd952d8aeb9dc01b5be089cd1fc/src/commands/codepush/lib/react-native-utils.ts#L277
function getCliPath(): string {
if (process.platform === "win32") {
return path.join("node_modules", "react-native", "local-cli", "cli.js");
}

return path.join("node_modules", ".bin", "react-native");
}

export function runReactNativeBundleCommand(
bundleName: string,
development: boolean,
Expand All @@ -222,7 +232,7 @@ export function runReactNativeBundleCommand(
}

Array.prototype.push.apply(reactNativeBundleArgs, [
path.join("node_modules", "react-native", "local-cli", "cli.js"),
getCliPath(),
"bundle",
"--assets-dest",
outputFolder,
Expand Down

0 comments on commit e7a3de9

Please sign in to comment.