@lukoweb/apitogo 0.1.146 → 0.1.148
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/cli/cli.js
CHANGED
|
@@ -4450,7 +4450,7 @@ __export(ZudokuConfig_exports, {
|
|
|
4450
4450
|
ZudokuConfig: () => ZudokuConfig,
|
|
4451
4451
|
validateConfig: () => validateConfig
|
|
4452
4452
|
});
|
|
4453
|
-
import
|
|
4453
|
+
import colors5 from "picocolors";
|
|
4454
4454
|
import { isValidElement as isValidElement2 } from "react";
|
|
4455
4455
|
import { z as z9 } from "zod";
|
|
4456
4456
|
function validateConfig(config2, configPath) {
|
|
@@ -4462,8 +4462,8 @@ function validateConfig(config2, configPath) {
|
|
|
4462
4462
|
${z9.prettifyError(validationResult.error)}`
|
|
4463
4463
|
);
|
|
4464
4464
|
}
|
|
4465
|
-
console.log(
|
|
4466
|
-
console.log(
|
|
4465
|
+
console.log(colors5.yellow("Validation errors:"));
|
|
4466
|
+
console.log(colors5.yellow(z9.prettifyError(validationResult.error)));
|
|
4467
4467
|
}
|
|
4468
4468
|
}
|
|
4469
4469
|
var ThemeSchema, ApiCatalogCategorySchema, LanguageOption, AiAssistantCustomSchema, AiAssistantPresets, AiAssistantsSchema, ApiOptionsSchema, ApiConfigSchema, VersionConfigSchema, ApiSchema, ApiKeysSchema, LogoSchema, FooterSocialIcons, FooterSocialSchema, FooterSchema, SiteMapSchema, DEFAULT_DOCS_FILES, LlmsConfigSchema, DocsConfigSchema, Redirect, SearchSchema, AuthenticationSchema, MetadataSchema, FontConfigSchema, FontsConfigSchema, CssObject, ThemeConfigSchema, SiteSchema, PlacementPosition, HeaderConfigSchema, ApiCatalogSchema, CdnUrlSchema, BaseConfigSchema, ZudokuConfig;
|
|
@@ -5002,7 +5002,7 @@ var init_ZudokuConfig = __esm({
|
|
|
5002
5002
|
// src/config/loader.ts
|
|
5003
5003
|
import { stat as stat2 } from "node:fs/promises";
|
|
5004
5004
|
import path6 from "node:path";
|
|
5005
|
-
import
|
|
5005
|
+
import colors6 from "picocolors";
|
|
5006
5006
|
import {
|
|
5007
5007
|
runnerImport,
|
|
5008
5008
|
loadEnv as viteLoadEnv
|
|
@@ -5188,7 +5188,7 @@ async function loadZudokuConfig(configEnv, rootDir) {
|
|
|
5188
5188
|
};
|
|
5189
5189
|
if (!process.env.APITOGO_JSON_ONLY) {
|
|
5190
5190
|
logger.info(
|
|
5191
|
-
|
|
5191
|
+
colors6.cyan(`loaded config file `) + colors6.dim(config.__meta.configPath),
|
|
5192
5192
|
{ timestamp: true }
|
|
5193
5193
|
);
|
|
5194
5194
|
}
|
|
@@ -5258,7 +5258,7 @@ __export(llms_exports, {
|
|
|
5258
5258
|
});
|
|
5259
5259
|
import { writeFile as writeFile5 } from "node:fs/promises";
|
|
5260
5260
|
import path29 from "node:path";
|
|
5261
|
-
import
|
|
5261
|
+
import colors10 from "picocolors";
|
|
5262
5262
|
async function generateLlmsTxtFiles({
|
|
5263
5263
|
markdownFileInfos,
|
|
5264
5264
|
outputUrls,
|
|
@@ -5294,7 +5294,7 @@ async function generateLlmsTxtFiles({
|
|
|
5294
5294
|
const llmsTxt2 = llmsTxtParts.join("\n");
|
|
5295
5295
|
await writeFile5(path29.join(baseOutputDir, "llms.txt"), llmsTxt2, "utf-8");
|
|
5296
5296
|
if (process.env.APITOGO_JSON_ONLY !== "1") {
|
|
5297
|
-
console.log(
|
|
5297
|
+
console.log(colors10.blue("\u2713 generated llms.txt"));
|
|
5298
5298
|
}
|
|
5299
5299
|
}
|
|
5300
5300
|
if (llmsTxtFull) {
|
|
@@ -5325,7 +5325,7 @@ ${info.content}
|
|
|
5325
5325
|
"utf-8"
|
|
5326
5326
|
);
|
|
5327
5327
|
if (process.env.APITOGO_JSON_ONLY !== "1") {
|
|
5328
|
-
console.log(
|
|
5328
|
+
console.log(colors10.blue("\u2713 generated llms-full.txt"));
|
|
5329
5329
|
}
|
|
5330
5330
|
}
|
|
5331
5331
|
}
|
|
@@ -5448,7 +5448,7 @@ async function shutdownAnalytics() {
|
|
|
5448
5448
|
import { existsSync, mkdirSync } from "node:fs";
|
|
5449
5449
|
import { readFile, writeFile } from "node:fs/promises";
|
|
5450
5450
|
import { join } from "node:path";
|
|
5451
|
-
import
|
|
5451
|
+
import colors4 from "picocolors";
|
|
5452
5452
|
import { gt } from "semver";
|
|
5453
5453
|
|
|
5454
5454
|
// src/cli/common/json-only-deploy.ts
|
|
@@ -5470,7 +5470,111 @@ function isDeployJsonOnlyArgv() {
|
|
|
5470
5470
|
|
|
5471
5471
|
// src/cli/common/output.ts
|
|
5472
5472
|
import * as Sentry from "@sentry/node";
|
|
5473
|
+
import colors2 from "picocolors";
|
|
5474
|
+
|
|
5475
|
+
// src/cli/common/spinner.ts
|
|
5473
5476
|
import colors from "picocolors";
|
|
5477
|
+
var FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
5478
|
+
var INTERVAL_MS = 80;
|
|
5479
|
+
var SHOW_ELAPSED_AFTER_MS = 3e3;
|
|
5480
|
+
var isAnimated = (stream) => Boolean(stream.isTTY) && !process.env.CI && process.env.TERM !== "dumb";
|
|
5481
|
+
var active = /* @__PURE__ */ new Set();
|
|
5482
|
+
function stopAllSpinners() {
|
|
5483
|
+
for (const spinner of [...active]) spinner.stop();
|
|
5484
|
+
}
|
|
5485
|
+
var cursorHidden;
|
|
5486
|
+
var restoreCursor = () => {
|
|
5487
|
+
cursorHidden?.write("\x1B[?25h");
|
|
5488
|
+
cursorHidden = void 0;
|
|
5489
|
+
};
|
|
5490
|
+
var formatElapsed = (ms) => {
|
|
5491
|
+
const seconds = Math.floor(ms / 1e3);
|
|
5492
|
+
return seconds < 60 ? `${seconds}s` : `${Math.floor(seconds / 60)}m ${seconds % 60}s`;
|
|
5493
|
+
};
|
|
5494
|
+
function createSpinner(initialText, { stream = process.stderr, silent = false } = {}) {
|
|
5495
|
+
if (silent) {
|
|
5496
|
+
return { update() {
|
|
5497
|
+
}, log() {
|
|
5498
|
+
}, stop() {
|
|
5499
|
+
} };
|
|
5500
|
+
}
|
|
5501
|
+
if (!isAnimated(stream)) {
|
|
5502
|
+
let last = initialText;
|
|
5503
|
+
stream.write(`${initialText}
|
|
5504
|
+
`);
|
|
5505
|
+
return {
|
|
5506
|
+
update(text2) {
|
|
5507
|
+
if (text2 === last) return;
|
|
5508
|
+
last = text2;
|
|
5509
|
+
stream.write(`${text2}
|
|
5510
|
+
`);
|
|
5511
|
+
},
|
|
5512
|
+
log: (line) => void stream.write(`${line}
|
|
5513
|
+
`),
|
|
5514
|
+
stop() {
|
|
5515
|
+
}
|
|
5516
|
+
};
|
|
5517
|
+
}
|
|
5518
|
+
const startedAt = Date.now();
|
|
5519
|
+
let text = initialText;
|
|
5520
|
+
let frame = 0;
|
|
5521
|
+
let timer;
|
|
5522
|
+
const clear = () => stream.write("\r\x1B[K");
|
|
5523
|
+
const render = () => {
|
|
5524
|
+
const elapsed = Date.now() - startedAt;
|
|
5525
|
+
const suffix = elapsed >= SHOW_ELAPSED_AFTER_MS ? ` ${colors.dim(`(${formatElapsed(elapsed)})`)}` : "";
|
|
5526
|
+
const room = Math.max(
|
|
5527
|
+
10,
|
|
5528
|
+
(stream.columns || 80) - 3 - ` (${formatElapsed(elapsed)})`.length
|
|
5529
|
+
);
|
|
5530
|
+
const shown = text.length > room ? `${text.slice(0, room - 1)}\u2026` : text;
|
|
5531
|
+
stream.write(
|
|
5532
|
+
`\r\x1B[K${colors.cyan(FRAMES[frame++ % FRAMES.length])} ${shown}${suffix}`
|
|
5533
|
+
);
|
|
5534
|
+
};
|
|
5535
|
+
stream.write("\x1B[?25l");
|
|
5536
|
+
cursorHidden = stream;
|
|
5537
|
+
process.once("exit", restoreCursor);
|
|
5538
|
+
render();
|
|
5539
|
+
timer = setInterval(render, INTERVAL_MS);
|
|
5540
|
+
timer.unref();
|
|
5541
|
+
const spinner = {
|
|
5542
|
+
update(next) {
|
|
5543
|
+
text = next;
|
|
5544
|
+
},
|
|
5545
|
+
log(line) {
|
|
5546
|
+
if (!timer) {
|
|
5547
|
+
stream.write(`${line}
|
|
5548
|
+
`);
|
|
5549
|
+
return;
|
|
5550
|
+
}
|
|
5551
|
+
clear();
|
|
5552
|
+
stream.write(`${line}
|
|
5553
|
+
`);
|
|
5554
|
+
render();
|
|
5555
|
+
},
|
|
5556
|
+
stop() {
|
|
5557
|
+
if (!timer) return;
|
|
5558
|
+
clearInterval(timer);
|
|
5559
|
+
timer = void 0;
|
|
5560
|
+
clear();
|
|
5561
|
+
restoreCursor();
|
|
5562
|
+
active.delete(spinner);
|
|
5563
|
+
}
|
|
5564
|
+
};
|
|
5565
|
+
active.add(spinner);
|
|
5566
|
+
return spinner;
|
|
5567
|
+
}
|
|
5568
|
+
async function withSpinner(text, fn, options) {
|
|
5569
|
+
const spinner = createSpinner(text, options);
|
|
5570
|
+
try {
|
|
5571
|
+
return await fn(spinner);
|
|
5572
|
+
} finally {
|
|
5573
|
+
spinner.stop();
|
|
5574
|
+
}
|
|
5575
|
+
}
|
|
5576
|
+
|
|
5577
|
+
// src/cli/common/output.ts
|
|
5474
5578
|
var symbols = {
|
|
5475
5579
|
success: "\u2714",
|
|
5476
5580
|
error: "\u2716",
|
|
@@ -5478,37 +5582,38 @@ var symbols = {
|
|
|
5478
5582
|
};
|
|
5479
5583
|
var withSymbol = (symbol, isTTY2) => isTTY2 ? `${symbol} ` : "";
|
|
5480
5584
|
function printDiagnosticsToConsole(message) {
|
|
5481
|
-
console.error(
|
|
5585
|
+
console.error(colors2.cyan(message));
|
|
5482
5586
|
}
|
|
5483
5587
|
function printSuccessToConsole(message) {
|
|
5484
5588
|
console.error(
|
|
5485
|
-
|
|
5589
|
+
colors2.green(
|
|
5486
5590
|
`${withSymbol(symbols.success, process.stderr.isTTY)}${message}`
|
|
5487
5591
|
)
|
|
5488
5592
|
);
|
|
5489
5593
|
}
|
|
5490
5594
|
function printHintToConsole(message) {
|
|
5491
|
-
console.error(
|
|
5595
|
+
console.error(colors2.dim(message));
|
|
5492
5596
|
}
|
|
5493
5597
|
function printWarningToConsole(message) {
|
|
5494
5598
|
console.error(
|
|
5495
|
-
|
|
5599
|
+
colors2.yellow(
|
|
5496
5600
|
`${withSymbol(symbols.warning, process.stderr.isTTY)}${message}`
|
|
5497
5601
|
)
|
|
5498
5602
|
);
|
|
5499
5603
|
}
|
|
5500
5604
|
function printErrorToConsole(message) {
|
|
5501
5605
|
console.error(
|
|
5502
|
-
|
|
5606
|
+
colors2.red(`${withSymbol(symbols.error, process.stderr.isTTY)}${message}`)
|
|
5503
5607
|
);
|
|
5504
5608
|
}
|
|
5505
5609
|
function printBoxToConsole(message) {
|
|
5506
5610
|
console.error(message);
|
|
5507
5611
|
}
|
|
5508
5612
|
async function printCriticalFailureToConsoleAndExit(message) {
|
|
5613
|
+
stopAllSpinners();
|
|
5509
5614
|
const text = typeof message === "string" && message.trim() === "" ? "Command failed with no further details." : message;
|
|
5510
5615
|
console.error(
|
|
5511
|
-
`${
|
|
5616
|
+
`${colors2.bold(colors2.red(`${withSymbol(symbols.error, process.stderr.isTTY)}Error:`))} ${colors2.red(text)}`
|
|
5512
5617
|
);
|
|
5513
5618
|
await Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
|
|
5514
5619
|
process.exit(1);
|
|
@@ -5520,8 +5625,8 @@ function printJsonOnlyErrorAndExit(message) {
|
|
|
5520
5625
|
}
|
|
5521
5626
|
function printResultToConsole(message) {
|
|
5522
5627
|
console.log(
|
|
5523
|
-
|
|
5524
|
-
|
|
5628
|
+
colors2.bold(
|
|
5629
|
+
colors2.green(
|
|
5525
5630
|
`${withSymbol(symbols.success, process.stdout.isTTY)}${message}`
|
|
5526
5631
|
)
|
|
5527
5632
|
)
|
|
@@ -5529,7 +5634,7 @@ function printResultToConsole(message) {
|
|
|
5529
5634
|
}
|
|
5530
5635
|
|
|
5531
5636
|
// src/cli/common/utils/box.ts
|
|
5532
|
-
import
|
|
5637
|
+
import colors3 from "picocolors";
|
|
5533
5638
|
import stripAnsi from "strip-ansi";
|
|
5534
5639
|
var border = ["\u2500", "\u256D", "\u256E", "\u2502", "\u2502", "\u2570", "\u256F"];
|
|
5535
5640
|
var nothing = ["\u2500", "", "", "", "", "", ""];
|
|
@@ -5541,7 +5646,7 @@ function box(message, {
|
|
|
5541
5646
|
} = {}) {
|
|
5542
5647
|
const lines = message.split(/\r?\n/).map((line) => [line, stripAnsi(line).length]);
|
|
5543
5648
|
const maxLine = lines.reduce((p, [, len]) => Math.max(p, len), 0);
|
|
5544
|
-
const borderColorFn = borderColor &&
|
|
5649
|
+
const borderColorFn = borderColor && colors3[borderColor] || colors3.yellow;
|
|
5545
5650
|
const clampedSidePadding = Math.max(1, padding * 3);
|
|
5546
5651
|
const narrowMode = maxLine + 2 + clampedSidePadding * 2 > cols;
|
|
5547
5652
|
const sidePadding = narrowMode ? 0 : clampedSidePadding;
|
|
@@ -5622,12 +5727,12 @@ async function warnIfOutdatedVersion(currentVersion) {
|
|
|
5622
5727
|
if (shouldWarn) {
|
|
5623
5728
|
printBoxToConsole(
|
|
5624
5729
|
box(
|
|
5625
|
-
`Update available! ${
|
|
5730
|
+
`Update available! ${colors4.gray(`v${currentVersion}`)} \u226B ${colors4.green(
|
|
5626
5731
|
`v${versionCheckInfo.latestVersion}`
|
|
5627
5732
|
)}
|
|
5628
|
-
Run ${
|
|
5733
|
+
Run ${colors4.cyan("npm install apitogo@latest")} to update.
|
|
5629
5734
|
|
|
5630
|
-
${
|
|
5735
|
+
${colors4.gray("Upgrade to receive the latest features and fixes.")}`
|
|
5631
5736
|
)
|
|
5632
5737
|
);
|
|
5633
5738
|
}
|
|
@@ -5836,7 +5941,7 @@ init_joinUrl();
|
|
|
5836
5941
|
// src/vite/config.ts
|
|
5837
5942
|
import path26 from "node:path";
|
|
5838
5943
|
import dotenv from "dotenv";
|
|
5839
|
-
import
|
|
5944
|
+
import colors8 from "picocolors";
|
|
5840
5945
|
import {
|
|
5841
5946
|
loadConfigFromFile,
|
|
5842
5947
|
mergeConfig as mergeConfig2
|
|
@@ -5845,7 +5950,7 @@ import {
|
|
|
5845
5950
|
// package.json
|
|
5846
5951
|
var package_default = {
|
|
5847
5952
|
name: "@lukoweb/apitogo",
|
|
5848
|
-
version: "0.1.
|
|
5953
|
+
version: "0.1.148",
|
|
5849
5954
|
type: "module",
|
|
5850
5955
|
sideEffects: [
|
|
5851
5956
|
"**/*.css",
|
|
@@ -7913,7 +8018,7 @@ var SchemaManager = class {
|
|
|
7913
8018
|
init_logger();
|
|
7914
8019
|
init_loader();
|
|
7915
8020
|
import path14 from "node:path";
|
|
7916
|
-
import
|
|
8021
|
+
import colors7 from "picocolors";
|
|
7917
8022
|
|
|
7918
8023
|
// src/vite/plugin-navigation.ts
|
|
7919
8024
|
init_loader();
|
|
@@ -8220,7 +8325,7 @@ var viteConfigReloadPlugin = () => ({
|
|
|
8220
8325
|
invalidate(server);
|
|
8221
8326
|
reload(server);
|
|
8222
8327
|
logger.info(
|
|
8223
|
-
|
|
8328
|
+
colors7.blue(
|
|
8224
8329
|
`Config ${path14.basename(currentConfig.__meta.configPath)} changed. Reloading...`
|
|
8225
8330
|
),
|
|
8226
8331
|
{ timestamp: true }
|
|
@@ -9930,9 +10035,9 @@ async function getViteConfig(dir, configEnv) {
|
|
|
9930
10035
|
const cdnUrl = CdnUrlSchema.parse(config2.cdnUrl);
|
|
9931
10036
|
const base = cdnUrl?.base ? joinUrl(cdnUrl.base, config2.basePath) : config2.basePath;
|
|
9932
10037
|
if (cdnUrl && !hasLoggedCdnInfo) {
|
|
9933
|
-
logger.info(
|
|
9934
|
-
logger.info(
|
|
9935
|
-
logger.info(
|
|
10038
|
+
logger.info(colors8.blue(`Using CDN URL:`));
|
|
10039
|
+
logger.info(colors8.blue(` base: `) + colors8.dim(cdnUrl.base));
|
|
10040
|
+
logger.info(colors8.blue(` media: `) + colors8.dim(cdnUrl.media));
|
|
9936
10041
|
hasLoggedCdnInfo = true;
|
|
9937
10042
|
}
|
|
9938
10043
|
const publicVarsProcessEnvDefine = Object.fromEntries(
|
|
@@ -10082,7 +10187,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
10082
10187
|
if (!loaded) continue;
|
|
10083
10188
|
mergedViteConfig = mergeConfig2(mergedViteConfig, loaded.config, true);
|
|
10084
10189
|
if (root === dir) {
|
|
10085
|
-
logger.info(
|
|
10190
|
+
logger.info(colors8.blue(`merged with custom user Vite config`), {
|
|
10086
10191
|
timestamp: true
|
|
10087
10192
|
});
|
|
10088
10193
|
}
|
|
@@ -10218,7 +10323,7 @@ import os from "node:os";
|
|
|
10218
10323
|
import path30 from "node:path";
|
|
10219
10324
|
import { pathToFileURL } from "node:url";
|
|
10220
10325
|
import { createIndex } from "pagefind";
|
|
10221
|
-
import
|
|
10326
|
+
import colors11 from "picocolors";
|
|
10222
10327
|
import PiscinaImport from "piscina";
|
|
10223
10328
|
init_transform_config();
|
|
10224
10329
|
init_invariant();
|
|
@@ -10258,7 +10363,7 @@ init_joinUrl();
|
|
|
10258
10363
|
import { createWriteStream, existsSync as existsSync3 } from "node:fs";
|
|
10259
10364
|
import { mkdir as mkdir4 } from "node:fs/promises";
|
|
10260
10365
|
import path28 from "node:path";
|
|
10261
|
-
import
|
|
10366
|
+
import colors9 from "picocolors";
|
|
10262
10367
|
import { SitemapStream } from "sitemap";
|
|
10263
10368
|
async function generateSitemap({
|
|
10264
10369
|
outputUrls,
|
|
@@ -10299,7 +10404,7 @@ async function generateSitemap({
|
|
|
10299
10404
|
writeStream.on("error", reject);
|
|
10300
10405
|
});
|
|
10301
10406
|
console.debug(
|
|
10302
|
-
|
|
10407
|
+
colors9.blue(`\u2713 wrote sitemap to ${colors9.bold(sitemapOutputPath)}`)
|
|
10303
10408
|
);
|
|
10304
10409
|
}
|
|
10305
10410
|
|
|
@@ -10391,12 +10496,12 @@ var prerender = async ({
|
|
|
10391
10496
|
const writeProgress = throttle(
|
|
10392
10497
|
(count, total, urlPath) => {
|
|
10393
10498
|
if (quietDeployJson) return;
|
|
10394
|
-
writeLine(`prerendering (${count}/${total}) ${
|
|
10499
|
+
writeLine(`prerendering (${count}/${total}) ${colors11.dim(urlPath)}`);
|
|
10395
10500
|
}
|
|
10396
10501
|
);
|
|
10397
10502
|
if (!isTTY() && !quietDeployJson) {
|
|
10398
10503
|
logger.info(
|
|
10399
|
-
|
|
10504
|
+
colors11.dim(
|
|
10400
10505
|
`prerendering ${paths.length} routes using ${maxThreads} workers...`
|
|
10401
10506
|
)
|
|
10402
10507
|
);
|
|
@@ -10440,7 +10545,7 @@ var prerender = async ({
|
|
|
10440
10545
|
const now = performance.now();
|
|
10441
10546
|
if (now - lastLogTime >= LOG_INTERVAL_MS) {
|
|
10442
10547
|
logger.info(
|
|
10443
|
-
|
|
10548
|
+
colors11.blue(
|
|
10444
10549
|
`prerendered ${completedCount}/${paths.length} routes using ${maxThreads} workers`
|
|
10445
10550
|
)
|
|
10446
10551
|
);
|
|
@@ -10457,14 +10562,14 @@ var prerender = async ({
|
|
|
10457
10562
|
const message = `\u2713 finished prerendering ${paths.length} routes in ${seconds} seconds using ${maxThreads} workers`;
|
|
10458
10563
|
if (!quietDeployJson) {
|
|
10459
10564
|
if (isTTY()) {
|
|
10460
|
-
writeLine(
|
|
10565
|
+
writeLine(colors11.blue(`${message}
|
|
10461
10566
|
`));
|
|
10462
10567
|
} else {
|
|
10463
|
-
logger.info(
|
|
10568
|
+
logger.info(colors11.blue(message));
|
|
10464
10569
|
}
|
|
10465
10570
|
if (pagefindWriteResult?.outputPath) {
|
|
10466
10571
|
logger.info(
|
|
10467
|
-
|
|
10572
|
+
colors11.blue(
|
|
10468
10573
|
`\u2713 pagefind index built: ${pagefindWriteResult.outputPath}`
|
|
10469
10574
|
)
|
|
10470
10575
|
);
|
|
@@ -14091,10 +14196,14 @@ async function check(argv) {
|
|
|
14091
14196
|
const client = new PlatformApiClient(config2);
|
|
14092
14197
|
let result;
|
|
14093
14198
|
try {
|
|
14094
|
-
result = await
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
|
|
14199
|
+
result = await withSpinner(
|
|
14200
|
+
"Checking publish readiness...",
|
|
14201
|
+
() => checkPublishReadiness(client, config2, {
|
|
14202
|
+
sourceDirectory,
|
|
14203
|
+
validateBuild: argv.validateBuild === true
|
|
14204
|
+
}),
|
|
14205
|
+
{ silent: argv.json }
|
|
14206
|
+
);
|
|
14098
14207
|
} catch (error) {
|
|
14099
14208
|
await printCriticalFailureToConsoleAndExit(
|
|
14100
14209
|
error instanceof Error ? error.message : String(error)
|
|
@@ -15955,7 +16064,7 @@ import { stdin as input, stdout as output } from "node:process";
|
|
|
15955
16064
|
import { createInterface } from "node:readline/promises";
|
|
15956
16065
|
|
|
15957
16066
|
// src/cli/make-config/wrap-up.ts
|
|
15958
|
-
import
|
|
16067
|
+
import colors12 from "picocolors";
|
|
15959
16068
|
var DOCS = "https://docs.apitogo.com";
|
|
15960
16069
|
function printPageAddedHint(relativePath, routePath) {
|
|
15961
16070
|
printSuccessToConsole(`Page created: ${relativePath} (route ${routePath})`);
|
|
@@ -15979,7 +16088,7 @@ function printPaidPlanPlatformWarning() {
|
|
|
15979
16088
|
function printInteractiveWrapUp(hasPaidPlans) {
|
|
15980
16089
|
printDiagnosticsToConsole("");
|
|
15981
16090
|
printSuccessToConsole("Configuration is done. Next steps:");
|
|
15982
|
-
printDiagnosticsToConsole(`- Preview locally: ${
|
|
16091
|
+
printDiagnosticsToConsole(`- Preview locally: ${colors12.bold("npm run dev")}`);
|
|
15983
16092
|
if (hasPaidPlans) {
|
|
15984
16093
|
printPaidPlanPlatformWarning();
|
|
15985
16094
|
} else {
|
|
@@ -15988,7 +16097,7 @@ function printInteractiveWrapUp(hasPaidPlans) {
|
|
|
15988
16097
|
);
|
|
15989
16098
|
}
|
|
15990
16099
|
printDiagnosticsToConsole("");
|
|
15991
|
-
printDiagnosticsToConsole(
|
|
16100
|
+
printDiagnosticsToConsole(colors12.bold("Configure more:"));
|
|
15992
16101
|
printHintToConsole(`- Overview: ${DOCS}/docs/configuration/overview`);
|
|
15993
16102
|
printDiagnosticsToConsole(
|
|
15994
16103
|
`- Gateway plans: ${DOCS}/docs/configuration/plans`
|
|
@@ -16972,30 +17081,50 @@ function buildProgressSummary(options) {
|
|
|
16972
17081
|
};
|
|
16973
17082
|
}
|
|
16974
17083
|
function createConsoleProgressReporter(stream = process.stderr) {
|
|
16975
|
-
|
|
17084
|
+
const shared = { spinner: void 0 };
|
|
17085
|
+
return {
|
|
17086
|
+
...createScopedConsoleProgressReporter(stream, void 0, shared),
|
|
17087
|
+
stop() {
|
|
17088
|
+
shared.spinner?.stop();
|
|
17089
|
+
shared.spinner = void 0;
|
|
17090
|
+
}
|
|
17091
|
+
};
|
|
16976
17092
|
}
|
|
16977
|
-
function createScopedConsoleProgressReporter(stream, stepLabel) {
|
|
17093
|
+
function createScopedConsoleProgressReporter(stream, stepLabel, shared) {
|
|
16978
17094
|
let lastMessageCount = 0;
|
|
16979
17095
|
let lastLine;
|
|
17096
|
+
const animated = "isTTY" in stream && Boolean(stream.isTTY);
|
|
17097
|
+
const writeLine2 = (line) => shared.spinner ? shared.spinner.log(line) : stream.write(`${line}
|
|
17098
|
+
`);
|
|
16980
17099
|
const reporter = {
|
|
16981
17100
|
async onStep(step, detail) {
|
|
16982
|
-
const message = detail?.message ?? (detail?.platformStatus ? `${step}: ${detail.platformStatus}` : step);
|
|
17101
|
+
const message = (!animated ? detail?.message : void 0) ?? (detail?.platformStatus ? `${step}: ${detail.platformStatus}` : step);
|
|
16983
17102
|
const line = stepLabel ? `[${stepLabel}] ${message}` : message;
|
|
16984
17103
|
if (line === lastLine) return;
|
|
16985
17104
|
lastLine = line;
|
|
16986
|
-
|
|
17105
|
+
if (!animated) {
|
|
17106
|
+
stream.write(`${line}
|
|
16987
17107
|
`);
|
|
17108
|
+
return;
|
|
17109
|
+
}
|
|
17110
|
+
if (shared.spinner) {
|
|
17111
|
+
shared.spinner.update(line);
|
|
17112
|
+
} else {
|
|
17113
|
+
shared.spinner = createSpinner(line, {
|
|
17114
|
+
stream
|
|
17115
|
+
});
|
|
17116
|
+
}
|
|
16988
17117
|
},
|
|
16989
17118
|
async onNewMessages(messages) {
|
|
16990
17119
|
for (const entry of messages) {
|
|
16991
|
-
|
|
16992
|
-
|
|
16993
|
-
|
|
17120
|
+
writeLine2(
|
|
17121
|
+
stepLabel ? `[${stepLabel}] ${entry.message}` : entry.message
|
|
17122
|
+
);
|
|
16994
17123
|
}
|
|
16995
17124
|
},
|
|
16996
17125
|
isCancelled: () => false,
|
|
16997
17126
|
child(label) {
|
|
16998
|
-
return createScopedConsoleProgressReporter(stream, label);
|
|
17127
|
+
return createScopedConsoleProgressReporter(stream, label, shared);
|
|
16999
17128
|
}
|
|
17000
17129
|
};
|
|
17001
17130
|
const baseOnNewMessages = reporter.onNewMessages.bind(reporter);
|
|
@@ -20414,9 +20543,9 @@ function findBackendUpdateJob(jobs, options) {
|
|
|
20414
20543
|
if (options?.jobId) {
|
|
20415
20544
|
return sorted.find((job) => job.id === options.jobId) ?? null;
|
|
20416
20545
|
}
|
|
20417
|
-
const
|
|
20418
|
-
if (
|
|
20419
|
-
return
|
|
20546
|
+
const active2 = sorted.find(isActiveBackendUpdateJob);
|
|
20547
|
+
if (active2) {
|
|
20548
|
+
return active2;
|
|
20420
20549
|
}
|
|
20421
20550
|
const baseline = options?.baselineJobIds;
|
|
20422
20551
|
if (baseline) {
|
|
@@ -22115,7 +22244,7 @@ function formatResultForHuman(parsed) {
|
|
|
22115
22244
|
import { stdin as input3, stdout as output2 } from "node:process";
|
|
22116
22245
|
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
22117
22246
|
import open from "open";
|
|
22118
|
-
import
|
|
22247
|
+
import colors13 from "picocolors";
|
|
22119
22248
|
var PLAN_CHOICES = [
|
|
22120
22249
|
"free",
|
|
22121
22250
|
"starter",
|
|
@@ -22134,7 +22263,7 @@ function printPlanCatalog(payload) {
|
|
|
22134
22263
|
const plan = entry;
|
|
22135
22264
|
printDiagnosticsToConsole("");
|
|
22136
22265
|
printDiagnosticsToConsole(
|
|
22137
|
-
|
|
22266
|
+
colors13.bold(`${plan.displayName} \u2014 ${plan.priceLabel}`)
|
|
22138
22267
|
);
|
|
22139
22268
|
if (plan.summary) {
|
|
22140
22269
|
printHintToConsole(` ${plan.summary}`);
|
|
@@ -22354,6 +22483,13 @@ async function apply(argv) {
|
|
|
22354
22483
|
await progress.onStep(
|
|
22355
22484
|
`Starting deploy from ${sourceDirectory}... this may take a few minutes.`
|
|
22356
22485
|
);
|
|
22486
|
+
const runOnceAndStop = async (plan) => {
|
|
22487
|
+
try {
|
|
22488
|
+
return await runOnce(plan);
|
|
22489
|
+
} finally {
|
|
22490
|
+
progress.stop();
|
|
22491
|
+
}
|
|
22492
|
+
};
|
|
22357
22493
|
let effectiveProjectId = argv.projectId?.trim();
|
|
22358
22494
|
let effectiveProjectName = argv.projectName?.trim();
|
|
22359
22495
|
let createNewProject = false;
|
|
@@ -22377,7 +22513,7 @@ async function apply(argv) {
|
|
|
22377
22513
|
);
|
|
22378
22514
|
let result;
|
|
22379
22515
|
try {
|
|
22380
|
-
result = await
|
|
22516
|
+
result = await runOnceAndStop(platformPlan);
|
|
22381
22517
|
} catch (error) {
|
|
22382
22518
|
await printCriticalFailureToConsoleAndExit(
|
|
22383
22519
|
error instanceof Error ? error.message : String(error)
|
|
@@ -22396,7 +22532,7 @@ async function apply(argv) {
|
|
|
22396
22532
|
effectiveProjectName = resolution.projectName;
|
|
22397
22533
|
createNewProject = true;
|
|
22398
22534
|
try {
|
|
22399
|
-
result = await
|
|
22535
|
+
result = await runOnceAndStop(platformPlan);
|
|
22400
22536
|
} catch (error) {
|
|
22401
22537
|
await printCriticalFailureToConsoleAndExit(
|
|
22402
22538
|
error instanceof Error ? error.message : String(error)
|
|
@@ -22421,7 +22557,7 @@ async function apply(argv) {
|
|
|
22421
22557
|
createNewProject = true;
|
|
22422
22558
|
}
|
|
22423
22559
|
try {
|
|
22424
|
-
result = await
|
|
22560
|
+
result = await runOnceAndStop(platformPlan);
|
|
22425
22561
|
} catch (error) {
|
|
22426
22562
|
await printCriticalFailureToConsoleAndExit(
|
|
22427
22563
|
error instanceof Error ? error.message : String(error)
|
|
@@ -22452,7 +22588,7 @@ async function apply(argv) {
|
|
|
22452
22588
|
createNewProject = false;
|
|
22453
22589
|
}
|
|
22454
22590
|
try {
|
|
22455
|
-
result = await
|
|
22591
|
+
result = await runOnceAndStop(void 0);
|
|
22456
22592
|
} catch (error) {
|
|
22457
22593
|
await printCriticalFailureToConsoleAndExit(
|
|
22458
22594
|
error instanceof Error ? error.message : String(error)
|
|
@@ -23270,10 +23406,11 @@ async function init2(argv) {
|
|
|
23270
23406
|
);
|
|
23271
23407
|
let npmInstall = null;
|
|
23272
23408
|
if (install) {
|
|
23273
|
-
|
|
23274
|
-
|
|
23275
|
-
|
|
23276
|
-
|
|
23409
|
+
npmInstall = await withSpinner(
|
|
23410
|
+
"Installing npm dependencies\u2026",
|
|
23411
|
+
() => runNpmInstall(result.outputDirectory),
|
|
23412
|
+
{ silent: json }
|
|
23413
|
+
);
|
|
23277
23414
|
}
|
|
23278
23415
|
const { openApiDiscovery, docsDiscovery, backendDiscovery } = await runScaffoldDiscovery(result.outputDirectory, { openapiSearch });
|
|
23279
23416
|
const siteValidation = await validateDevPortalSiteConfig(
|
|
@@ -23379,7 +23516,7 @@ var init_default = {
|
|
|
23379
23516
|
// src/cli/login/handler.ts
|
|
23380
23517
|
import readline from "node:readline/promises";
|
|
23381
23518
|
import open2 from "open";
|
|
23382
|
-
import
|
|
23519
|
+
import colors14 from "picocolors";
|
|
23383
23520
|
|
|
23384
23521
|
// src/cli/platform/device-auth.ts
|
|
23385
23522
|
function url(apiUrl, path74) {
|
|
@@ -23447,7 +23584,7 @@ async function login() {
|
|
|
23447
23584
|
try {
|
|
23448
23585
|
const device = await requestDeviceCode(apiUrl);
|
|
23449
23586
|
printDiagnosticsToConsole(
|
|
23450
|
-
`Your login code: ${
|
|
23587
|
+
`Your login code: ${colors14.bold(colors14.white(device.userCode))}`
|
|
23451
23588
|
);
|
|
23452
23589
|
printHintToConsole(
|
|
23453
23590
|
"We'll open your browser to confirm this code and sign in. Come back to this terminal once you're done."
|
|
@@ -23467,12 +23604,19 @@ ${device.verificationUriComplete}`
|
|
|
23467
23604
|
}
|
|
23468
23605
|
const deadline = Date.now() + device.expiresIn * 1e3;
|
|
23469
23606
|
const intervalMs = Math.max(1, device.interval) * 1e3;
|
|
23607
|
+
const spinner = createSpinner("Waiting for browser confirmation...");
|
|
23470
23608
|
while (Date.now() < deadline) {
|
|
23471
23609
|
await sleep4(intervalMs);
|
|
23472
|
-
const result = await pollDeviceToken(apiUrl, device.deviceCode)
|
|
23610
|
+
const result = await pollDeviceToken(apiUrl, device.deviceCode).catch(
|
|
23611
|
+
(error) => {
|
|
23612
|
+
spinner.stop();
|
|
23613
|
+
throw error;
|
|
23614
|
+
}
|
|
23615
|
+
);
|
|
23473
23616
|
if (result.status === "pending") {
|
|
23474
23617
|
continue;
|
|
23475
23618
|
}
|
|
23619
|
+
spinner.stop();
|
|
23476
23620
|
if (result.status === "denied") {
|
|
23477
23621
|
await printCriticalFailureToConsoleAndExit("Login request was denied.");
|
|
23478
23622
|
return;
|
|
@@ -23499,6 +23643,7 @@ ${device.verificationUriComplete}`
|
|
|
23499
23643
|
);
|
|
23500
23644
|
return;
|
|
23501
23645
|
}
|
|
23646
|
+
spinner.stop();
|
|
23502
23647
|
await printCriticalFailureToConsoleAndExit(
|
|
23503
23648
|
"Login code expired. Run `apitogo login` again."
|
|
23504
23649
|
);
|
|
@@ -23587,6 +23732,8 @@ async function createProject(argv) {
|
|
|
23587
23732
|
return;
|
|
23588
23733
|
}
|
|
23589
23734
|
const client = new PlatformApiClient(config2);
|
|
23735
|
+
const progress = createConsoleProgressReporter();
|
|
23736
|
+
progress.onStep("Creating project...");
|
|
23590
23737
|
let result;
|
|
23591
23738
|
try {
|
|
23592
23739
|
result = await handleBootstrapProject(
|
|
@@ -23600,7 +23747,7 @@ async function createProject(argv) {
|
|
|
23600
23747
|
wait: argv.wait !== false,
|
|
23601
23748
|
configureGatewayBaseline: false
|
|
23602
23749
|
},
|
|
23603
|
-
|
|
23750
|
+
progress
|
|
23604
23751
|
);
|
|
23605
23752
|
} catch (error) {
|
|
23606
23753
|
await printCriticalFailureToConsoleAndExit(
|
|
@@ -23608,6 +23755,7 @@ async function createProject(argv) {
|
|
|
23608
23755
|
);
|
|
23609
23756
|
return;
|
|
23610
23757
|
}
|
|
23758
|
+
progress.stop();
|
|
23611
23759
|
console.log(result);
|
|
23612
23760
|
if (resultLooksFailed2(result)) {
|
|
23613
23761
|
process.exit(1);
|
|
@@ -24063,7 +24211,11 @@ async function status(argv) {
|
|
|
24063
24211
|
const client = new PlatformApiClient(config2);
|
|
24064
24212
|
let whoamiJson;
|
|
24065
24213
|
try {
|
|
24066
|
-
whoamiJson = await
|
|
24214
|
+
whoamiJson = await withSpinner(
|
|
24215
|
+
"Checking account...",
|
|
24216
|
+
() => handleWhoami(client),
|
|
24217
|
+
{ silent: argv.json }
|
|
24218
|
+
);
|
|
24067
24219
|
} catch (error) {
|
|
24068
24220
|
await printCriticalFailureToConsoleAndExit(
|
|
24069
24221
|
error instanceof Error ? error.message : String(error)
|
|
@@ -24081,17 +24233,25 @@ async function status(argv) {
|
|
|
24081
24233
|
let live = null;
|
|
24082
24234
|
let liveError = null;
|
|
24083
24235
|
if (projectId) {
|
|
24084
|
-
const projectJson = await
|
|
24085
|
-
|
|
24086
|
-
|
|
24087
|
-
|
|
24236
|
+
const projectJson = await withSpinner(
|
|
24237
|
+
"Fetching project status...",
|
|
24238
|
+
() => handleGetProject(client, config2, {
|
|
24239
|
+
projectId,
|
|
24240
|
+
includeInfrastructureStatus: true
|
|
24241
|
+
}),
|
|
24242
|
+
{ silent: argv.json }
|
|
24243
|
+
);
|
|
24088
24244
|
project = JSON.parse(projectJson);
|
|
24089
24245
|
if (!argv.skipLive) {
|
|
24090
24246
|
try {
|
|
24091
|
-
const liveJson = await
|
|
24092
|
-
|
|
24093
|
-
|
|
24094
|
-
|
|
24247
|
+
const liveJson = await withSpinner(
|
|
24248
|
+
"Verifying live site...",
|
|
24249
|
+
() => handleVerifyDevPortalLive(client, config2, {
|
|
24250
|
+
projectId,
|
|
24251
|
+
sourceDirectory
|
|
24252
|
+
}),
|
|
24253
|
+
{ silent: argv.json }
|
|
24254
|
+
);
|
|
24095
24255
|
live = JSON.parse(liveJson);
|
|
24096
24256
|
} catch (error) {
|
|
24097
24257
|
liveError = error instanceof Error ? error.message : String(error);
|
|
@@ -24176,6 +24336,7 @@ async function teardown(argv) {
|
|
|
24176
24336
|
);
|
|
24177
24337
|
return;
|
|
24178
24338
|
}
|
|
24339
|
+
const progress = createConsoleProgressReporter();
|
|
24179
24340
|
let result;
|
|
24180
24341
|
try {
|
|
24181
24342
|
result = await handleTeardownProject(
|
|
@@ -24185,7 +24346,7 @@ async function teardown(argv) {
|
|
|
24185
24346
|
projectId,
|
|
24186
24347
|
wait: argv.wait !== false
|
|
24187
24348
|
},
|
|
24188
|
-
|
|
24349
|
+
progress
|
|
24189
24350
|
);
|
|
24190
24351
|
} catch (error) {
|
|
24191
24352
|
await printCriticalFailureToConsoleAndExit(
|
|
@@ -24193,6 +24354,7 @@ async function teardown(argv) {
|
|
|
24193
24354
|
);
|
|
24194
24355
|
return;
|
|
24195
24356
|
}
|
|
24357
|
+
progress.stop();
|
|
24196
24358
|
console.log(result);
|
|
24197
24359
|
if (resultLooksFailed3(result)) {
|
|
24198
24360
|
process.exit(1);
|
|
@@ -24235,7 +24397,7 @@ var teardown_default = {
|
|
|
24235
24397
|
init_package_json();
|
|
24236
24398
|
|
|
24237
24399
|
// src/cli/common/version-check.ts
|
|
24238
|
-
import
|
|
24400
|
+
import colors15 from "picocolors";
|
|
24239
24401
|
import { minVersion, satisfies } from "semver";
|
|
24240
24402
|
init_package_json();
|
|
24241
24403
|
var getPkgManager = () => {
|
|
@@ -24272,16 +24434,16 @@ var warnPackageVersionMismatch = () => {
|
|
|
24272
24434
|
return;
|
|
24273
24435
|
}
|
|
24274
24436
|
const pkgManager = getPkgManager();
|
|
24275
|
-
const message = `${
|
|
24437
|
+
const message = `${colors15.yellow("React version mismatch detected!")}
|
|
24276
24438
|
|
|
24277
24439
|
API ToGo requires specific versions of React
|
|
24278
24440
|
and React DOM to function correctly.
|
|
24279
24441
|
|
|
24280
|
-
Installed: ${
|
|
24281
|
-
Required: ${
|
|
24442
|
+
Installed: ${colors15.bold(`react@${installed.react}, react-dom@${installed["react-dom"]}`)}
|
|
24443
|
+
Required: ${colors15.green(`react@${required.react}, react-dom@${required["react-dom"]}`)}
|
|
24282
24444
|
|
|
24283
24445
|
To fix, run:
|
|
24284
|
-
${
|
|
24446
|
+
${colors15.cyan(`${pkgManager} install react@${minVersion(required.react)} react-dom@${minVersion(required["react-dom"])}`)}`;
|
|
24285
24447
|
if (isDeployJsonOnlyArgv()) {
|
|
24286
24448
|
printJsonOnlyErrorAndExit(
|
|
24287
24449
|
`React version mismatch. Installed react@${installed.react}, react-dom@${installed["react-dom"]}; required react@${required.react}, react-dom@${required["react-dom"]}. Run: ${pkgManager} install react@${minVersion(required.react)} react-dom@${minVersion(required["react-dom"])}`
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type Spinner = {
|
|
2
|
+
update(text: string): void;
|
|
3
|
+
log(line: string): void;
|
|
4
|
+
stop(): void;
|
|
5
|
+
};
|
|
6
|
+
type SpinnerOptions = {
|
|
7
|
+
stream?: NodeJS.WriteStream;
|
|
8
|
+
silent?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare function stopAllSpinners(): void;
|
|
11
|
+
export declare function createSpinner(initialText: string, { stream, silent }?: SpinnerOptions): Spinner;
|
|
12
|
+
export declare function withSpinner<T>(text: string, fn: (spinner: Spinner) => Promise<T>, options?: SpinnerOptions): Promise<T>;
|
|
13
|
+
export {};
|
|
@@ -38,7 +38,10 @@ export declare function buildProgressSummary(options: {
|
|
|
38
38
|
terminalStatus: string;
|
|
39
39
|
};
|
|
40
40
|
export declare function createMcpProgressReporter(extra?: McpToolExtra): ProgressReporter;
|
|
41
|
-
export
|
|
41
|
+
export type ConsoleProgressReporter = ProgressReporter & {
|
|
42
|
+
stop(): void;
|
|
43
|
+
};
|
|
44
|
+
export declare function createConsoleProgressReporter(stream?: NodeJS.WritableStream): ConsoleProgressReporter;
|
|
42
45
|
export interface PollableJobValue {
|
|
43
46
|
status: string;
|
|
44
47
|
messages?: JobLogMessage[];
|