green-line-cli 1.0.2

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 ADDED
@@ -0,0 +1,64 @@
1
+ # green-line-cli
2
+
3
+ Local CLI for iOS build and App Store Connect submission.
4
+
5
+ Canonical docs (full setup, Expo migration, CI mode, and command cookbook):
6
+
7
+ - [../../README.md](../../README.md)
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install -g green-line-cli
13
+ ```
14
+
15
+ From monorepo source:
16
+
17
+ ```bash
18
+ npm run -w green-line-cli build
19
+ npm install -g ./apps/cli
20
+ ```
21
+
22
+ ## Required Tooling
23
+
24
+ ```bash
25
+ brew install fastlane
26
+ ```
27
+
28
+ Also required: macOS + Xcode for real Apple build/sign/upload.
29
+
30
+ ## Quick Reference
31
+
32
+ ```bash
33
+ gl auth login --email you@example.com
34
+ gl apple setup --apple-id you@example.com
35
+ gl build ios start
36
+ gl submit ios preflight
37
+ gl submit ios start
38
+ ```
39
+
40
+ ## Expo Quick Reference
41
+
42
+ ```bash
43
+ gl migrate expo --apple-id you@example.com
44
+ ```
45
+
46
+ Equivalent long form:
47
+
48
+ ```bash
49
+ gl apple setup --apple-id you@example.com --from-expo
50
+ ```
51
+
52
+ ## Non-Interactive Quick Reference
53
+
54
+ ```bash
55
+ gl migrate expo --apple-id you@example.com --yes
56
+ gl build ios start --yes
57
+ gl submit ios start --build <BUILD_ID> --yes
58
+ ```
59
+
60
+ ## Local Data
61
+
62
+ - `~/.config/green-line/config.json`
63
+ - `~/.config/green-line/state.json`
64
+ - `~/.config/green-line/storage/...`
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import "dotenv/config";
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ import "dotenv/config";
3
+ import { Command } from "commander";
4
+ function getApiBaseUrl(value) {
5
+ return value ?? process.env.API_BASE_URL ?? "http://localhost:4000";
6
+ }
7
+ async function postJson(url, payload) {
8
+ const response = await fetch(url, {
9
+ method: "POST",
10
+ headers: {
11
+ "content-type": "application/json"
12
+ },
13
+ body: JSON.stringify(payload)
14
+ });
15
+ if (!response.ok) {
16
+ const text = await response.text();
17
+ throw new Error(`Request failed (${response.status}): ${text}`);
18
+ }
19
+ return (await response.json());
20
+ }
21
+ async function getJson(url) {
22
+ const response = await fetch(url);
23
+ if (!response.ok) {
24
+ const text = await response.text();
25
+ throw new Error(`Request failed (${response.status}): ${text}`);
26
+ }
27
+ return (await response.json());
28
+ }
29
+ const program = new Command();
30
+ program
31
+ .name("gl")
32
+ .description("Green Line build and submit CLI")
33
+ .version("0.1.0");
34
+ const build = program.command("build").description("Manage build jobs");
35
+ const ios = build.command("ios").description("iOS build commands");
36
+ ios
37
+ .command("start")
38
+ .requiredOption("--org <orgSlug>", "organization slug")
39
+ .requiredOption("--project <projectSlug>", "project slug")
40
+ .requiredOption("--profile <profile>", "build profile (prod, preview, etc.)")
41
+ .requiredOption("--commit <sha>", "git commit SHA")
42
+ .option("--api <baseUrl>", "API base URL")
43
+ .action(async (options) => {
44
+ const apiBaseUrl = getApiBaseUrl(options.api);
45
+ const result = await postJson(`${apiBaseUrl}/v1/builds`, {
46
+ orgSlug: options.org,
47
+ projectSlug: options.project,
48
+ profile: options.profile,
49
+ commitSha: options.commit
50
+ });
51
+ console.log(`build_id=${result.build.id}`);
52
+ console.log(`status=${result.build.status}`);
53
+ console.log(`created_at=${result.build.createdAt}`);
54
+ });
55
+ ios
56
+ .command("status <buildId>")
57
+ .option("--api <baseUrl>", "API base URL")
58
+ .action(async (buildId, options) => {
59
+ const apiBaseUrl = getApiBaseUrl(options.api);
60
+ const result = await getJson(`${apiBaseUrl}/v1/builds/${buildId}`);
61
+ console.log(`build_id=${result.build.id}`);
62
+ console.log(`status=${result.build.status}`);
63
+ if (result.build.artifactUrl) {
64
+ console.log(`artifact_url=${result.build.artifactUrl}`);
65
+ }
66
+ if (result.build.errorMessage) {
67
+ console.log(`error=${result.build.errorMessage}`);
68
+ }
69
+ console.log(`updated_at=${result.build.updatedAt}`);
70
+ });
71
+ ios
72
+ .command("logs <buildId>")
73
+ .option("--api <baseUrl>", "API base URL")
74
+ .action(async (buildId, options) => {
75
+ const apiBaseUrl = getApiBaseUrl(options.api);
76
+ const result = await getJson(`${apiBaseUrl}/v1/builds/${buildId}/logs`);
77
+ process.stdout.write(result.logs);
78
+ });
79
+ program.parseAsync(process.argv).catch((error) => {
80
+ console.error(error.message);
81
+ process.exit(1);
82
+ });
83
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":";AACA,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,uBAAuB,CAAC;AACtE,CAAC;AAED,KAAK,UAAU,QAAQ,CAAI,GAAW,EAAE,OAAgB;IACtD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAChC,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;KAC9B,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,CAAC,MAAM,MAAM,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAM,CAAC;AACtC,CAAC;AAED,KAAK,UAAU,OAAO,CAAI,GAAW;IACnC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CA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