bitrise-api-cli 0.0.12 β†’ 0.1.1

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.
Files changed (3) hide show
  1. package/README.md +37 -35
  2. package/dist/cli.js +35 -21
  3. package/package.json +50 -15
package/README.md CHANGED
@@ -1,34 +1,47 @@
1
- # Bitrise API CLI [![npm][npm-image]][npm-url] ![npm][npm-dl-stats]
1
+ # bitrise-api-cli [![npm][npm-image]][npm-url] ![npm][npm-dl-stats]
2
2
 
3
- πŸš€ An unofficial CLI tool for Bitrise API artifact downloads.
3
+ Download the latest Bitrise build artifact for a workflow without clicking through the UI.
4
4
 
5
- ## 🎯 Features
5
+ `bitrise-api-cli` is an unofficial Bitrise CLI focused on one job: find the latest successful build for a workflow, pick the matching artifact, and download it locally.
6
6
 
7
- - Download artifacts from successful builds
8
- - Workflow-based retrieval
9
- - CI/CD integration
7
+ ## Quick Start
10
8
 
11
- ## πŸš€ Quick Start
9
+ ```bash
10
+ npx bitrise-api-cli@latest download \
11
+ --token <BITRISE_TOKEN> \
12
+ --workflow <WORKFLOW_NAME> \
13
+ --slug <APP_SLUG>
14
+ ```
15
+
16
+ ## What It Can Download
12
17
 
13
- ### Download Artifacts
18
+ - `android-apk` artifacts (default)
19
+ - `ios-ipa` artifacts
20
+
21
+ For Android artifacts you can also install the downloaded file immediately:
14
22
 
15
23
  ```bash
16
- npx bitrise-api-cli@latest download --token <BITRISE_TOKEN> --workflow <WORKFLOW_NAME> [--slug <APP_SLUG>]
24
+ npx bitrise-api-cli@latest download \
25
+ --artifact android-apk \
26
+ --install \
27
+ --token <BITRISE_TOKEN> \
28
+ --workflow android-release \
29
+ --slug <APP_SLUG>
17
30
  ```
18
31
 
19
- ## πŸ” Configuration
32
+ ## Configuration
20
33
 
21
- You can combine command-line flags, environment variables, and file-based configuration.
34
+ You can combine command flags, environment variables, and `.bitrise.json`.
22
35
 
23
36
  ### Environment Variables
24
37
 
25
38
  - `BITRISE_API_CLI_TOKEN`
26
39
  - `BITRISE_API_CLI_WORKFLOW`
27
- - `BITRISE_APP_SLUG` App Slug (auto-set in Bitrise CI)
40
+ - `BITRISE_APP_SLUG`
28
41
 
29
- ### File-Based Configuration
42
+ `BITRISE_APP_SLUG` is usually available automatically in Bitrise CI.
30
43
 
31
- The `.bitrise.json` file can be placed in your project root or home directory.
44
+ ### `.bitrise.json`
32
45
 
33
46
  ```json
34
47
  {
@@ -38,38 +51,27 @@ The `.bitrise.json` file can be placed in your project root or home directory.
38
51
  }
39
52
  ```
40
53
 
41
- ## πŸ’‘ Examples
42
-
43
- ### Command Line
44
-
45
- ```bash
46
- npx bitrise-api-cli@latest download --token abc123 --workflow android-release --slug a1b2c3d4e5f6
47
- ```
54
+ ## Main Flags
48
55
 
49
- ### CI/CD Integration
56
+ - `--token <token>`: Bitrise API token
57
+ - `--workflow <name>`: workflow whose latest successful build should be used
58
+ - `--slug <app-slug>`: Bitrise app slug
59
+ - `--artifact <android-apk|ios-ipa>`: artifact type to download
60
+ - `--install`: install the downloaded Android artifact locally
61
+ - `--debug`: print extra request and resolution details
50
62
 
51
- Integrate this CLI tool using the "Script" Step to download artifacts from previous builds, eliminating the need to rebuild from source.
63
+ ## CI Example
52
64
 
53
65
  ```yaml
54
66
  steps:
55
67
  - script:
56
68
  inputs:
57
69
  content: |
58
- npx bitrise-api-cli download \
70
+ npx bitrise-api-cli@latest download \
59
71
  --workflow android-release \
60
- --token $BITRISE_API_TOKEN
72
+ --token "$BITRISE_API_CLI_TOKEN"
61
73
  ```
62
74
 
63
- ## πŸ“ License
64
-
65
- This project is [MIT](LICENSE) licensed.
66
-
67
- ---
68
-
69
- <div align="center">
70
- <p>Found this project useful? Give it a ⭐️!</p>
71
- </div>
72
-
73
75
  [npm-image]: https://img.shields.io/npm/v/bitrise-api-cli
74
76
  [npm-url]: https://www.npmjs.com/package/bitrise-api-cli
75
77
  [npm-dl-stats]: https://img.shields.io/npm/dm/bitrise-api-cli
package/dist/cli.js CHANGED
@@ -1,8 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __esm = (fn, res) => function __init() {
5
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
4
+ var __esm = (fn, res, err) => function __init() {
5
+ if (err) throw err[0];
6
+ try {
7
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
8
+ } catch (e) {
9
+ throw err = [e], e;
10
+ }
6
11
  };
7
12
  var __export = (target, all) => {
8
13
  for (var name2 in all)
@@ -119,7 +124,7 @@ var init_oraHelper = __esm({
119
124
  failText: (error) => {
120
125
  if (isFetchError(error))
121
126
  return `${label} failed with HTTP Error ${error.response.status} ${error.response.statusText}`;
122
- return `${label} failed with error: ${error.message}`;
127
+ return `${label} failed with error: ${error instanceof Error ? error.message : String(error)}`;
123
128
  },
124
129
  successText: (data) => {
125
130
  if (data && typeof data === "object" && "duration" in data && typeof data.duration === "number") {
@@ -132,9 +137,9 @@ var init_oraHelper = __esm({
132
137
  });
133
138
 
134
139
  // src/helper/tempDir.ts
135
- import fs from "node:fs/promises";
136
- import { tmpdir } from "node:os";
137
- import path from "node:path";
140
+ import fs from "fs/promises";
141
+ import { tmpdir } from "os";
142
+ import path from "path";
138
143
  var createTempDir;
139
144
  var init_tempDir = __esm({
140
145
  "src/helper/tempDir.ts"() {
@@ -163,8 +168,8 @@ var init_tryCatch = __esm({
163
168
  });
164
169
 
165
170
  // src/device/install/bundletool.ts
166
- import fs2 from "node:fs/promises";
167
- import path2 from "node:path";
171
+ import fs2 from "fs/promises";
172
+ import path2 from "path";
168
173
  import { oraPromise } from "ora";
169
174
  import { $ as $2, which } from "zx";
170
175
  var getOrInstallBundletool, bundletoolVersion, bundletoolData, getBundletoolTmpJarPath, $$, getBundleToolJar, installBundleTool;
@@ -208,8 +213,8 @@ var init_bundletool = __esm({
208
213
  });
209
214
 
210
215
  // src/device/install/convertAabToApk.ts
211
- import fs3 from "node:fs/promises";
212
- import path3 from "node:path";
216
+ import fs3 from "fs/promises";
217
+ import path3 from "path";
213
218
  import { $ as $3 } from "zx";
214
219
  var convertAabToApk;
215
220
  var init_convertAabToApk = __esm({
@@ -298,6 +303,7 @@ var init_runtime = __esm({
298
303
  constructor(configuration = {}) {
299
304
  this.configuration = configuration;
300
305
  }
306
+ configuration;
301
307
  set config(configuration) {
302
308
  this.configuration = configuration;
303
309
  }
@@ -346,6 +352,7 @@ var init_runtime = __esm({
346
352
  this.configuration = configuration;
347
353
  this.middleware = configuration.middleware;
348
354
  }
355
+ configuration;
349
356
  static jsonRegex = new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$", "i");
350
357
  middleware;
351
358
  withMiddleware(...middlewares) {
@@ -481,6 +488,7 @@ var init_runtime = __esm({
481
488
  super(msg);
482
489
  this.response = response;
483
490
  }
491
+ response;
484
492
  name = "ResponseError";
485
493
  };
486
494
  FetchError = class extends Error {
@@ -488,6 +496,7 @@ var init_runtime = __esm({
488
496
  super(msg);
489
497
  this.cause = cause;
490
498
  }
499
+ cause;
491
500
  name = "FetchError";
492
501
  };
493
502
  RequiredError = class extends Error {
@@ -495,6 +504,7 @@ var init_runtime = __esm({
495
504
  super(msg);
496
505
  this.field = field;
497
506
  }
507
+ field;
498
508
  name = "RequiredError";
499
509
  };
500
510
  JSONApiResponse = class {
@@ -502,6 +512,8 @@ var init_runtime = __esm({
502
512
  this.raw = raw;
503
513
  this.transformer = transformer;
504
514
  }
515
+ raw;
516
+ transformer;
505
517
  async value() {
506
518
  return this.transformer(await this.raw.json());
507
519
  }
@@ -510,6 +522,7 @@ var init_runtime = __esm({
510
522
  constructor(raw) {
511
523
  this.raw = raw;
512
524
  }
525
+ raw;
513
526
  async value() {
514
527
  return void 0;
515
528
  }
@@ -518,6 +531,7 @@ var init_runtime = __esm({
518
531
  constructor(raw) {
519
532
  this.raw = raw;
520
533
  }
534
+ raw;
521
535
  async value() {
522
536
  return await this.raw.text();
523
537
  }
@@ -3531,10 +3545,10 @@ var init_fetchBuilds = __esm({
3531
3545
  });
3532
3546
 
3533
3547
  // src/helper/downloadFile.ts
3534
- import { createWriteStream } from "node:fs";
3535
- import { get } from "node:https";
3536
- import { pipeline } from "node:stream/promises";
3537
- import { URL } from "node:url";
3548
+ import { createWriteStream } from "fs";
3549
+ import { get } from "https";
3550
+ import { pipeline } from "stream/promises";
3551
+ import { URL } from "url";
3538
3552
  var downloadFile;
3539
3553
  var init_downloadFile = __esm({
3540
3554
  "src/helper/downloadFile.ts"() {
@@ -3587,7 +3601,7 @@ var init_downloadLatestArtifacts = __esm({
3587
3601
  init_downloadFile();
3588
3602
  init_formatBytes();
3589
3603
  init_oraHelper();
3590
- downloadLatestArtifacts = async (options) => {
3604
+ downloadLatestArtifacts = async (_options) => {
3591
3605
  const latestBuild = await oraPromise3(getLatestBuild(), getOraTexts("fetching latest build"));
3592
3606
  const artifactMetadata = await oraPromise3(
3593
3607
  fetchArtifactByType(latestBuild.slug),
@@ -3631,8 +3645,12 @@ var init_impl = __esm({
3631
3645
  // src/cli/bin/cli.ts
3632
3646
  import { run } from "@stricli/core";
3633
3647
 
3648
+ // src/cli/app.ts
3649
+ import { buildApplication, buildRouteMap } from "@stricli/core";
3650
+
3634
3651
  // src/cli/commands/download/command.ts
3635
3652
  init_cliOptions_types();
3653
+ import { buildCommand } from "@stricli/core";
3636
3654
 
3637
3655
  // src/config/readConfig.ts
3638
3656
  import { cosmiconfigSync } from "cosmiconfig";
@@ -3649,7 +3667,6 @@ var readConfig = () => {
3649
3667
  };
3650
3668
 
3651
3669
  // src/cli/commands/download/command.ts
3652
- import { buildCommand } from "@stricli/core";
3653
3670
  var downloadCommand = buildCommand({
3654
3671
  loader: async () => Promise.resolve().then(() => (init_impl(), impl_exports)),
3655
3672
  parameters: {
@@ -3706,13 +3723,10 @@ var downloadCommand = buildCommand({
3706
3723
  }
3707
3724
  });
3708
3725
 
3709
- // src/cli/app.ts
3710
- import { buildApplication, buildRouteMap } from "@stricli/core";
3711
-
3712
3726
  // package.json
3713
3727
  var name = "bitrise-api-cli";
3714
- var version = "0.0.12";
3715
- var description = "bitrise api CLI wrapper";
3728
+ var version = "0.1.1";
3729
+ var description = "Download the latest Bitrise build artifacts for a workflow from the command line.";
3716
3730
 
3717
3731
  // src/cli/app.ts
3718
3732
  var root = buildRouteMap({
package/package.json CHANGED
@@ -1,16 +1,39 @@
1
1
  {
2
2
  "name": "bitrise-api-cli",
3
- "version": "0.0.12",
4
- "description": "bitrise api CLI wrapper",
3
+ "version": "0.1.1",
4
+ "description": "Download the latest Bitrise build artifacts for a workflow from the command line.",
5
5
  "module": "index",
6
6
  "type": "module",
7
7
  "bin": {
8
- "bitrise-api-cli": "./dist/cli.js"
8
+ "bitrise-api-cli": "dist/cli.js"
9
+ },
10
+ "keywords": [
11
+ "bitrise",
12
+ "bitriseio",
13
+ "ci",
14
+ "artifacts",
15
+ "apk",
16
+ "ipa",
17
+ "download",
18
+ "cli"
19
+ ],
20
+ "author": {
21
+ "name": "WookieFPV (Lukas MΓΌller)",
22
+ "url": "https://github.com/WookieFPV"
9
23
  },
10
- "keywords": ["bitrise", "bitriseio", "apk", "downloader"],
11
24
  "license": "MIT",
12
25
  "main": "dist/cli.js",
13
- "files": ["dist"],
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/WookieFPV/bitrise-api-cli.git"
29
+ },
30
+ "homepage": "https://github.com/WookieFPV/bitrise-api-cli#readme",
31
+ "bugs": {
32
+ "url": "https://github.com/WookieFPV/bitrise-api-cli/issues"
33
+ },
34
+ "files": [
35
+ "dist"
36
+ ],
14
37
  "scripts": {
15
38
  "build": "tsup",
16
39
  "build:dev": "tsup --watch --clean false",
@@ -22,18 +45,30 @@
22
45
  "prepublishOnly": "bun i && bun run lint:CI && tsc && bun run build"
23
46
  },
24
47
  "dependencies": {
25
- "@stricli/core": "1.1.2",
26
- "cosmiconfig": "9.0.0",
27
- "ora": "8.2.0",
28
- "zx": "8.5.3"
48
+ "@stricli/core": "1.3.0",
49
+ "cosmiconfig": "9.0.2",
50
+ "ora": "9.4.1",
51
+ "zx": "8.8.5"
29
52
  },
30
53
  "devDependencies": {
31
- "@biomejs/biome": "1.9.4",
32
- "@openapitools/openapi-generator-cli": "2.19.1",
54
+ "@biomejs/biome": "2.5.5",
55
+ "@openapitools/openapi-generator-cli": "2.40.0",
33
56
  "@total-typescript/ts-reset": "0.6.1",
34
- "@types/bun": "latest",
35
- "lefthook": "1.11.11",
36
- "tsup": "8.4.0",
37
- "typescript": "5.8.3"
57
+ "@types/bun": "1.3.14",
58
+ "lefthook": "2.1.10",
59
+ "tsup": "8.5.1",
60
+ "typescript": "7.0.2"
61
+ },
62
+ "overrides": {
63
+ "brace-expansion": "2.1.2",
64
+ "esbuild": "0.28.1",
65
+ "form-data": "4.0.6",
66
+ "glob": "10.5.0",
67
+ "ip-address": "10.2.0",
68
+ "js-yaml": "4.3.0",
69
+ "minimatch": "9.0.9",
70
+ "picomatch": "4.0.4",
71
+ "rollup": "4.60.4",
72
+ "shell-quote": "1.9.0"
38
73
  }
39
74
  }