@tryarcanist/cli 0.1.181 → 0.1.182
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/dist/index.js +27 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4349,22 +4349,43 @@ function buildLogsPath(businessId, buildId, options = {}) {
|
|
|
4349
4349
|
buildId
|
|
4350
4350
|
)}/logs${suffix}`;
|
|
4351
4351
|
}
|
|
4352
|
+
async function fetchAndEmitBuildLogs(config, businessId, buildId, options) {
|
|
4353
|
+
const logs = await apiFetch(
|
|
4354
|
+
config,
|
|
4355
|
+
buildLogsPath(businessId, buildId, { afterSequence: options.afterSequence, limit: options.limit })
|
|
4356
|
+
);
|
|
4357
|
+
if (logs.logs.length === 0) return { afterSequence: options.afterSequence, count: 0 };
|
|
4358
|
+
if (options.json) writeJson({ type: "logs", logs: logs.logs });
|
|
4359
|
+
else printLogs(logs.logs);
|
|
4360
|
+
return { afterSequence: logs.logs[logs.logs.length - 1].sequence, count: logs.logs.length };
|
|
4361
|
+
}
|
|
4362
|
+
async function drainTerminalBuildLogs(config, businessId, buildId, options) {
|
|
4363
|
+
let afterSequence = options.afterSequence;
|
|
4364
|
+
for (; ; ) {
|
|
4365
|
+
const result = await fetchAndEmitBuildLogs(config, businessId, buildId, {
|
|
4366
|
+
afterSequence,
|
|
4367
|
+
limit: 500,
|
|
4368
|
+
json: options.json
|
|
4369
|
+
});
|
|
4370
|
+
afterSequence = result.afterSequence;
|
|
4371
|
+
if (result.count === 0) return;
|
|
4372
|
+
}
|
|
4373
|
+
}
|
|
4352
4374
|
async function waitForBuild(config, businessId, buildId, options) {
|
|
4353
4375
|
let afterSequence;
|
|
4354
4376
|
for (; ; ) {
|
|
4355
4377
|
if (options.follow) {
|
|
4356
|
-
const
|
|
4357
|
-
|
|
4358
|
-
if (options.json) writeJson({ type: "logs", logs: logs.logs });
|
|
4359
|
-
else printLogs(logs.logs);
|
|
4360
|
-
afterSequence = logs.logs[logs.logs.length - 1].sequence;
|
|
4361
|
-
}
|
|
4378
|
+
const result = await fetchAndEmitBuildLogs(config, businessId, buildId, { afterSequence, json: options.json });
|
|
4379
|
+
afterSequence = result.afterSequence;
|
|
4362
4380
|
}
|
|
4363
4381
|
const status = await apiFetch(
|
|
4364
4382
|
config,
|
|
4365
4383
|
`/api/businesses/${encodeURIComponent(businessId)}/sandbox-layer/build-requests/${encodeURIComponent(buildId)}`
|
|
4366
4384
|
);
|
|
4367
4385
|
if (TERMINAL_BUILD_STATUSES.has(status.buildRequest.status)) {
|
|
4386
|
+
if (options.follow) {
|
|
4387
|
+
await drainTerminalBuildLogs(config, businessId, buildId, { afterSequence, json: options.json });
|
|
4388
|
+
}
|
|
4368
4389
|
return status.buildRequest;
|
|
4369
4390
|
}
|
|
4370
4391
|
await sleep(options.pollIntervalMs);
|