@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.
- package/LICENSE +21 -0
- package/README.md +81 -2
- package/dist/browser-login.d.ts +12 -0
- package/dist/browser-login.d.ts.map +1 -0
- package/dist/browser-login.js +94 -0
- package/dist/browser-login.js.map +1 -0
- package/dist/client.d.ts +33 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +115 -0
- package/dist/client.js.map +1 -0
- package/dist/client.test.d.ts +2 -0
- package/dist/client.test.d.ts.map +1 -0
- package/dist/client.test.js +102 -0
- package/dist/client.test.js.map +1 -0
- package/dist/commands/auth.d.ts +3 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +88 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/build.d.ts +4 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +297 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/builds.d.ts +3 -0
- package/dist/commands/builds.d.ts.map +1 -0
- package/dist/commands/builds.js +102 -0
- package/dist/commands/builds.js.map +1 -0
- package/dist/commands/credentials-wizard.d.ts +25 -0
- package/dist/commands/credentials-wizard.d.ts.map +1 -0
- package/dist/commands/credentials-wizard.js +274 -0
- package/dist/commands/credentials-wizard.js.map +1 -0
- package/dist/commands/credentials.d.ts +3 -0
- package/dist/commands/credentials.d.ts.map +1 -0
- package/dist/commands/credentials.js +249 -0
- package/dist/commands/credentials.js.map +1 -0
- package/dist/commands/env.d.ts +37 -0
- package/dist/commands/env.d.ts.map +1 -0
- package/dist/commands/env.js +220 -0
- package/dist/commands/env.js.map +1 -0
- package/dist/commands/expo-tokens.d.ts +3 -0
- package/dist/commands/expo-tokens.d.ts.map +1 -0
- package/dist/commands/expo-tokens.js +103 -0
- package/dist/commands/expo-tokens.js.map +1 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +204 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/projects.d.ts +11 -0
- package/dist/commands/projects.d.ts.map +1 -0
- package/dist/commands/projects.js +148 -0
- package/dist/commands/projects.js.map +1 -0
- package/dist/commands/submit.d.ts +10 -0
- package/dist/commands/submit.d.ts.map +1 -0
- package/dist/commands/submit.js +118 -0
- package/dist/commands/submit.js.map +1 -0
- package/dist/commands/update.d.ts +10 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +93 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/config.d.ts +66 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +255 -0
- package/dist/config.js.map +1 -0
- package/dist/detach.d.ts +18 -0
- package/dist/detach.d.ts.map +1 -0
- package/dist/detach.js +42 -0
- package/dist/detach.js.map +1 -0
- package/dist/eas-credentials-zip.d.ts +38 -0
- package/dist/eas-credentials-zip.d.ts.map +1 -0
- package/dist/eas-credentials-zip.js +63 -0
- package/dist/eas-credentials-zip.js.map +1 -0
- package/dist/eas-json.d.ts +21 -0
- package/dist/eas-json.d.ts.map +1 -0
- package/dist/eas-json.js +32 -0
- package/dist/eas-json.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +67 -0
- package/dist/index.js.map +1 -0
- package/dist/logs.d.ts +13 -0
- package/dist/logs.d.ts.map +1 -0
- package/dist/logs.js +70 -0
- package/dist/logs.js.map +1 -0
- package/dist/packaging.test.d.ts +2 -0
- package/dist/packaging.test.d.ts.map +1 -0
- package/dist/packaging.test.js +79 -0
- package/dist/packaging.test.js.map +1 -0
- package/dist/profiles.test.d.ts +2 -0
- package/dist/profiles.test.d.ts.map +1 -0
- package/dist/profiles.test.js +56 -0
- package/dist/profiles.test.js.map +1 -0
- package/dist/project-hint.d.ts +12 -0
- package/dist/project-hint.d.ts.map +1 -0
- package/dist/project-hint.js +19 -0
- package/dist/project-hint.js.map +1 -0
- package/dist/project-type.d.ts +43 -0
- package/dist/project-type.d.ts.map +1 -0
- package/dist/project-type.js +88 -0
- package/dist/project-type.js.map +1 -0
- package/dist/project-type.test.d.ts +2 -0
- package/dist/project-type.test.d.ts.map +1 -0
- package/dist/project-type.test.js +77 -0
- package/dist/project-type.test.js.map +1 -0
- package/dist/prompt.d.ts +56 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +157 -0
- package/dist/prompt.js.map +1 -0
- package/dist/tarball.d.ts +39 -0
- package/dist/tarball.d.ts.map +1 -0
- package/dist/tarball.js +208 -0
- package/dist/tarball.js.map +1 -0
- package/dist/tarball.test.d.ts +2 -0
- package/dist/tarball.test.d.ts.map +1 -0
- package/dist/tarball.test.js +97 -0
- package/dist/tarball.test.js.map +1 -0
- package/package.json +56 -4
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { createReadStream } from 'node:fs';
|
|
3
|
+
import { readFile } from 'node:fs/promises';
|
|
4
|
+
import { join, resolve } from 'node:path';
|
|
5
|
+
import { promisify } from 'node:util';
|
|
6
|
+
import pc from 'picocolors';
|
|
7
|
+
import { AtlasApiError, apiRequest } from '../client.js';
|
|
8
|
+
import { reportProject } from '../project-hint.js';
|
|
9
|
+
import { loadConfig, resolveProject } from '../config.js';
|
|
10
|
+
import { detachOnInterrupt } from '../detach.js';
|
|
11
|
+
import { LARGE_UPLOAD_BYTES, packProject } from '../tarball.js';
|
|
12
|
+
import { streamLogs } from '../logs.js';
|
|
13
|
+
import { seedEnvFromEasJson } from './env.js';
|
|
14
|
+
import { detectProjectType } from '../project-type.js';
|
|
15
|
+
import { readShape } from './init.js';
|
|
16
|
+
const exec = promisify(execFile);
|
|
17
|
+
async function gitInfo(cwd) {
|
|
18
|
+
const run = async (args) => {
|
|
19
|
+
try {
|
|
20
|
+
return (await exec('git', args, { cwd })).stdout.trim();
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const [sha, ref, status, subject] = await Promise.all([
|
|
27
|
+
run(['rev-parse', 'HEAD']),
|
|
28
|
+
run(['rev-parse', '--abbrev-ref', 'HEAD']),
|
|
29
|
+
run(['status', '--porcelain']),
|
|
30
|
+
// %s is the subject line only; a full body would flood the build list.
|
|
31
|
+
run(['log', '-1', '--pretty=%s']),
|
|
32
|
+
]);
|
|
33
|
+
// Recording dirtiness matters: it is the difference between "this artifact is
|
|
34
|
+
// reproducible from a commit" and "this came off somebody's laptop".
|
|
35
|
+
return {
|
|
36
|
+
gitSha: sha,
|
|
37
|
+
gitRef: ref,
|
|
38
|
+
gitDirty: status === undefined ? undefined : status.length > 0,
|
|
39
|
+
gitCommitMessage: subject,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Checks the profile exists before uploading anything.
|
|
44
|
+
*
|
|
45
|
+
* Reads buildatlas.json first, then eas.json — the same order the server uses. It only
|
|
46
|
+
* looked at eas.json, so a native Android or iOS project with a perfectly good
|
|
47
|
+
* buildatlas.json was told "No eas.json in this directory", which is both wrong and
|
|
48
|
+
* points at a file it should not need: supporting projects that have never touched EAS
|
|
49
|
+
* is the reason buildatlas.json exists.
|
|
50
|
+
*
|
|
51
|
+
* Neither file is an error only if the profile is not a known default. With no config at
|
|
52
|
+
* all the server falls back to built-in profiles, and refusing here would block the
|
|
53
|
+
* zero-configuration case that is supposed to just work.
|
|
54
|
+
*/
|
|
55
|
+
const DEFAULT_PROFILE_NAMES = ['development', 'preview', 'production'];
|
|
56
|
+
export async function assertProfileExists(projectDir, profile) {
|
|
57
|
+
const read = async (name) => {
|
|
58
|
+
try {
|
|
59
|
+
const parsed = JSON.parse(await readFile(join(projectDir, name), 'utf8'));
|
|
60
|
+
return Object.keys(parsed.build ?? {});
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const fromBuildAtlas = await read('buildatlas.json');
|
|
67
|
+
const available = fromBuildAtlas ?? (await read('eas.json'));
|
|
68
|
+
const source = fromBuildAtlas ? 'buildatlas.json' : 'eas.json';
|
|
69
|
+
if (!available) {
|
|
70
|
+
// No config of any kind. Fine, as long as the profile is one the server defaults to.
|
|
71
|
+
if (DEFAULT_PROFILE_NAMES.includes(profile))
|
|
72
|
+
return;
|
|
73
|
+
throw new Error(`No buildatlas.json or eas.json here, and "${profile}" is not a built-in profile ` +
|
|
74
|
+
`(${DEFAULT_PROFILE_NAMES.join(', ')}). Run \`buildatlas init\` to write one, or ` +
|
|
75
|
+
'run this from your project root.');
|
|
76
|
+
}
|
|
77
|
+
if (!available.includes(profile)) {
|
|
78
|
+
// Fail here rather than after a multi-megabyte upload and a queue wait.
|
|
79
|
+
throw new Error(`Build profile "${profile}" is not in ${source}. Available: ${available.join(', ') || '(none)'}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export function registerBuildCommand(program) {
|
|
83
|
+
program
|
|
84
|
+
.command('build')
|
|
85
|
+
.description('Queue a build of the current project')
|
|
86
|
+
.requiredOption('-p, --platform <platform>', 'ios or android')
|
|
87
|
+
.option('-e, --profile <profile>', 'eas.json build profile', 'production')
|
|
88
|
+
.option('--project <slug>', 'BuildAtlas project slug (default: $BUILDATLAS_PROJECT, else app.json)')
|
|
89
|
+
.option('--dir <path>', 'Project directory', process.cwd())
|
|
90
|
+
.option('--no-wait', 'Return as soon as the build is queued')
|
|
91
|
+
.option('--retain-workdir', 'Keep the build directory on the runner for debugging')
|
|
92
|
+
// Negated, because native is the default now. Commander gives `opts.local` the
|
|
93
|
+
// value true unless --no-local is passed, so the flag reads the way it behaves.
|
|
94
|
+
.option('--no-local', 'Build with the legacy eas-cli strategy instead of driving Xcode and Gradle directly. Needs an Expo account and an eas.json.')
|
|
95
|
+
.option('--build-number <n>', 'Use this exact build number, ignoring the descriptor and the counter. For when a store has already taken the next one.')
|
|
96
|
+
.option('--app-version <version>', 'Use this marketing version (CFBundleShortVersionString / versionName) instead of the one in your app config.')
|
|
97
|
+
.option('--ios-signer <tool>', 'For a signed iOS --local build: "xcodebuild" (default) or "fastlane" (gym). Same signing setup either way; they differ in which tool archives and exports, and in how they fail.')
|
|
98
|
+
.action(async (opts) => {
|
|
99
|
+
try {
|
|
100
|
+
await runBuild(opts);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
const message = err instanceof AtlasApiError ? `${err.message} (${err.code})` : err.message;
|
|
104
|
+
console.error(pc.red('✖'), message);
|
|
105
|
+
process.exitCode = 1;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* This project's type, as the CLI sees it.
|
|
111
|
+
*
|
|
112
|
+
* Best-effort on purpose: detection throwing (an empty directory, an unreadable
|
|
113
|
+
* package.json) must not stop a build that the server would have been able to type
|
|
114
|
+
* itself. An explicit `projectType` in buildatlas.json wins, because that is what it
|
|
115
|
+
* is for.
|
|
116
|
+
*/
|
|
117
|
+
async function detectedProjectType(projectDir) {
|
|
118
|
+
try {
|
|
119
|
+
const descriptor = JSON.parse(await readFile(join(projectDir, 'buildatlas.json'), 'utf8'));
|
|
120
|
+
if (descriptor.projectType)
|
|
121
|
+
return { projectType: descriptor.projectType };
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
// No descriptor, or not readable. Fall through to detection.
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
return { projectType: detectProjectType(await readShape(projectDir)).type };
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
return {};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
async function runBuild(opts) {
|
|
134
|
+
if (opts.platform !== 'ios' && opts.platform !== 'android') {
|
|
135
|
+
throw new Error('--platform must be "ios" or "android"');
|
|
136
|
+
}
|
|
137
|
+
const config = await loadConfig();
|
|
138
|
+
if (!config.token)
|
|
139
|
+
throw new Error('Not logged in. Run `buildatlas login` first.');
|
|
140
|
+
const projectDir = resolve(opts.dir);
|
|
141
|
+
// Resolved against the same directory the source is packed from, so --dir moves
|
|
142
|
+
// both together and they cannot disagree.
|
|
143
|
+
const resolved = await resolveProject(opts.project, projectDir);
|
|
144
|
+
reportProject(resolved);
|
|
145
|
+
const slug = resolved.slug;
|
|
146
|
+
await assertProfileExists(projectDir, opts.profile);
|
|
147
|
+
if (opts.iosSigner && opts.iosSigner !== 'xcodebuild' && opts.iosSigner !== 'fastlane') {
|
|
148
|
+
throw new Error('--ios-signer must be "xcodebuild" or "fastlane"');
|
|
149
|
+
}
|
|
150
|
+
if (opts.iosSigner && !opts.local) {
|
|
151
|
+
// It is only consulted by the native strategy, so accepting it silently here
|
|
152
|
+
// would look like it had been applied.
|
|
153
|
+
throw new Error('--ios-signer does not apply to a --no-local build. eas-cli does its own signing.');
|
|
154
|
+
}
|
|
155
|
+
if (opts.buildNumber !== undefined) {
|
|
156
|
+
const n = Number(opts.buildNumber);
|
|
157
|
+
// Checked before a tarball is uploaded: a rejected build number after a
|
|
158
|
+
// ten-minute build is the failure this flag exists to avoid.
|
|
159
|
+
if (!Number.isInteger(n) || n < 1) {
|
|
160
|
+
throw new Error('--build-number must be a positive whole number.');
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (opts.iosSigner && opts.platform !== 'ios') {
|
|
164
|
+
throw new Error('--ios-signer only applies to --platform ios.');
|
|
165
|
+
}
|
|
166
|
+
if (opts.local) {
|
|
167
|
+
// Best-effort: a native build's actual env still comes from the worker
|
|
168
|
+
// reading eas.json directly, so a failure here (e.g. a non-admin token —
|
|
169
|
+
// setting env requires admin) must never block the build itself.
|
|
170
|
+
try {
|
|
171
|
+
const { added } = await seedEnvFromEasJson({
|
|
172
|
+
config,
|
|
173
|
+
slug,
|
|
174
|
+
projectDir,
|
|
175
|
+
profile: opts.profile,
|
|
176
|
+
overwrite: false,
|
|
177
|
+
});
|
|
178
|
+
if (added.length) {
|
|
179
|
+
console.log(pc.dim(`seeded env from eas.json: ${added.join(', ')}`));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
catch (err) {
|
|
183
|
+
console.log(pc.dim(`(could not seed dashboard env vars from eas.json: ${err.message})`));
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
process.stdout.write(pc.dim('packing project… '));
|
|
187
|
+
const tarball = await packProject(projectDir);
|
|
188
|
+
console.log(pc.dim(`${(tarball.sizeBytes / 1024 / 1024).toFixed(1)} MB`));
|
|
189
|
+
// An oversized upload is invisible exactly when it matters. A Flutter app shipped
|
|
190
|
+
// 1,175 MB and the only symptom was a build that sat in "Fetch source" for an hour and
|
|
191
|
+
// sixteen minutes — on a link from Addis, uphill both ways, for a two-minute build.
|
|
192
|
+
// Said here, before the upload, where it is still cheap to fix.
|
|
193
|
+
if (tarball.sizeBytes > LARGE_UPLOAD_BYTES) {
|
|
194
|
+
console.log(pc.yellow('!'), `That is a large upload. It is sent to storage now and downloaded again by the runner,\n so it is paid for twice on every build.`);
|
|
195
|
+
for (const entry of tarball.largest) {
|
|
196
|
+
console.log(pc.dim(` ${(entry.bytes / 1024 / 1024).toFixed(0)} MB ${entry.path}`));
|
|
197
|
+
}
|
|
198
|
+
console.log(pc.dim(' Anything here that is build output rather than source belongs in .easignore\n' +
|
|
199
|
+
' (or .gitignore) — the runner rebuilds it from scratch regardless.'));
|
|
200
|
+
}
|
|
201
|
+
// Said before the build starts, not after it fails ten minutes later. The runner
|
|
202
|
+
// cannot detect this — from its side the file simply does not exist.
|
|
203
|
+
for (const name of tarball.excludedButRelevant) {
|
|
204
|
+
console.log(pc.yellow('!'), `${name} is excluded by your ignore rules, so the runner will not see it.`);
|
|
205
|
+
console.log(pc.dim(` It affects how dependencies install. If it holds no secrets, add "!${name}" to ` +
|
|
206
|
+
'.easignore so it is uploaded.'));
|
|
207
|
+
}
|
|
208
|
+
try {
|
|
209
|
+
const git = await gitInfo(projectDir);
|
|
210
|
+
const { build, uploadUrl } = await apiRequest(config, `/projects/${slug}/builds`, {
|
|
211
|
+
method: 'POST',
|
|
212
|
+
token: config.token,
|
|
213
|
+
body: JSON.stringify({
|
|
214
|
+
platform: opts.platform,
|
|
215
|
+
profile: opts.profile,
|
|
216
|
+
strategy: opts.local ? 'native' : 'eas-local',
|
|
217
|
+
...(opts.iosSigner ? { iosSigner: opts.iosSigner } : {}),
|
|
218
|
+
...(opts.buildNumber ? { buildNumber: Number(opts.buildNumber) } : {}),
|
|
219
|
+
...(opts.appVersion ? { appVersion: opts.appVersion } : {}),
|
|
220
|
+
sourceSha256: tarball.sha256,
|
|
221
|
+
retainWorkdir: opts.retainWorkdir ?? false,
|
|
222
|
+
// Sent so the server can route the build while it is still queued: a Flutter
|
|
223
|
+
// build is only buildable on a runner with the Flutter SDK, and nothing looks
|
|
224
|
+
// at the source until a runner has already claimed it. Advisory — the worker
|
|
225
|
+
// reads the tree itself and corrects this.
|
|
226
|
+
...(await detectedProjectType(projectDir)),
|
|
227
|
+
...git,
|
|
228
|
+
}),
|
|
229
|
+
});
|
|
230
|
+
console.log(`${pc.green('✔')} build ${pc.bold(build.id)} created · ${build.platform} · ${build.profile} · build number ${build.buildNumber}`);
|
|
231
|
+
process.stdout.write(pc.dim('uploading source… '));
|
|
232
|
+
await uploadTarball(uploadUrl, tarball.path, tarball.sizeBytes);
|
|
233
|
+
console.log(pc.dim('done'));
|
|
234
|
+
// Retried, unlike the create above: the build row and its source already exist,
|
|
235
|
+
// and enqueueing it twice queues the same build. Losing this call after a source
|
|
236
|
+
// upload that took minutes leaves a build that exists and will never run.
|
|
237
|
+
await apiRequest(config, `/builds/${build.id}/enqueue`, {
|
|
238
|
+
method: 'POST',
|
|
239
|
+
token: config.token,
|
|
240
|
+
retry: 'safe',
|
|
241
|
+
});
|
|
242
|
+
console.log(`${pc.green('✔')} queued`);
|
|
243
|
+
if (!opts.wait) {
|
|
244
|
+
console.log(pc.dim(`follow with: buildatlas logs ${build.id}`));
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
// From here the build exists server-side, so Ctrl-C must detach rather than
|
|
248
|
+
// silently exit and look like a cancellation.
|
|
249
|
+
const stopDetaching = detachOnInterrupt(build.id);
|
|
250
|
+
try {
|
|
251
|
+
const finalStatus = await streamLogs(config, build.id);
|
|
252
|
+
if (finalStatus !== 'finished')
|
|
253
|
+
process.exitCode = 1;
|
|
254
|
+
}
|
|
255
|
+
finally {
|
|
256
|
+
stopDetaching();
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
finally {
|
|
260
|
+
// The tarball is a temp file; leaving copies of source archives in /tmp on
|
|
261
|
+
// every developer's laptop is not acceptable.
|
|
262
|
+
await tarball.cleanup();
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
async function uploadTarball(url, path, size) {
|
|
266
|
+
// The host comes from the server's presigned URL, not from our own config, so
|
|
267
|
+
// when it is unreachable the useful thing to report is which host that was.
|
|
268
|
+
// Bare "fetch failed" sends people looking at their own network.
|
|
269
|
+
const host = (() => {
|
|
270
|
+
try {
|
|
271
|
+
return new URL(url).host;
|
|
272
|
+
}
|
|
273
|
+
catch {
|
|
274
|
+
return url;
|
|
275
|
+
}
|
|
276
|
+
})();
|
|
277
|
+
let res;
|
|
278
|
+
try {
|
|
279
|
+
res = await fetch(url, {
|
|
280
|
+
method: 'PUT',
|
|
281
|
+
// A Node ReadableStream body requires duplex: 'half'; without it fetch
|
|
282
|
+
// refuses to stream and would buffer the whole archive in memory.
|
|
283
|
+
body: createReadStream(path),
|
|
284
|
+
duplex: 'half',
|
|
285
|
+
headers: { 'content-type': 'application/gzip', 'content-length': String(size) },
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
catch (err) {
|
|
289
|
+
throw new Error(`Could not reach object storage at ${host} to upload the source (${err.message}).\n` +
|
|
290
|
+
' The server hands out this address, so it has to be reachable from here.\n' +
|
|
291
|
+
' If BuildAtlas is on another machine, set S3_PUBLIC_URL on the server to an address this one can reach.');
|
|
292
|
+
}
|
|
293
|
+
if (!res.ok) {
|
|
294
|
+
throw new Error(`Source upload to ${host} failed: ${res.status} ${res.statusText}`);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,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,EAAoB,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAYjC,KAAK,UAAU,OAAO,CAAC,GAAW;IAChC,MAAM,GAAG,GAAG,KAAK,EAAE,IAAc,EAAE,EAAE;QACnC,IAAI,CAAC;YACH,OAAO,CAAC,MAA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AAC;IACH,CAAC,CAAC,EAAE,CAAC;IAEL,IAAI,GAAa,CAAC;IAClB,IAAI,CAAC;QACH,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YACvB,MAAM,EAAE,KAAK;YACb,uEAAuE;YACvE,kEAAkE;YAClE,IAAI,EAAE,gBAAgB,CAAC,IAAI,CAA8B;YACzD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE;SAC1C,CAAC,CAAC;IACzC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,qCAAqC,IAAI,0BAA2B,GAAa,CAAC,OAAO,MAAM;YAC7F,6EAA6E;YAC7E,0GAA0G,CAC7G,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,YAAY,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;IACtF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builds.d.ts","sourceRoot":"","sources":["../../src/commands/builds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmDzC,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8EjE"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import pc from 'picocolors';
|
|
2
|
+
import { AtlasApiError, apiRequest } from '../client.js';
|
|
3
|
+
import { reportProject } from '../project-hint.js';
|
|
4
|
+
import { loadConfig, resolveProject } from '../config.js';
|
|
5
|
+
import { detachOnInterrupt } from '../detach.js';
|
|
6
|
+
import { streamLogs } from '../logs.js';
|
|
7
|
+
const STATUS_COLOR = {
|
|
8
|
+
finished: pc.green,
|
|
9
|
+
errored: pc.red,
|
|
10
|
+
canceled: pc.yellow,
|
|
11
|
+
running: pc.cyan,
|
|
12
|
+
queued: pc.blue,
|
|
13
|
+
pending: pc.dim,
|
|
14
|
+
};
|
|
15
|
+
const colorStatus = (status) => (STATUS_COLOR[status] ?? pc.white)(status.padEnd(8));
|
|
16
|
+
function duration(from, to) {
|
|
17
|
+
if (!to)
|
|
18
|
+
return '—';
|
|
19
|
+
const seconds = Math.round((new Date(to).getTime() - new Date(from).getTime()) / 1000);
|
|
20
|
+
return seconds < 60 ? `${seconds}s` : `${Math.floor(seconds / 60)}m${String(seconds % 60).padStart(2, '0')}s`;
|
|
21
|
+
}
|
|
22
|
+
async function requireAuth() {
|
|
23
|
+
const config = await loadConfig();
|
|
24
|
+
if (!config.token)
|
|
25
|
+
throw new Error('Not logged in. Run `buildatlas login` first.');
|
|
26
|
+
return config;
|
|
27
|
+
}
|
|
28
|
+
function fail(err) {
|
|
29
|
+
const message = err instanceof AtlasApiError ? `${err.message} (${err.code})` : err.message;
|
|
30
|
+
console.error(pc.red('✖'), message);
|
|
31
|
+
process.exitCode = 1;
|
|
32
|
+
}
|
|
33
|
+
export function registerBuildQueryCommands(program) {
|
|
34
|
+
program
|
|
35
|
+
.command('builds')
|
|
36
|
+
.description('List recent builds for a project')
|
|
37
|
+
.option('--project <slug>', 'Project slug (default: $BUILDATLAS_PROJECT, else app.json)')
|
|
38
|
+
.option('-n, --limit <count>', 'How many to show', '20')
|
|
39
|
+
.action(async (opts) => {
|
|
40
|
+
try {
|
|
41
|
+
const config = await requireAuth();
|
|
42
|
+
const resolved = await resolveProject(opts.project);
|
|
43
|
+
reportProject(resolved);
|
|
44
|
+
const slug = resolved.slug;
|
|
45
|
+
const { builds } = await apiRequest(config, `/projects/${slug}/builds?limit=${encodeURIComponent(opts.limit)}`, { token: config.token });
|
|
46
|
+
if (!builds.length) {
|
|
47
|
+
console.log(pc.dim('No builds yet.'));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
for (const b of builds) {
|
|
51
|
+
const version = `${b.appVersion ?? '?'} (${b.buildNumber ?? '?'})`;
|
|
52
|
+
console.log(`${colorStatus(b.status)} ${b.id.slice(0, 8)} ${b.platform.padEnd(7)} ${b.profile.padEnd(12)} ${version.padEnd(14)} ${duration(b.createdAt, b.finishedAt).padStart(7)}`);
|
|
53
|
+
if (b.errorMessage)
|
|
54
|
+
console.log(pc.dim(` ↳ ${b.errorMessage}`));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
fail(err);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
program
|
|
62
|
+
.command('logs <buildId>')
|
|
63
|
+
.description('Follow (or replay) a build log')
|
|
64
|
+
.action(async (buildId) => {
|
|
65
|
+
try {
|
|
66
|
+
const config = await requireAuth();
|
|
67
|
+
// Following someone else's build must not imply ownership of it either.
|
|
68
|
+
const stopDetaching = detachOnInterrupt(buildId);
|
|
69
|
+
let status;
|
|
70
|
+
try {
|
|
71
|
+
status = await streamLogs(config, buildId);
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
stopDetaching();
|
|
75
|
+
}
|
|
76
|
+
console.log(status === 'finished' ? pc.green(`\n✔ ${status}`) : pc.red(`\n✖ ${status}`));
|
|
77
|
+
if (status !== 'finished')
|
|
78
|
+
process.exitCode = 1;
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
fail(err);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
program
|
|
85
|
+
.command('cancel <buildId>')
|
|
86
|
+
.description('Cancel a queued or running build')
|
|
87
|
+
.action(async (buildId) => {
|
|
88
|
+
try {
|
|
89
|
+
const config = await requireAuth();
|
|
90
|
+
const { result } = await apiRequest(config, `/builds/${buildId}/cancel`,
|
|
91
|
+
// Cancelling a cancelled build is still a cancelled build, so a 504 from a
|
|
92
|
+
// proxy is worth retrying rather than leaving a person unsure whether the
|
|
93
|
+
// build they wanted stopped is still burning minutes.
|
|
94
|
+
{ method: 'POST', token: config.token, retry: 'safe' });
|
|
95
|
+
console.log(pc.green('✔'), result === 'removed' ? 'removed from the queue' : 'cancel signalled to the runner');
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
fail(err);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=builds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builds.js","sourceRoot":"","sources":["../../src/commands/builds.ts"],"names":[],"mappings":"AACA,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,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAexC,MAAM,YAAY,GAA0C;IAC1D,QAAQ,EAAE,EAAE,CAAC,KAAK;IAClB,OAAO,EAAE,EAAE,CAAC,GAAG;IACf,QAAQ,EAAE,EAAE,CAAC,MAAM;IACnB,OAAO,EAAE,EAAE,CAAC,IAAI;IAChB,MAAM,EAAE,EAAE,CAAC,IAAI;IACf,OAAO,EAAE,EAAE,CAAC,GAAG;CAChB,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7F,SAAS,QAAQ,CAAC,IAAY,EAAE,EAAiB;IAC/C,IAAI,CAAC,EAAE;QAAE,OAAO,GAAG,CAAC;IACpB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAA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AAsD;YACtD,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CACvD,CAAC;YACF,OAAO,CAAC,GAAG,CACT,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EACb,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,gCAAgC,CACnF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,GAAG,CAAC,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Prompter } from '../prompt.ts';
|
|
2
|
+
export type WizardKind = 'android_keystore' | 'ios_dist_cert' | 'ios_provisioning_profile' | 'asc_api_key' | 'play_service_account';
|
|
3
|
+
export interface WizardResult {
|
|
4
|
+
kind: WizardKind;
|
|
5
|
+
label: string;
|
|
6
|
+
payload: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Interactive `credentials add`.
|
|
10
|
+
*
|
|
11
|
+
* Running the command bare used to fail with "required option '-k, --kind' not
|
|
12
|
+
* specified", which tells you a flag is missing but not which of six values it
|
|
13
|
+
* takes, nor which extra flags each one then needs. The flags still work and are
|
|
14
|
+
* still what CI uses; this is for the person doing it once by hand.
|
|
15
|
+
*
|
|
16
|
+
* For Android it also offers to *create* the keystore. That is the part most worth
|
|
17
|
+
* automating: keytool's defaults are wrong for this job in three separate ways —
|
|
18
|
+
* it writes to ~/.keystore rather than the project, issues a 90-day certificate
|
|
19
|
+
* that is useless for Play, and names the key `mykey`. Getting any of those wrong
|
|
20
|
+
* is only discovered later.
|
|
21
|
+
*/
|
|
22
|
+
export declare function runCredentialsWizard(p: Prompter, defaults: {
|
|
23
|
+
dir: string;
|
|
24
|
+
}): Promise<WizardResult>;
|
|
25
|
+
//# sourceMappingURL=credentials-wizard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials-wizard.d.ts","sourceRoot":"","sources":["../../src/commands/credentials-wizard.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAI7C,MAAM,MAAM,UAAU,GAClB,kBAAkB,GAClB,eAAe,GACf,0BAA0B,GAC1B,aAAa,GACb,sBAAsB,CAAC;AAE3B,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,oBAAoB,CACxC,CAAC,EAAE,QAAQ,EACX,QAAQ,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GACxB,OAAO,CAAC,YAAY,CAAC,CAyCvB"}
|