bitrise-api-cli 0.0.9-beta2 → 0.0.10
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.
- package/dist/cli.js +102 -4
- package/dist/{impl-WOGNQXCX.js → impl-KCO2VZ2R.js} +110 -98
- package/package.json +7 -8
- package/dist/bash-complete.js +0 -21
- package/dist/chunk-YAG6H26E.js +0 -97
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,108 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./chunk-YAG6H26E.js";
|
|
6
|
-
import "./chunk-CF25N4TY.js";
|
|
3
|
+
validArtifactTypes
|
|
4
|
+
} from "./chunk-CF25N4TY.js";
|
|
7
5
|
|
|
8
6
|
// src/cli/bin/cli.ts
|
|
9
7
|
import { run } from "@stricli/core";
|
|
8
|
+
|
|
9
|
+
// src/cli/commands/download/command.ts
|
|
10
|
+
import { buildCommand } from "@stricli/core";
|
|
11
|
+
var downloadCommand = buildCommand({
|
|
12
|
+
loader: async () => import("./impl-KCO2VZ2R.js"),
|
|
13
|
+
parameters: {
|
|
14
|
+
flags: {
|
|
15
|
+
artifact: {
|
|
16
|
+
kind: "enum",
|
|
17
|
+
brief: 'bitrise artifact type "ios-ipa" or "android-apk"',
|
|
18
|
+
default: "android-apk",
|
|
19
|
+
values: validArtifactTypes
|
|
20
|
+
},
|
|
21
|
+
debug: {
|
|
22
|
+
kind: "boolean",
|
|
23
|
+
brief: "Number of times to say hello",
|
|
24
|
+
default: false
|
|
25
|
+
},
|
|
26
|
+
slug: {
|
|
27
|
+
kind: "parsed",
|
|
28
|
+
brief: "bitrise app slug (or $BITRISE_APP_SLUG) see bitrise project url to get slug",
|
|
29
|
+
default: process.env["BITRISE_APP_SLUG"],
|
|
30
|
+
parse: String,
|
|
31
|
+
placeholder: "APP_SLUG"
|
|
32
|
+
},
|
|
33
|
+
token: {
|
|
34
|
+
kind: "parsed",
|
|
35
|
+
brief: "bitrise api token (or $BITRISE_API_CLI_TOKEN)",
|
|
36
|
+
default: process.env["BITRISE_API_CLI_TOKEN"],
|
|
37
|
+
parse: String,
|
|
38
|
+
placeholder: "API_TOKEN"
|
|
39
|
+
},
|
|
40
|
+
workflow: {
|
|
41
|
+
kind: "parsed",
|
|
42
|
+
brief: "workflow to get apk from (or $BITRISE_API_CLI_WORKFLOW)",
|
|
43
|
+
default: process.env["BITRISE_API_CLI_WORKFLOW"],
|
|
44
|
+
parse: String,
|
|
45
|
+
placeholder: "WORKFLOW_NAME"
|
|
46
|
+
},
|
|
47
|
+
install: {
|
|
48
|
+
kind: "boolean",
|
|
49
|
+
brief: "Install the downloaded apk/aab artifact [android only]",
|
|
50
|
+
default: false
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
aliases: {
|
|
54
|
+
a: "artifact",
|
|
55
|
+
d: "debug",
|
|
56
|
+
s: "slug",
|
|
57
|
+
t: "token",
|
|
58
|
+
w: "workflow",
|
|
59
|
+
i: "install"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
docs: {
|
|
63
|
+
brief: "Download bitrise artifacts. Most parameters can be set via environment variables."
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// src/cli/app.ts
|
|
68
|
+
import { buildApplication, buildRouteMap } from "@stricli/core";
|
|
69
|
+
|
|
70
|
+
// package.json
|
|
71
|
+
var name = "bitrise-api-cli";
|
|
72
|
+
var version = "0.0.10";
|
|
73
|
+
var description = "bitrise api CLI wrapper";
|
|
74
|
+
|
|
75
|
+
// src/cli/app.ts
|
|
76
|
+
var root = buildRouteMap({
|
|
77
|
+
routes: {
|
|
78
|
+
download: downloadCommand
|
|
79
|
+
},
|
|
80
|
+
docs: {
|
|
81
|
+
brief: description
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
var app = buildApplication(root, {
|
|
85
|
+
name,
|
|
86
|
+
versionInfo: {
|
|
87
|
+
currentVersion: version,
|
|
88
|
+
getLatestVersion: async () => {
|
|
89
|
+
const response = await fetch(`https://registry.npmjs.org/${name}/latest`);
|
|
90
|
+
if (!response.ok) return void 0;
|
|
91
|
+
const data = await response.json();
|
|
92
|
+
if (!data || typeof data !== "object" || !("version" in data) || typeof data.version !== "string")
|
|
93
|
+
return void 0;
|
|
94
|
+
return data.version;
|
|
95
|
+
},
|
|
96
|
+
upgradeCommand: `npx ${name}@latest`
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// src/cli/context.ts
|
|
101
|
+
function buildContext(process2) {
|
|
102
|
+
return {
|
|
103
|
+
process: process2
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// src/cli/bin/cli.ts
|
|
10
108
|
await run(app, process.argv.slice(2), buildContext(process));
|
|
@@ -43,83 +43,25 @@ var setupEnv = (flags) => {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
// src/device/install/android.ts
|
|
46
|
-
import {
|
|
46
|
+
import { $ } from "zx";
|
|
47
47
|
var adbPath = `${process.env.ANDROID_HOME}/platform-tools/adb`;
|
|
48
48
|
var installApk = async (apkPath) => {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
const { stdout, stderr, code } = await exec(adbPath, ["install", "-r", "-d", apkPath]);
|
|
52
|
-
if (code !== 0) throw new Error(`Failed to install apk error code: ${code}`);
|
|
53
|
-
return { duration: Date.now() - startTime };
|
|
54
|
-
} catch (e) {
|
|
55
|
-
if (e instanceof Error && "stderr" in e) throw new Error(`${e.stderr}`);
|
|
56
|
-
throw new Error("unknown Error");
|
|
57
|
-
}
|
|
49
|
+
const { duration } = await $`${adbPath} install -r -d ${apkPath}`;
|
|
50
|
+
return { duration };
|
|
58
51
|
};
|
|
59
52
|
var installSplitApk = async (apkFolder) => {
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
const { stdout, stderr, code } = await exec(adbPath, ["install-multiple", "-r", "-d", `${apkFolder}/*`], {
|
|
63
|
-
shell: true
|
|
64
|
-
});
|
|
65
|
-
if (code !== 0) throw new Error(`Failed to install split apk error code: ${code}`);
|
|
66
|
-
return { duration: Date.now() - startTime };
|
|
67
|
-
} catch (e) {
|
|
68
|
-
if (e instanceof Error && "stderr" in e) throw new Error(`${e.stderr}`);
|
|
69
|
-
throw new Error("unknown Error");
|
|
70
|
-
}
|
|
53
|
+
const { duration } = await $`${adbPath} install-multiple -r -d ${apkFolder}/*`;
|
|
54
|
+
return { duration };
|
|
71
55
|
};
|
|
72
56
|
|
|
73
57
|
// src/device/install/convertAabToApk.ts
|
|
58
|
+
import fs3 from "node:fs/promises";
|
|
59
|
+
import path3 from "node:path";
|
|
60
|
+
|
|
61
|
+
// src/device/install/bundletool.ts
|
|
74
62
|
import fs2 from "node:fs/promises";
|
|
75
63
|
import path2 from "node:path";
|
|
76
64
|
|
|
77
|
-
// src/helper/tempDir.ts
|
|
78
|
-
import fs from "node:fs/promises";
|
|
79
|
-
import { tmpdir } from "node:os";
|
|
80
|
-
import path from "node:path";
|
|
81
|
-
var createTempDir = async (prefix) => {
|
|
82
|
-
const tmpDir = path.join(tmpdir(), `${prefix}-${Date.now()}`);
|
|
83
|
-
await fs.mkdir(tmpDir, { recursive: true });
|
|
84
|
-
return tmpDir;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
// src/device/install/convertAabToApk.ts
|
|
88
|
-
import { exec as exec2 } from "teen_process";
|
|
89
|
-
var convertAabToApk = async (aabPath, flags) => {
|
|
90
|
-
const startTime = Date.now();
|
|
91
|
-
try {
|
|
92
|
-
const tempDir = await createTempDir("bitrise-api-cli");
|
|
93
|
-
const fileName = path2.basename(aabPath, ".aab");
|
|
94
|
-
const outPath = path2.join(tempDir, `${fileName}.apks`);
|
|
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
|
-
);
|
|
102
|
-
const { code } = await exec2("bundletool", [
|
|
103
|
-
"build-apks",
|
|
104
|
-
"--connected-device",
|
|
105
|
-
`--bundle=${fileName}.aab`,
|
|
106
|
-
`--output=${outPath}`
|
|
107
|
-
]);
|
|
108
|
-
if (flags.debug) console.log("run command:", "bundletool:", code);
|
|
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 })}`);
|
|
111
|
-
await fs2.rename(outPath, zipPath);
|
|
112
|
-
if (flags.debug) console.log("post command:");
|
|
113
|
-
const { code: code2 } = await exec2("unzip", ["-o", zipPath, "-d", tempDir]);
|
|
114
|
-
if (flags.debug) console.log(`post unzip: ${JSON.stringify({ zipPath, tempDir })}`);
|
|
115
|
-
if (code2 !== 0) throw new Error(`Failed to unzip ${code2}`);
|
|
116
|
-
return { apkFolder: path2.join(tempDir, "./splits"), duration: Date.now() - startTime };
|
|
117
|
-
} catch (e) {
|
|
118
|
-
if (e instanceof Error && "stderr" in e) throw new Error(`${e.stderr}`);
|
|
119
|
-
throw new Error("unknown Error");
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
65
|
// src/helper/formatTime.ts
|
|
124
66
|
var formatTime = (timeMs) => {
|
|
125
67
|
if (timeMs < 1e3) return `${timeMs}ms`;
|
|
@@ -148,14 +90,88 @@ var getOraTexts = (label) => ({
|
|
|
148
90
|
}
|
|
149
91
|
});
|
|
150
92
|
|
|
151
|
-
// src/
|
|
93
|
+
// src/helper/tempDir.ts
|
|
94
|
+
import fs from "node:fs/promises";
|
|
95
|
+
import { tmpdir } from "node:os";
|
|
96
|
+
import path from "node:path";
|
|
97
|
+
var createTempDir = async (name, suffix = `${Date.now()}`) => {
|
|
98
|
+
const tmpDir = path.join(tmpdir(), `${name}-${suffix}`);
|
|
99
|
+
await fs.mkdir(tmpDir, { recursive: true });
|
|
100
|
+
return tmpDir;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// src/helper/tryCatch.ts
|
|
104
|
+
async function tryCatch(promise) {
|
|
105
|
+
try {
|
|
106
|
+
const data = await promise;
|
|
107
|
+
return { data, error: null };
|
|
108
|
+
} catch (error) {
|
|
109
|
+
return { data: null, error };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// src/device/install/bundletool.ts
|
|
152
114
|
import { oraPromise } from "ora";
|
|
115
|
+
import { $ as $2, which } from "zx";
|
|
116
|
+
var getOrInstallBundletool = async () => {
|
|
117
|
+
const bundletoolPath = await which("bundletool", { nothrow: true });
|
|
118
|
+
if (bundletoolPath) return { type: "global", path: bundletoolPath };
|
|
119
|
+
const jarInfo = await getBundleToolJar();
|
|
120
|
+
if (jarInfo) return jarInfo;
|
|
121
|
+
return oraPromise(installBundleTool(), getOraTexts("Downloading bundletool"));
|
|
122
|
+
};
|
|
123
|
+
var bundletoolVersion = "1.18.1";
|
|
124
|
+
var bundletoolData = {
|
|
125
|
+
version: bundletoolVersion,
|
|
126
|
+
filename: `bundletool-all-${bundletoolVersion}.jar`,
|
|
127
|
+
url: `https://github.com/google/bundletool/releases/download/${bundletoolVersion}/bundletool-all-${bundletoolVersion}.jar`
|
|
128
|
+
};
|
|
129
|
+
var getBundletoolTmpJarPath = async () => {
|
|
130
|
+
const bundletoolPath = await createTempDir("bitrise-api-cli", "bundletool");
|
|
131
|
+
return path2.join(bundletoolPath, bundletoolData.filename);
|
|
132
|
+
};
|
|
133
|
+
var $$ = $2({ quiet: true });
|
|
134
|
+
var getBundleToolJar = async () => {
|
|
135
|
+
const jarPath = await getBundletoolTmpJarPath();
|
|
136
|
+
const { error } = await tryCatch(fs2.access(jarPath));
|
|
137
|
+
if (!error) return { type: "jar", path: jarPath };
|
|
138
|
+
return false;
|
|
139
|
+
};
|
|
140
|
+
var installBundleTool = async () => {
|
|
141
|
+
const jarPath = await getBundletoolTmpJarPath();
|
|
142
|
+
const { duration } = await $$`curl -L ${bundletoolData.url} -o ${jarPath}`;
|
|
143
|
+
await $2`java -jar ${jarPath} version`;
|
|
144
|
+
return { type: "jar", path: jarPath, duration };
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// src/device/install/convertAabToApk.ts
|
|
148
|
+
import { $ as $3 } from "zx";
|
|
149
|
+
var convertAabToApk = async (aabPath, flags) => {
|
|
150
|
+
const startTime = Date.now();
|
|
151
|
+
const tempDir = await createTempDir("bitrise-api-cli");
|
|
152
|
+
const fileName = path3.basename(aabPath, ".aab");
|
|
153
|
+
const outPath = path3.join(tempDir, `${fileName}.apks`);
|
|
154
|
+
const zipPath = path3.join(tempDir, `${fileName}.zip`);
|
|
155
|
+
const bundletool = await getOrInstallBundletool();
|
|
156
|
+
if (flags.debug) console.log(`bundletool installation type: ${bundletool.type} in path ${bundletool.path}`);
|
|
157
|
+
if (bundletool.type === "global") {
|
|
158
|
+
await $3`bundletool build-apks --connected-device --bundle=${fileName}.aab --output=${outPath}`;
|
|
159
|
+
} else if (bundletool.type === "jar") {
|
|
160
|
+
await $3`java -jar ${bundletool.path} build-apks --connected-device --bundle=${fileName}.aab --output=${outPath}`;
|
|
161
|
+
}
|
|
162
|
+
await fs3.rename(outPath, zipPath);
|
|
163
|
+
await $3`unzip -o ${zipPath} -d ${tempDir}`;
|
|
164
|
+
return { apkFolder: path3.join(tempDir, "./splits"), duration: Date.now() - startTime };
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// src/device/install/run.ts
|
|
168
|
+
import { oraPromise as oraPromise2 } from "ora";
|
|
153
169
|
var installApp = async ({ file, flags }) => {
|
|
154
170
|
if (flags.artifact === "android-apk" && file.endsWith(".aab")) {
|
|
155
|
-
const { apkFolder } = await
|
|
156
|
-
await
|
|
171
|
+
const { apkFolder } = await oraPromise2(convertAabToApk(file, flags), getOraTexts("Convert AAB to Split APK"));
|
|
172
|
+
await oraPromise2(installSplitApk(apkFolder), getOraTexts("installing Split APK"));
|
|
157
173
|
} else if (flags.artifact === "android-apk" && file.endsWith(".apk")) {
|
|
158
|
-
await
|
|
174
|
+
await oraPromise2(installApk(file), getOraTexts("installing APK"));
|
|
159
175
|
} else if (flags.artifact === "android-apk") {
|
|
160
176
|
throw Error("Artifact is not an APK or AAB file");
|
|
161
177
|
} else {
|
|
@@ -1563,11 +1579,9 @@ var BuildsApi = class extends BaseAPI {
|
|
|
1563
1579
|
};
|
|
1564
1580
|
|
|
1565
1581
|
// src/bitrise/api.ts
|
|
1566
|
-
var
|
|
1567
|
-
var
|
|
1568
|
-
|
|
1569
|
-
builds: () => new BuildsApi(getApiConfig())
|
|
1570
|
-
};
|
|
1582
|
+
var apiConfig = new Configuration({ apiKey: () => ENV.token });
|
|
1583
|
+
var apiBuildArtifact = new BuildArtifactApi(apiConfig);
|
|
1584
|
+
var apiBuilds = new BuildsApi(apiConfig);
|
|
1571
1585
|
|
|
1572
1586
|
// src/helper/debugLog.ts
|
|
1573
1587
|
var debugLog = (label, data) => console.log(`${label}: ${JSON.stringify(data, void 0, 2)}`);
|
|
@@ -1582,7 +1596,7 @@ var ensureMandatoryFields = (input, mandatory) => {
|
|
|
1582
1596
|
|
|
1583
1597
|
// src/bitrise/fetchArtifact.ts
|
|
1584
1598
|
var fetchArtifact = async ({ artifactSlug, buildSlug }) => {
|
|
1585
|
-
const { data } = await
|
|
1599
|
+
const { data } = await apiBuildArtifact.artifactShow({ appSlug: ENV.appSlug, artifactSlug, buildSlug });
|
|
1586
1600
|
if (!data) throw new Error("buildArtifact().artifactShow returned no data");
|
|
1587
1601
|
if (ENV.debug) debugLog("artifact", data);
|
|
1588
1602
|
return ensureMandatoryFields(data, ["expiringDownloadUrl"]);
|
|
@@ -1590,7 +1604,7 @@ var fetchArtifact = async ({ artifactSlug, buildSlug }) => {
|
|
|
1590
1604
|
|
|
1591
1605
|
// src/bitrise/fetchArtifactList.ts
|
|
1592
1606
|
var fetchArtifactList = async (buildSlug) => {
|
|
1593
|
-
const { data } = await
|
|
1607
|
+
const { data } = await apiBuildArtifact.artifactList({ appSlug: ENV.appSlug, buildSlug });
|
|
1594
1608
|
if (!data) throw new Error("buildArtifact().artifactList returned no data");
|
|
1595
1609
|
return data;
|
|
1596
1610
|
};
|
|
@@ -1604,7 +1618,7 @@ var fetchArtifactByType = async (buildSlug) => {
|
|
|
1604
1618
|
|
|
1605
1619
|
// src/bitrise/fetchBuilds.ts
|
|
1606
1620
|
var getAllBuilds = async () => {
|
|
1607
|
-
const { data } = await
|
|
1621
|
+
const { data } = await apiBuilds.buildList({ appSlug: ENV.appSlug, status: 1 });
|
|
1608
1622
|
if (!data) throw Error("no build data");
|
|
1609
1623
|
return data;
|
|
1610
1624
|
};
|
|
@@ -1616,21 +1630,6 @@ var getLatestBuild = async () => {
|
|
|
1616
1630
|
return ensureMandatoryFields(latestBuild, ["slug"]);
|
|
1617
1631
|
};
|
|
1618
1632
|
|
|
1619
|
-
// src/helper/formatBytes.ts
|
|
1620
|
-
var decimals = 0;
|
|
1621
|
-
var formatBytes = (bytes) => {
|
|
1622
|
-
if (bytes === 0) return "0 Bytes";
|
|
1623
|
-
const k = 1024;
|
|
1624
|
-
const dm = decimals || 2;
|
|
1625
|
-
const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
|
1626
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
1627
|
-
const formattedSize = Number.parseFloat((bytes / k ** i).toFixed(dm));
|
|
1628
|
-
return `${formattedSize} ${sizes[i]}`;
|
|
1629
|
-
};
|
|
1630
|
-
|
|
1631
|
-
// src/downloadLatestArtifacts.ts
|
|
1632
|
-
import { oraPromise as oraPromise2 } from "ora";
|
|
1633
|
-
|
|
1634
1633
|
// src/helper/downloadFile.ts
|
|
1635
1634
|
import { createWriteStream } from "node:fs";
|
|
1636
1635
|
import { get } from "node:https";
|
|
@@ -1652,19 +1651,32 @@ var downloadFile = async (fileUrl, outputLocationPath) => {
|
|
|
1652
1651
|
return { file: outputLocationPath, duration: Date.now() - startTime };
|
|
1653
1652
|
};
|
|
1654
1653
|
|
|
1654
|
+
// src/helper/formatBytes.ts
|
|
1655
|
+
var decimals = 0;
|
|
1656
|
+
var formatBytes = (bytes) => {
|
|
1657
|
+
if (bytes === 0) return "0 Bytes";
|
|
1658
|
+
const k = 1024;
|
|
1659
|
+
const dm = decimals || 2;
|
|
1660
|
+
const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
|
1661
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
1662
|
+
const formattedSize = Number.parseFloat((bytes / k ** i).toFixed(dm));
|
|
1663
|
+
return `${formattedSize} ${sizes[i]}`;
|
|
1664
|
+
};
|
|
1665
|
+
|
|
1655
1666
|
// src/downloadLatestArtifacts.ts
|
|
1667
|
+
import { oraPromise as oraPromise3 } from "ora";
|
|
1656
1668
|
var downloadLatestArtifacts = async (options) => {
|
|
1657
|
-
const latestBuild = await
|
|
1658
|
-
const artifactMetadata = await
|
|
1669
|
+
const latestBuild = await oraPromise3(getLatestBuild(), getOraTexts("fetching latest build"));
|
|
1670
|
+
const artifactMetadata = await oraPromise3(
|
|
1659
1671
|
fetchArtifactByType(latestBuild.slug),
|
|
1660
1672
|
getOraTexts("fetching artifact list")
|
|
1661
1673
|
);
|
|
1662
|
-
const artifact = await
|
|
1674
|
+
const artifact = await oraPromise3(
|
|
1663
1675
|
fetchArtifact({ artifactSlug: artifactMetadata.slug, buildSlug: latestBuild.slug }),
|
|
1664
1676
|
getOraTexts("fetching artifact metadata")
|
|
1665
1677
|
);
|
|
1666
1678
|
const fileType = artifact.title?.split(".").pop() ?? "unknown";
|
|
1667
|
-
const { file } = await
|
|
1679
|
+
const { file } = await oraPromise3(downloadFile(artifact.expiringDownloadUrl, artifactMetadata.title), {
|
|
1668
1680
|
...getOraTexts(`downloading ${fileType} file`),
|
|
1669
1681
|
text: `downloading ${fileType} file [${formatBytes(artifact.fileSizeBytes ?? 0)}]`
|
|
1670
1682
|
});
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bitrise-api-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "bitrise api CLI wrapper",
|
|
5
5
|
"module": "index",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
|
-
"bitrise-api-cli": "./dist/cli.js"
|
|
9
|
-
"__bitrise-api-cli_bash_complete": "dist/bash-complete.js"
|
|
8
|
+
"bitrise-api-cli": "./dist/cli.js"
|
|
10
9
|
},
|
|
11
10
|
"keywords": ["bitrise", "bitriseio", "apk", "downloader"],
|
|
12
11
|
"license": "MIT",
|
|
@@ -23,16 +22,16 @@
|
|
|
23
22
|
"prepublishOnly": "bun i && bun run lint:CI && tsc && bun run build"
|
|
24
23
|
},
|
|
25
24
|
"dependencies": {
|
|
26
|
-
"@stricli/core": "1.1.
|
|
25
|
+
"@stricli/core": "1.1.2",
|
|
27
26
|
"ora": "8.2.0",
|
|
28
|
-
"
|
|
27
|
+
"zx": "8.5.3"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
30
|
"@biomejs/biome": "1.9.4",
|
|
32
|
-
"@openapitools/openapi-generator-cli": "2.
|
|
31
|
+
"@openapitools/openapi-generator-cli": "2.19.1",
|
|
32
|
+
"@total-typescript/ts-reset": "0.6.1",
|
|
33
33
|
"@types/bun": "latest",
|
|
34
|
-
"@types/teen_process": "^2.0.4",
|
|
35
34
|
"tsup": "8.4.0",
|
|
36
|
-
"typescript": "5.8.
|
|
35
|
+
"typescript": "5.8.3"
|
|
37
36
|
}
|
|
38
37
|
}
|
package/dist/bash-complete.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
app,
|
|
4
|
-
buildContext
|
|
5
|
-
} from "./chunk-YAG6H26E.js";
|
|
6
|
-
import "./chunk-CF25N4TY.js";
|
|
7
|
-
|
|
8
|
-
// src/cli/bin/bash-complete.ts
|
|
9
|
-
import { proposeCompletions } from "@stricli/core";
|
|
10
|
-
var inputs = process.argv.slice(3);
|
|
11
|
-
if (process.env["COMP_LINE"]?.endsWith(" ")) {
|
|
12
|
-
inputs.push("");
|
|
13
|
-
}
|
|
14
|
-
await proposeCompletions(app, inputs, buildContext(process));
|
|
15
|
-
try {
|
|
16
|
-
for (const { completion } of await proposeCompletions(app, inputs, buildContext(process))) {
|
|
17
|
-
process.stdout.write(`${completion}
|
|
18
|
-
`);
|
|
19
|
-
}
|
|
20
|
-
} catch {
|
|
21
|
-
}
|
package/dist/chunk-YAG6H26E.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
validArtifactTypes
|
|
3
|
-
} from "./chunk-CF25N4TY.js";
|
|
4
|
-
|
|
5
|
-
// src/cli/commands/download/command.ts
|
|
6
|
-
import { buildCommand } from "@stricli/core";
|
|
7
|
-
var downloadCommand = buildCommand({
|
|
8
|
-
loader: async () => import("./impl-WOGNQXCX.js"),
|
|
9
|
-
parameters: {
|
|
10
|
-
flags: {
|
|
11
|
-
artifact: {
|
|
12
|
-
kind: "enum",
|
|
13
|
-
brief: 'bitrise artifact type "ios-ipa" or "android-apk"',
|
|
14
|
-
default: "android-apk",
|
|
15
|
-
values: validArtifactTypes
|
|
16
|
-
},
|
|
17
|
-
debug: {
|
|
18
|
-
kind: "boolean",
|
|
19
|
-
brief: "Number of times to say hello",
|
|
20
|
-
default: false
|
|
21
|
-
},
|
|
22
|
-
slug: {
|
|
23
|
-
kind: "parsed",
|
|
24
|
-
brief: "bitrise app slug (or $BITRISE_APP_SLUG) see bitrise project url to get slug",
|
|
25
|
-
default: process.env["BITRISE_APP_SLUG"],
|
|
26
|
-
parse: String,
|
|
27
|
-
placeholder: "APP_SLUG"
|
|
28
|
-
},
|
|
29
|
-
token: {
|
|
30
|
-
kind: "parsed",
|
|
31
|
-
brief: "bitrise api token (or $BITRISE_API_CLI_TOKEN)",
|
|
32
|
-
default: process.env["BITRISE_API_CLI_TOKEN"],
|
|
33
|
-
parse: String,
|
|
34
|
-
placeholder: "API_TOKEN"
|
|
35
|
-
},
|
|
36
|
-
workflow: {
|
|
37
|
-
kind: "parsed",
|
|
38
|
-
brief: "workflow to get apk from (or $BITRISE_API_CLI_WORKFLOW)",
|
|
39
|
-
default: process.env["BITRISE_API_CLI_WORKFLOW"],
|
|
40
|
-
parse: String,
|
|
41
|
-
placeholder: "WORKFLOW_NAME"
|
|
42
|
-
},
|
|
43
|
-
install: {
|
|
44
|
-
kind: "boolean",
|
|
45
|
-
brief: "Install the downloaded apk/aab artifact [android only]",
|
|
46
|
-
default: false
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
aliases: {
|
|
50
|
-
a: "artifact",
|
|
51
|
-
d: "debug",
|
|
52
|
-
s: "slug",
|
|
53
|
-
t: "token",
|
|
54
|
-
w: "workflow",
|
|
55
|
-
i: "install"
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
docs: {
|
|
59
|
-
brief: "Download bitrise artifacts. Most parameters can be set via environment variables."
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// src/cli/app.ts
|
|
64
|
-
import { buildApplication, buildRouteMap } from "@stricli/core";
|
|
65
|
-
|
|
66
|
-
// package.json
|
|
67
|
-
var name = "bitrise-api-cli";
|
|
68
|
-
var version = "0.0.9-beta2";
|
|
69
|
-
var description = "bitrise api CLI wrapper";
|
|
70
|
-
|
|
71
|
-
// src/cli/app.ts
|
|
72
|
-
var root = buildRouteMap({
|
|
73
|
-
routes: {
|
|
74
|
-
download: downloadCommand
|
|
75
|
-
},
|
|
76
|
-
docs: {
|
|
77
|
-
brief: description
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
var app = buildApplication(root, {
|
|
81
|
-
name,
|
|
82
|
-
versionInfo: {
|
|
83
|
-
currentVersion: version
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
// src/cli/context.ts
|
|
88
|
-
function buildContext(process2) {
|
|
89
|
-
return {
|
|
90
|
-
process: process2
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export {
|
|
95
|
-
app,
|
|
96
|
-
buildContext
|
|
97
|
-
};
|