bitrise-api-cli 0.0.9-beta → 0.0.9-beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  app,
4
4
  buildContext
5
- } from "./chunk-5TJLDQ3K.js";
5
+ } from "./chunk-YAG6H26E.js";
6
6
  import "./chunk-CF25N4TY.js";
7
7
 
8
8
  // src/cli/bin/bash-complete.ts
@@ -5,7 +5,7 @@ import {
5
5
  // src/cli/commands/download/command.ts
6
6
  import { buildCommand } from "@stricli/core";
7
7
  var downloadCommand = buildCommand({
8
- loader: async () => import("./impl-YQ6WYRXO.js"),
8
+ loader: async () => import("./impl-WOGNQXCX.js"),
9
9
  parameters: {
10
10
  flags: {
11
11
  artifact: {
@@ -65,7 +65,7 @@ import { buildApplication, buildRouteMap } from "@stricli/core";
65
65
 
66
66
  // package.json
67
67
  var name = "bitrise-api-cli";
68
- var version = "0.0.9-beta";
68
+ var version = "0.0.9-beta2";
69
69
  var description = "bitrise api CLI wrapper";
70
70
 
71
71
  // src/cli/app.ts
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  app,
4
4
  buildContext
5
- } from "./chunk-5TJLDQ3K.js";
5
+ } from "./chunk-YAG6H26E.js";
6
6
  import "./chunk-CF25N4TY.js";
7
7
 
8
8
  // src/cli/bin/cli.ts
@@ -86,22 +86,32 @@ var createTempDir = async (prefix) => {
86
86
 
87
87
  // src/device/install/convertAabToApk.ts
88
88
  import { exec as exec2 } from "teen_process";
89
- var convertAabToApk = async (aabPath) => {
89
+ var convertAabToApk = async (aabPath, flags) => {
90
90
  const startTime = Date.now();
91
91
  try {
92
92
  const tempDir = await createTempDir("bitrise-api-cli");
93
93
  const fileName = path2.basename(aabPath, ".aab");
94
94
  const outPath = path2.join(tempDir, `${fileName}.apks`);
95
95
  const zipPath = path2.join(tempDir, `${fileName}.zip`);
96
+ if (flags.debug)
97
+ console.log(
98
+ "run command:",
99
+ "bundletool",
100
+ ["build-apks", "--connected-device", `--bundle=${fileName}.aab`, `--output=${outPath}`].join(" ")
101
+ );
96
102
  const { code } = await exec2("bundletool", [
97
103
  "build-apks",
98
104
  "--connected-device",
99
105
  `--bundle=${fileName}.aab`,
100
106
  `--output=${outPath}`
101
107
  ]);
108
+ if (flags.debug) console.log("run command:", "bundletool:", code);
102
109
  if (code !== 0) throw new Error(`Failed to convert aab to apk: ${code}`);
110
+ if (flags.debug) console.log(`pre rename: ${JSON.stringify({ outPath, zipPath })}`);
103
111
  await fs2.rename(outPath, zipPath);
112
+ if (flags.debug) console.log("post command:");
104
113
  const { code: code2 } = await exec2("unzip", ["-o", zipPath, "-d", tempDir]);
114
+ if (flags.debug) console.log(`post unzip: ${JSON.stringify({ zipPath, tempDir })}`);
105
115
  if (code2 !== 0) throw new Error(`Failed to unzip ${code2}`);
106
116
  return { apkFolder: path2.join(tempDir, "./splits"), duration: Date.now() - startTime };
107
117
  } catch (e) {
@@ -142,7 +152,7 @@ var getOraTexts = (label) => ({
142
152
  import { oraPromise } from "ora";
143
153
  var installApp = async ({ file, flags }) => {
144
154
  if (flags.artifact === "android-apk" && file.endsWith(".aab")) {
145
- const { apkFolder } = await oraPromise(convertAabToApk(file), getOraTexts("Convert AAB to Split APK"));
155
+ const { apkFolder } = await oraPromise(convertAabToApk(file, flags), getOraTexts("Convert AAB to Split APK"));
146
156
  await oraPromise(installSplitApk(apkFolder), getOraTexts("installing Split APK"));
147
157
  } else if (flags.artifact === "android-apk" && file.endsWith(".apk")) {
148
158
  await oraPromise(installApk(file), getOraTexts("installing APK"));
@@ -1653,9 +1663,10 @@ var downloadLatestArtifacts = async (options) => {
1653
1663
  fetchArtifact({ artifactSlug: artifactMetadata.slug, buildSlug: latestBuild.slug }),
1654
1664
  getOraTexts("fetching artifact metadata")
1655
1665
  );
1666
+ const fileType = artifact.title?.split(".").pop() ?? "unknown";
1656
1667
  const { file } = await oraPromise2(downloadFile(artifact.expiringDownloadUrl, artifactMetadata.title), {
1657
- ...getOraTexts("downloading apk file"),
1658
- text: `downloading apk file [${formatBytes(artifact.fileSizeBytes ?? 0)}]`
1668
+ ...getOraTexts(`downloading ${fileType} file`),
1669
+ text: `downloading ${fileType} file [${formatBytes(artifact.fileSizeBytes ?? 0)}]`
1659
1670
  });
1660
1671
  return file;
1661
1672
  };
@@ -1665,8 +1676,7 @@ async function impl_default(flags) {
1665
1676
  if (!setupEnv(flags)) return process.exit(1);
1666
1677
  const file = await downloadLatestArtifacts(flags);
1667
1678
  if (flags.install) {
1668
- await installApp({ file, flags }).catch(() => {
1669
- });
1679
+ await installApp({ file, flags });
1670
1680
  }
1671
1681
  }
1672
1682
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitrise-api-cli",
3
- "version": "0.0.9-beta",
3
+ "version": "0.0.9-beta2",
4
4
  "description": "bitrise api CLI wrapper",
5
5
  "module": "index",
6
6
  "type": "module",