@ship-et/buildatlas-cli 0.0.0-stage → 0.11.0

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 (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +81 -2
  3. package/dist/browser-login.d.ts +12 -0
  4. package/dist/browser-login.d.ts.map +1 -0
  5. package/dist/browser-login.js +94 -0
  6. package/dist/browser-login.js.map +1 -0
  7. package/dist/client.d.ts +33 -0
  8. package/dist/client.d.ts.map +1 -0
  9. package/dist/client.js +115 -0
  10. package/dist/client.js.map +1 -0
  11. package/dist/client.test.d.ts +2 -0
  12. package/dist/client.test.d.ts.map +1 -0
  13. package/dist/client.test.js +102 -0
  14. package/dist/client.test.js.map +1 -0
  15. package/dist/commands/auth.d.ts +3 -0
  16. package/dist/commands/auth.d.ts.map +1 -0
  17. package/dist/commands/auth.js +88 -0
  18. package/dist/commands/auth.js.map +1 -0
  19. package/dist/commands/build.d.ts +4 -0
  20. package/dist/commands/build.d.ts.map +1 -0
  21. package/dist/commands/build.js +297 -0
  22. package/dist/commands/build.js.map +1 -0
  23. package/dist/commands/builds.d.ts +3 -0
  24. package/dist/commands/builds.d.ts.map +1 -0
  25. package/dist/commands/builds.js +102 -0
  26. package/dist/commands/builds.js.map +1 -0
  27. package/dist/commands/credentials-wizard.d.ts +25 -0
  28. package/dist/commands/credentials-wizard.d.ts.map +1 -0
  29. package/dist/commands/credentials-wizard.js +274 -0
  30. package/dist/commands/credentials-wizard.js.map +1 -0
  31. package/dist/commands/credentials.d.ts +3 -0
  32. package/dist/commands/credentials.d.ts.map +1 -0
  33. package/dist/commands/credentials.js +249 -0
  34. package/dist/commands/credentials.js.map +1 -0
  35. package/dist/commands/env.d.ts +37 -0
  36. package/dist/commands/env.d.ts.map +1 -0
  37. package/dist/commands/env.js +220 -0
  38. package/dist/commands/env.js.map +1 -0
  39. package/dist/commands/expo-tokens.d.ts +3 -0
  40. package/dist/commands/expo-tokens.d.ts.map +1 -0
  41. package/dist/commands/expo-tokens.js +103 -0
  42. package/dist/commands/expo-tokens.js.map +1 -0
  43. package/dist/commands/init.d.ts +6 -0
  44. package/dist/commands/init.d.ts.map +1 -0
  45. package/dist/commands/init.js +204 -0
  46. package/dist/commands/init.js.map +1 -0
  47. package/dist/commands/projects.d.ts +11 -0
  48. package/dist/commands/projects.d.ts.map +1 -0
  49. package/dist/commands/projects.js +148 -0
  50. package/dist/commands/projects.js.map +1 -0
  51. package/dist/commands/submit.d.ts +10 -0
  52. package/dist/commands/submit.d.ts.map +1 -0
  53. package/dist/commands/submit.js +118 -0
  54. package/dist/commands/submit.js.map +1 -0
  55. package/dist/commands/update.d.ts +10 -0
  56. package/dist/commands/update.d.ts.map +1 -0
  57. package/dist/commands/update.js +93 -0
  58. package/dist/commands/update.js.map +1 -0
  59. package/dist/config.d.ts +66 -0
  60. package/dist/config.d.ts.map +1 -0
  61. package/dist/config.js +255 -0
  62. package/dist/config.js.map +1 -0
  63. package/dist/detach.d.ts +18 -0
  64. package/dist/detach.d.ts.map +1 -0
  65. package/dist/detach.js +42 -0
  66. package/dist/detach.js.map +1 -0
  67. package/dist/eas-credentials-zip.d.ts +38 -0
  68. package/dist/eas-credentials-zip.d.ts.map +1 -0
  69. package/dist/eas-credentials-zip.js +63 -0
  70. package/dist/eas-credentials-zip.js.map +1 -0
  71. package/dist/eas-json.d.ts +21 -0
  72. package/dist/eas-json.d.ts.map +1 -0
  73. package/dist/eas-json.js +32 -0
  74. package/dist/eas-json.js.map +1 -0
  75. package/dist/index.d.ts +3 -0
  76. package/dist/index.d.ts.map +1 -0
  77. package/dist/index.js +67 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/logs.d.ts +13 -0
  80. package/dist/logs.d.ts.map +1 -0
  81. package/dist/logs.js +70 -0
  82. package/dist/logs.js.map +1 -0
  83. package/dist/packaging.test.d.ts +2 -0
  84. package/dist/packaging.test.d.ts.map +1 -0
  85. package/dist/packaging.test.js +79 -0
  86. package/dist/packaging.test.js.map +1 -0
  87. package/dist/profiles.test.d.ts +2 -0
  88. package/dist/profiles.test.d.ts.map +1 -0
  89. package/dist/profiles.test.js +56 -0
  90. package/dist/profiles.test.js.map +1 -0
  91. package/dist/project-hint.d.ts +12 -0
  92. package/dist/project-hint.d.ts.map +1 -0
  93. package/dist/project-hint.js +19 -0
  94. package/dist/project-hint.js.map +1 -0
  95. package/dist/project-type.d.ts +43 -0
  96. package/dist/project-type.d.ts.map +1 -0
  97. package/dist/project-type.js +88 -0
  98. package/dist/project-type.js.map +1 -0
  99. package/dist/project-type.test.d.ts +2 -0
  100. package/dist/project-type.test.d.ts.map +1 -0
  101. package/dist/project-type.test.js +77 -0
  102. package/dist/project-type.test.js.map +1 -0
  103. package/dist/prompt.d.ts +56 -0
  104. package/dist/prompt.d.ts.map +1 -0
  105. package/dist/prompt.js +157 -0
  106. package/dist/prompt.js.map +1 -0
  107. package/dist/tarball.d.ts +39 -0
  108. package/dist/tarball.d.ts.map +1 -0
  109. package/dist/tarball.js +208 -0
  110. package/dist/tarball.js.map +1 -0
  111. package/dist/tarball.test.d.ts +2 -0
  112. package/dist/tarball.test.d.ts.map +1 -0
  113. package/dist/tarball.test.js +97 -0
  114. package/dist/tarball.test.js.map +1 -0
  115. package/package.json +56 -4
@@ -0,0 +1,148 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { join, resolve } from 'node:path';
3
+ import pc from 'picocolors';
4
+ import { AtlasApiError, apiRequest } from '../client.js';
5
+ import { loadConfig, noProjectAdvice, readResolvedAppConfig, resolveProject, } from '../config.js';
6
+ import { reportProject } from '../project-hint.js';
7
+ /**
8
+ * What we can work out from the app itself.
9
+ *
10
+ * Every field a project needs is already sitting in app.json — the slug, both
11
+ * platform identifiers, and the EAS project id that `eas init` wrote. Asking a
12
+ * person to copy four values into a web form is how they end up mistyping the EAS
13
+ * id and then debugging a build failure.
14
+ */
15
+ export function registerProjectCommands(program) {
16
+ const projects = program.command('projects').description('BuildAtlas projects');
17
+ projects
18
+ .command('list')
19
+ .description('List projects you can see')
20
+ .action(async () => {
21
+ await run(async () => {
22
+ const config = await requireAuth();
23
+ const { projects: rows } = await apiRequest(config, '/projects', {
24
+ token: config.token,
25
+ });
26
+ if (rows.length === 0) {
27
+ console.log(pc.dim('No projects yet. Create one with `buildatlas projects create`.'));
28
+ return;
29
+ }
30
+ for (const p of rows) {
31
+ const warn = p.easProjectId ? '' : pc.yellow(' ⚠ no EAS project id — builds will fail');
32
+ console.log(` ${pc.bold(p.slug.padEnd(20))} ${p.name}${p.archivedAt ? pc.dim(' (archived)') : ''}${warn}`);
33
+ }
34
+ });
35
+ });
36
+ projects
37
+ .command('create')
38
+ .description('Create a project, defaulting every field from app.json')
39
+ .option('--slug <slug>', 'URL and CLI identifier. Cannot be changed later')
40
+ .option('--name <name>', 'Display name')
41
+ .option('--eas-project-id <id>', 'Optional. Only used for OTA updates published to Expo\'s CDN; builds never need it')
42
+ .option('--bundle-identifier <id>', 'iOS bundle identifier')
43
+ .option('--android-package <pkg>', 'Android package name')
44
+ .option('--dir <path>', 'Project directory to read app.json from', process.cwd())
45
+ .action(async (opts) => {
46
+ await run(async () => {
47
+ const config = await requireAuth();
48
+ const dir = resolve(opts.dir);
49
+ // Reads a static app.json, or asks Expo's own resolver for a dynamic
50
+ // app.config.js. Costs a few seconds on the dynamic path; saves
51
+ // spelling out four flags.
52
+ const app = (await readResolvedAppConfig(dir)) ?? {};
53
+ const body = {
54
+ slug: opts.slug ?? app.slug,
55
+ name: opts.name ?? app.name ?? opts.slug ?? app.slug,
56
+ easProjectId: opts.easProjectId ?? app.easProjectId,
57
+ bundleIdentifier: opts.bundleIdentifier ?? app.bundleIdentifier,
58
+ androidPackage: opts.androidPackage ?? app.androidPackage,
59
+ };
60
+ if (!body.slug) {
61
+ throw new Error(`No slug.\n${await noProjectAdvice(dir)}`);
62
+ }
63
+ const { project, warning } = await apiRequest(config, '/projects', { method: 'POST', token: config.token, body: JSON.stringify(body) });
64
+ console.log(`${pc.green('✔')} created project ${pc.bold(project.slug)}`);
65
+ console.log(pc.dim(` ios ${project.bundleIdentifier ?? '—'}`));
66
+ console.log(pc.dim(` android ${project.androidPackage ?? '—'}`));
67
+ // Only mentioned when there is one. It used to warn that builds would fail
68
+ // without it, which was true while builds went through `eas build --local`
69
+ // and became false when that stopped being the default — leaving the first
70
+ // thing a new project saw as an instruction to install eas-cli.
71
+ if (project.easProjectId) {
72
+ console.log(pc.dim(` eas ${project.easProjectId}`));
73
+ }
74
+ console.log(pc.dim(`\n commands run from this directory will use "${project.slug}" automatically.`));
75
+ });
76
+ });
77
+ projects
78
+ .command('set')
79
+ .description('Update a project')
80
+ .option('--project <slug>', 'Project slug (default: $BUILDATLAS_PROJECT, else app.json)')
81
+ .option('--name <name>', 'Display name')
82
+ .option('--eas-project-id <id>', 'From `eas init`')
83
+ .option('--bundle-identifier <id>', 'iOS bundle identifier')
84
+ .option('--android-package <pkg>', 'Android package name')
85
+ .action(async (opts) => {
86
+ await run(async () => {
87
+ const config = await requireAuth();
88
+ const resolved = await resolveProject(opts.project);
89
+ reportProject(resolved);
90
+ const slug = resolved.slug;
91
+ const patch = Object.fromEntries(Object.entries({
92
+ name: opts.name,
93
+ easProjectId: opts.easProjectId,
94
+ bundleIdentifier: opts.bundleIdentifier,
95
+ androidPackage: opts.androidPackage,
96
+ }).filter(([, v]) => v !== undefined));
97
+ if (Object.keys(patch).length === 0) {
98
+ throw new Error('Nothing to change. Pass at least one field.');
99
+ }
100
+ const { project, warning } = await apiRequest(config, `/projects/${slug}`, { method: 'PATCH', token: config.token, body: JSON.stringify(patch) });
101
+ console.log(`${pc.green('✔')} updated ${pc.bold(project.slug)}`);
102
+ if (warning)
103
+ console.log(pc.yellow('!'), warning);
104
+ });
105
+ });
106
+ projects
107
+ .command('set-build-number <number>')
108
+ .description('Raise the next build number, for an app that has shipped before')
109
+ .requiredOption('-p, --platform <platform>', 'ios or android')
110
+ .option('--project <slug>', 'Project slug (default: $BUILDATLAS_PROJECT, else app.json)')
111
+ .action(async (number, opts) => {
112
+ await run(async () => {
113
+ const config = await requireAuth();
114
+ if (opts.platform !== 'ios' && opts.platform !== 'android') {
115
+ throw new Error('--platform must be "ios" or "android"');
116
+ }
117
+ const next = Number(number);
118
+ if (!Number.isInteger(next) || next < 1)
119
+ throw new Error('Build number must be a positive integer.');
120
+ const resolved = await resolveProject(opts.project);
121
+ reportProject(resolved);
122
+ const result = await apiRequest(config, `/projects/${resolved.slug}/build-number`, {
123
+ method: 'PATCH',
124
+ token: config.token,
125
+ body: JSON.stringify({ platform: opts.platform, nextBuildNumber: next }),
126
+ });
127
+ console.log(`${pc.green('✔')} ${result.platform} build number: ${result.from} → ${pc.bold(String(result.nextBuildNumber))}`);
128
+ console.log(pc.dim(' The next build will use this number. Set it above whatever the stores have already accepted.'));
129
+ });
130
+ });
131
+ }
132
+ async function requireAuth() {
133
+ const config = await loadConfig();
134
+ if (!config.token)
135
+ throw new Error('Not logged in. Run `buildatlas login` first.');
136
+ return config;
137
+ }
138
+ async function run(fn) {
139
+ try {
140
+ await fn();
141
+ }
142
+ catch (err) {
143
+ const message = err instanceof AtlasApiError ? `${err.message} (${err.code})` : err.message;
144
+ console.error(pc.red('✖'), message);
145
+ process.exitCode = 1;
146
+ }
147
+ }
148
+ //# sourceMappingURL=projects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/commands/projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EACL,UAAU,EACV,eAAe,EACf,qBAAqB,EACrB,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,M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,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,kBAAkB,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAChH,CAAC;YACF,OAAO,CAAC,GAAG,CACT,EAAE,CAAC,GAAG,CAAC,gGAAgG,CAAC,CACzG,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAED,KAAK,UAAU,WAAW;IACxB,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAClC,IAAI,CAAC,MAAM,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IACnF,OAAO,MAA2C,CAAC;AACrD,CAAC;AAED,KAAK,UAAU,GAAG,CAAC,EAAuB;IACxC,IAAI,CAAC;QACH,MAAM,EAAE,EAAE,CAAC;IACb,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,GACX,GAAG,YAAY,aAAa,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,KAAK,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAE,GAAa,CAAC,OAAO,CAAC;QACzF,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;QACpC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * `buildatlas submit <buildId>` — pushes a finished .ipa to TestFlight.
4
+ *
5
+ * Takes a build id rather than inferring the latest build. Submitting is an
6
+ * outward-facing act under the company's Apple team, and "the most recent build"
7
+ * is exactly the kind of guess that puts the wrong binary in front of testers.
8
+ */
9
+ export declare function registerSubmitCommand(program: Command): void;
10
+ //# sourceMappingURL=submit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"submit.d.ts","sourceRoot":"","sources":["../../src/commands/submit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwBzC;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+E5D"}
@@ -0,0 +1,118 @@
1
+ import pc from 'picocolors';
2
+ import { apiRequest } from '../client.js';
3
+ import { loadConfig } from '../config.js';
4
+ const STATUS_COLOR = {
5
+ finished: pc.green,
6
+ errored: pc.red,
7
+ running: pc.cyan,
8
+ pending: pc.dim,
9
+ };
10
+ const colour = (status) => (STATUS_COLOR[status] ?? pc.white)(status);
11
+ /**
12
+ * `buildatlas submit <buildId>` — pushes a finished .ipa to TestFlight.
13
+ *
14
+ * Takes a build id rather than inferring the latest build. Submitting is an
15
+ * outward-facing act under the company's Apple team, and "the most recent build"
16
+ * is exactly the kind of guess that puts the wrong binary in front of testers.
17
+ */
18
+ export function registerSubmitCommand(program) {
19
+ program
20
+ .command('submit <buildId>')
21
+ .description('Upload a finished iOS build to TestFlight')
22
+ .option('--no-wait', 'Queue it and exit instead of following the submission')
23
+ .action(async (buildId, opts) => {
24
+ const config = await loadConfig();
25
+ if (!config.token) {
26
+ console.error(pc.red('✖'), 'Not logged in. Run `buildatlas login` first.');
27
+ process.exitCode = 1;
28
+ return;
29
+ }
30
+ try {
31
+ const { submission } = await apiRequest(config, `/builds/${buildId}/submissions`, { method: 'POST', token: config.token, body: JSON.stringify({ target: 'appstore' }) });
32
+ console.log(`${pc.green('✔')} queued submission ${pc.dim(submission.id)}`);
33
+ if (!opts.wait) {
34
+ console.log(pc.dim(' buildatlas submit-status ' + submission.id));
35
+ return;
36
+ }
37
+ const finished = await follow(config, submission.id);
38
+ if (finished.status === 'finished') {
39
+ console.log(`${pc.green('✔')} accepted by App Store Connect`);
40
+ // Apple takes roughly ten minutes to process before a build appears to
41
+ // testers, and nothing here can shorten that — say so rather than
42
+ // letting someone conclude it failed silently.
43
+ console.log(pc.dim(' Apple still has to process it (usually ~10 minutes) before it shows in TestFlight.'));
44
+ }
45
+ else {
46
+ console.log(`${pc.red('✖')} ${finished.errorMessage ?? 'submission failed'}`);
47
+ console.log(pc.dim(` full log: buildatlas submit-log ${finished.id}`));
48
+ process.exitCode = 1;
49
+ }
50
+ }
51
+ catch (err) {
52
+ console.error(pc.red('✖'), err.message);
53
+ process.exitCode = 1;
54
+ }
55
+ });
56
+ program
57
+ .command('submit-status <submissionId>')
58
+ .description('Show a submission')
59
+ .action(async (submissionId) => {
60
+ const config = await loadConfig();
61
+ try {
62
+ const found = await findSubmission(config, submissionId);
63
+ console.log(` ${colour(found.status)} ${found.target} ${pc.dim(found.createdAt)}`);
64
+ if (found.errorMessage)
65
+ console.log(` ${pc.red(found.errorMessage)}`);
66
+ }
67
+ catch (err) {
68
+ console.error(pc.red('✖'), err.message);
69
+ process.exitCode = 1;
70
+ }
71
+ });
72
+ program
73
+ .command('submit-log <submissionId>')
74
+ .description("Print the archived submission log — App Store Connect's own reply")
75
+ .action(async (submissionId) => {
76
+ const config = await loadConfig();
77
+ try {
78
+ const text = await apiRequest(config, `/submissions/${submissionId}/log`, {
79
+ token: config.token,
80
+ raw: true,
81
+ });
82
+ process.stdout.write(text);
83
+ }
84
+ catch (err) {
85
+ console.error(pc.red('✖'), err.message);
86
+ process.exitCode = 1;
87
+ }
88
+ });
89
+ }
90
+ /**
91
+ * Polls until the submission settles.
92
+ *
93
+ * Polling rather than SSE: a submission has no live log stream — the output is
94
+ * captured and archived in one piece when it finishes, because fastlane's upload
95
+ * produces almost nothing until it is done and there is no phase tree to show.
96
+ */
97
+ async function follow(config, submissionId) {
98
+ let last = '';
99
+ for (;;) {
100
+ const found = await findSubmission(config, submissionId);
101
+ if (found.status !== last) {
102
+ console.log(` ${colour(found.status)}`);
103
+ last = found.status;
104
+ }
105
+ if (found.status === 'finished' || found.status === 'errored')
106
+ return found;
107
+ await new Promise((r) => setTimeout(r, 5_000));
108
+ }
109
+ }
110
+ /**
111
+ * Submissions are addressed under their build, so finding one by its own id means
112
+ * asking the build. The id is enough because the caller just created it.
113
+ */
114
+ async function findSubmission(config, submissionId) {
115
+ const { submission } = await apiRequest(config, `/submissions/${submissionId}`, { token: config.token });
116
+ return submission;
117
+ }
118
+ //# sourceMappingURL=submit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"submit.js","sourceRoot":"","sources":["../../src/commands/submit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAY1C,MAAM,YAAY,GAA0C;IAC1D,QAAQ,EAAE,EAAE,CAAC,KAAK;IAClB,OAAO,EAAE,EAAE,CAAC,GAAG;IACf,OAAO,EAAE,EAAE,CAAC,IAAI;IAChB,OAAO,EAAE,EAAE,CAAC,GAAG;CAChB,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtF;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,OAAO;SACJ,OAAO,CAAC,kBAAkB,CAAC;SAC3B,WAAW,CAAC,2CAA2C,CAAC;SACxD,MAAM,CAAC,WAAW,EAAE,uDAAuD,CAAC;SAC5E,MAAM,CAAC,KAAK,EAAE,OAAe,EAAE,IAAuB,EAAE,EAAE;QACzD,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAClB,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,8CAA8C,CAAC,CAAC;YAC3E,OAAO,CAAC,QAAQ,GAAG,CAAC,CA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EACN,gBAAgB,YAAY,EAAE,EAC9B,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CACxB,CAAC;IACF,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Publishes an OTA update.
4
+ *
5
+ * Same shape as `buildatlas build`: pack the working tree, upload, enqueue. The worker
6
+ * drives `eoas publish` against our own update server, so the bundle never
7
+ * touches Expo's CDN.
8
+ */
9
+ export declare function registerUpdateCommand(program: Command): void;
10
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAezC;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyF5D"}
@@ -0,0 +1,93 @@
1
+ import { createReadStream } from 'node:fs';
2
+ import { execFile } from 'node:child_process';
3
+ import { resolve } from 'node:path';
4
+ import { promisify } from 'node:util';
5
+ import pc from 'picocolors';
6
+ import { AtlasApiError, apiRequest } from '../client.js';
7
+ import { reportProject } from '../project-hint.js';
8
+ import { loadConfig, resolveProject } from '../config.js';
9
+ import { packProject } from '../tarball.js';
10
+ const exec = promisify(execFile);
11
+ /**
12
+ * Publishes an OTA update.
13
+ *
14
+ * Same shape as `buildatlas build`: pack the working tree, upload, enqueue. The worker
15
+ * drives `eoas publish` against our own update server, so the bundle never
16
+ * touches Expo's CDN.
17
+ */
18
+ export function registerUpdateCommand(program) {
19
+ program
20
+ .command('update')
21
+ .description('Publish an OTA update (JavaScript and assets only)')
22
+ .requiredOption('-b, --branch <branch>', 'Update branch, e.g. production')
23
+ .option('-p, --platform <platform>', 'Limit to ios or android')
24
+ .option('-m, --message <message>', 'Short description shown in the dashboard')
25
+ .option('--project <slug>', 'Project slug (default: $BUILDATLAS_PROJECT, else app.json)')
26
+ .option('--dir <path>', 'Project directory', process.cwd())
27
+ .action(async (opts) => {
28
+ try {
29
+ const config = await loadConfig();
30
+ if (!config.token)
31
+ throw new Error('Not logged in. Run `buildatlas login` first.');
32
+ const resolved = await resolveProject(opts.project, resolve(opts.dir));
33
+ const slug = resolved.slug;
34
+ reportProject(resolved);
35
+ if (opts.platform && opts.platform !== 'ios' && opts.platform !== 'android') {
36
+ throw new Error('--platform must be "ios" or "android"');
37
+ }
38
+ const projectDir = resolve(opts.dir);
39
+ const git = async (args) => {
40
+ try {
41
+ return (await exec('git', args, { cwd: projectDir })).stdout.trim();
42
+ }
43
+ catch {
44
+ return undefined;
45
+ }
46
+ };
47
+ process.stdout.write(pc.dim('packing project… '));
48
+ const tarball = await packProject(projectDir);
49
+ console.log(pc.dim(`${(tarball.sizeBytes / 1024 / 1024).toFixed(1)} MB`));
50
+ try {
51
+ const { update, uploadUrl } = await apiRequest(config, `/projects/${slug}/updates`, {
52
+ method: 'POST',
53
+ token: config.token,
54
+ body: JSON.stringify({
55
+ branch: opts.branch,
56
+ platform: opts.platform,
57
+ message: opts.message,
58
+ gitSha: await git(['rev-parse', 'HEAD']),
59
+ gitRef: await git(['rev-parse', '--abbrev-ref', 'HEAD']),
60
+ }),
61
+ });
62
+ process.stdout.write(pc.dim('uploading source… '));
63
+ const res = await fetch(uploadUrl, {
64
+ method: 'PUT',
65
+ body: createReadStream(tarball.path),
66
+ duplex: 'half',
67
+ headers: {
68
+ 'content-type': 'application/gzip',
69
+ 'content-length': String(tarball.sizeBytes),
70
+ },
71
+ });
72
+ if (!res.ok)
73
+ throw new Error(`Source upload failed: ${res.status}`);
74
+ console.log(pc.dim('done'));
75
+ await apiRequest(config, `/updates/${update.id}/enqueue`, {
76
+ method: 'POST',
77
+ token: config.token,
78
+ });
79
+ console.log(`${pc.green('✔')} update queued on branch ${pc.bold(opts.branch)} (${update.id.slice(0, 8)})`);
80
+ console.log(pc.dim(' native changes still need `buildatlas build`.'));
81
+ }
82
+ finally {
83
+ await tarball.cleanup();
84
+ }
85
+ }
86
+ catch (err) {
87
+ const message = err instanceof AtlasApiError ? `${err.message} (${err.code})` : err.message;
88
+ console.error(pc.red('✖'), message);
89
+ process.exitCode = 1;
90
+ }
91
+ });
92
+ }
93
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAQjC;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,oDAAoD,CAAC;SACjE,cAAc,CAAC,uBAAuB,EAAE,gCAAgC,CAAC;SACzE,MAAM,CAAC,2BAA2B,EAAE,yBAAyB,CAAC;SAC9D,MAAM,CAAC,yBAAyB,EAAE,0CAA0C,CAAC;SAC7E,MAAM,CAAC,kBAAkB,EAAE,4DAA4D,CAAC;SACxF,MAAM,CAAC,cAAc,EAAE,mBAAmB,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;SAC1D,MAAM,CACL,KAAK,EAAE,IA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,EAAE,MAAM,CAAC,KAAK;iBACpB,CAAC,CAAC;gBACH,OAAO,CAAC,GAAG,CACT,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,4BAA4B,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAC9F,CAAC;gBACF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC,CAAC;YACzE,CAAC;oBAAS,CAAC;gBACT,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;YAC1B,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GACX,GAAG,YAAY,aAAa,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,KAAK,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAE,GAAa,CAAC,OAAO,CAAC;YACzF,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;YACpC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CACF,CAAC;AACN,CAAC"}
@@ -0,0 +1,66 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The instance this CLI ships pointed at, so a first-time user does not have to type a
4
+ * URL. Overridden by a stored login, `--api`, or BUILDATLAS_API_URL — this is only the
5
+ * fallback when nothing else says otherwise. Baked at publish via BUILDATLAS_DEFAULT_API_URL
6
+ * for a differently-hosted build.
7
+ */
8
+ export declare const DEFAULT_API_URL: string;
9
+ /**
10
+ * Credentials live in ~/.buildatlas/auth.json at mode 0600. Env vars win over the
11
+ * file so CI can inject a token without writing to disk.
12
+ */
13
+ declare const configSchema: z.ZodObject<{
14
+ apiUrl: z.ZodDefault<z.ZodString>;
15
+ token: z.ZodOptional<z.ZodString>;
16
+ email: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strip>;
18
+ export type AtlasConfig = z.infer<typeof configSchema>;
19
+ export declare const configPath: () => string;
20
+ /**
21
+ * The API URL that was actually stored, as opposed to the localhost default.
22
+ *
23
+ * `login` needs the distinction: someone who installed this from npm and runs
24
+ * `buildatlas login` with no `--api` should be asked where their server is, not
25
+ * quietly pointed at localhost and then shown a connection error.
26
+ */
27
+ export declare function storedApiUrl(): Promise<string | undefined>;
28
+ export declare function loadConfig(): Promise<AtlasConfig>;
29
+ export declare function saveConfig(config: AtlasConfig): Promise<void>;
30
+ /**
31
+ * The project slug from the environment.
32
+ *
33
+ * BUILDATLAS_PROJECT is the current spelling; ATLAS_PROJECT is still honoured so
34
+ * CI jobs written before the CLI was renamed keep working.
35
+ */
36
+ export declare function defaultProject(): string | undefined;
37
+ export interface ResolvedProject {
38
+ slug: string;
39
+ /** Where the slug came from. Reported when it was inferred, not stated. */
40
+ source: 'flag' | 'env' | 'config' | 'app.json' | 'app.config.js';
41
+ }
42
+ export interface ExpoConfigValues {
43
+ slug?: string;
44
+ name?: string;
45
+ version?: string;
46
+ owner?: string;
47
+ easProjectId?: string;
48
+ bundleIdentifier?: string;
49
+ androidPackage?: string;
50
+ /** Which dynamic config file was evaluated, for reporting. */
51
+ fromDynamicConfig?: string;
52
+ }
53
+ /** Everything a caller might want from the app config, static or dynamic. */
54
+ export declare function readResolvedAppConfig(dir: string): Promise<ExpoConfigValues | undefined>;
55
+ export declare function resolveProject(explicit: string | undefined, dir?: string): Promise<ResolvedProject>;
56
+ /**
57
+ * What to tell someone whose directory has no usable static config.
58
+ *
59
+ * Shared so `build`, `projects create` and everything else give the same answer,
60
+ * and so the two genuinely different causes get genuinely different advice: a
61
+ * dynamic config, which we will not evaluate, versus an app that lives in a
62
+ * subdirectory.
63
+ */
64
+ export declare function noProjectAdvice(dir: string): Promise<string>;
65
+ export {};
66
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config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