bitrise-api-cli 0.0.9 → 0.0.11

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/README.md CHANGED
@@ -18,13 +18,25 @@ npx bitrise-api-cli@latest download --token <BITRISE_TOKEN> --workflow <WORKFLOW
18
18
 
19
19
  ## 🔐 Configuration
20
20
 
21
- ### Environment Variables (instead of CLI flags)
21
+ You can combine command-line flags, environment variables, and file-based configuration.
22
22
 
23
- | Variable | Description | Required |
24
- | -------------------------- | ------------------------------------ | ------------ |
25
- | `BITRISE_API_CLI_TOKEN` | Your Bitrise API token | Yes |
26
- | `BITRISE_API_CLI_WORKFLOW` | Workflow name for artifact downloads | Yes |
27
- | `BITRISE_APP_SLUG` | App Slug (auto-set in Bitrise CI) | Locally only |
23
+ ### Environment Variables
24
+
25
+ - `BITRISE_API_CLI_TOKEN`
26
+ - `BITRISE_API_CLI_WORKFLOW`
27
+ - `BITRISE_APP_SLUG` App Slug (auto-set in Bitrise CI)
28
+
29
+ ### File-Based Configuration
30
+
31
+ The `.bitrise.json` file can be placed in your project root or home directory.
32
+
33
+ ```json
34
+ {
35
+ "token": "your-bitrise-token",
36
+ "slug": "your-app-slug",
37
+ "workflow": "your-workflow-name"
38
+ }
39
+ ```
28
40
 
29
41
  ## 💡 Examples
30
42
 
package/dist/cli.js CHANGED
@@ -1,10 +1,122 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- app,
4
- buildContext
5
- } from "./chunk-BL3ATQXK.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/config/readConfig.ts
10
+ import { cosmiconfigSync } from "cosmiconfig";
11
+ var explorer = cosmiconfigSync("bitrise", {
12
+ searchPlaces: [".bitrise.json"]
13
+ });
14
+ var readConfig = () => {
15
+ const data = explorer.search()?.config ?? {};
16
+ return {
17
+ token: data.token,
18
+ slug: data.slug,
19
+ workflow: data.workflow
20
+ };
21
+ };
22
+
23
+ // src/cli/commands/download/command.ts
24
+ import { buildCommand } from "@stricli/core";
25
+ var downloadCommand = buildCommand({
26
+ loader: async () => import("./impl-KCO2VZ2R.js"),
27
+ parameters: {
28
+ flags: {
29
+ artifact: {
30
+ kind: "enum",
31
+ brief: 'bitrise artifact type "ios-ipa" or "android-apk"',
32
+ default: "android-apk",
33
+ values: validArtifactTypes
34
+ },
35
+ debug: {
36
+ kind: "boolean",
37
+ brief: "Number of times to say hello",
38
+ default: false
39
+ },
40
+ slug: {
41
+ kind: "parsed",
42
+ brief: "bitrise app slug (or $BITRISE_APP_SLUG) see bitrise project url to get slug",
43
+ default: process.env["BITRISE_APP_SLUG"] ?? readConfig().slug,
44
+ parse: String,
45
+ placeholder: "APP_SLUG"
46
+ },
47
+ token: {
48
+ kind: "parsed",
49
+ brief: "bitrise api token (or $BITRISE_API_CLI_TOKEN)",
50
+ default: process.env["BITRISE_API_CLI_TOKEN"] ?? readConfig().token,
51
+ parse: String,
52
+ placeholder: "API_TOKEN"
53
+ },
54
+ workflow: {
55
+ kind: "parsed",
56
+ brief: "workflow to get apk from (or $BITRISE_API_CLI_WORKFLOW)",
57
+ default: process.env["BITRISE_API_CLI_WORKFLOW"] ?? readConfig().workflow,
58
+ parse: String,
59
+ placeholder: "WORKFLOW_NAME"
60
+ },
61
+ install: {
62
+ kind: "boolean",
63
+ brief: "Install the downloaded apk/aab artifact [android only]",
64
+ default: false
65
+ }
66
+ },
67
+ aliases: {
68
+ a: "artifact",
69
+ d: "debug",
70
+ s: "slug",
71
+ t: "token",
72
+ w: "workflow",
73
+ i: "install"
74
+ }
75
+ },
76
+ docs: {
77
+ brief: "Download bitrise artifacts. Most parameters can be set via environment variables."
78
+ }
79
+ });
80
+
81
+ // src/cli/app.ts
82
+ import { buildApplication, buildRouteMap } from "@stricli/core";
83
+
84
+ // package.json
85
+ var name = "bitrise-api-cli";
86
+ var version = "0.0.11";
87
+ var description = "bitrise api CLI wrapper";
88
+
89
+ // src/cli/app.ts
90
+ var root = buildRouteMap({
91
+ routes: {
92
+ download: downloadCommand
93
+ },
94
+ docs: {
95
+ brief: description
96
+ }
97
+ });
98
+ var app = buildApplication(root, {
99
+ name,
100
+ versionInfo: {
101
+ currentVersion: version,
102
+ getLatestVersion: async () => {
103
+ const response = await fetch(`https://registry.npmjs.org/${name}/latest`);
104
+ if (!response.ok) return void 0;
105
+ const data = await response.json();
106
+ if (!data || typeof data !== "object" || !("version" in data) || typeof data.version !== "string")
107
+ return void 0;
108
+ return data.version;
109
+ },
110
+ upgradeCommand: `npx ${name}@latest`
111
+ }
112
+ });
113
+
114
+ // src/cli/context.ts
115
+ function buildContext(process2) {
116
+ return {
117
+ process: process2
118
+ };
119
+ }
120
+
121
+ // src/cli/bin/cli.ts
10
122
  await run(app, process.argv.slice(2), buildContext(process));