@lukoweb/apitogo 0.1.146 → 0.1.147
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,106 @@ 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
|
+
stream.write(
|
|
5527
|
+
`\r\x1B[K${colors.cyan(FRAMES[frame++ % FRAMES.length])} ${text}${suffix}`
|
|
5528
|
+
);
|
|
5529
|
+
};
|
|
5530
|
+
stream.write("\x1B[?25l");
|
|
5531
|
+
cursorHidden = stream;
|
|
5532
|
+
process.once("exit", restoreCursor);
|
|
5533
|
+
render();
|
|
5534
|
+
timer = setInterval(render, INTERVAL_MS);
|
|
5535
|
+
timer.unref();
|
|
5536
|
+
const spinner = {
|
|
5537
|
+
update(next) {
|
|
5538
|
+
text = next;
|
|
5539
|
+
},
|
|
5540
|
+
log(line) {
|
|
5541
|
+
if (!timer) {
|
|
5542
|
+
stream.write(`${line}
|
|
5543
|
+
`);
|
|
5544
|
+
return;
|
|
5545
|
+
}
|
|
5546
|
+
clear();
|
|
5547
|
+
stream.write(`${line}
|
|
5548
|
+
`);
|
|
5549
|
+
render();
|
|
5550
|
+
},
|
|
5551
|
+
stop() {
|
|
5552
|
+
if (!timer) return;
|
|
5553
|
+
clearInterval(timer);
|
|
5554
|
+
timer = void 0;
|
|
5555
|
+
clear();
|
|
5556
|
+
restoreCursor();
|
|
5557
|
+
active.delete(spinner);
|
|
5558
|
+
}
|
|
5559
|
+
};
|
|
5560
|
+
active.add(spinner);
|
|
5561
|
+
return spinner;
|
|
5562
|
+
}
|
|
5563
|
+
async function withSpinner(text, fn, options) {
|
|
5564
|
+
const spinner = createSpinner(text, options);
|
|
5565
|
+
try {
|
|
5566
|
+
return await fn(spinner);
|
|
5567
|
+
} finally {
|
|
5568
|
+
spinner.stop();
|
|
5569
|
+
}
|
|
5570
|
+
}
|
|
5571
|
+
|
|
5572
|
+
// src/cli/common/output.ts
|
|
5474
5573
|
var symbols = {
|
|
5475
5574
|
success: "\u2714",
|
|
5476
5575
|
error: "\u2716",
|
|
@@ -5478,37 +5577,38 @@ var symbols = {
|
|
|
5478
5577
|
};
|
|
5479
5578
|
var withSymbol = (symbol, isTTY2) => isTTY2 ? `${symbol} ` : "";
|
|
5480
5579
|
function printDiagnosticsToConsole(message) {
|
|
5481
|
-
console.error(
|
|
5580
|
+
console.error(colors2.cyan(message));
|
|
5482
5581
|
}
|
|
5483
5582
|
function printSuccessToConsole(message) {
|
|
5484
5583
|
console.error(
|
|
5485
|
-
|
|
5584
|
+
colors2.green(
|
|
5486
5585
|
`${withSymbol(symbols.success, process.stderr.isTTY)}${message}`
|
|
5487
5586
|
)
|
|
5488
5587
|
);
|
|
5489
5588
|
}
|
|
5490
5589
|
function printHintToConsole(message) {
|
|
5491
|
-
console.error(
|
|
5590
|
+
console.error(colors2.dim(message));
|
|
5492
5591
|
}
|
|
5493
5592
|
function printWarningToConsole(message) {
|
|
5494
5593
|
console.error(
|
|
5495
|
-
|
|
5594
|
+
colors2.yellow(
|
|
5496
5595
|
`${withSymbol(symbols.warning, process.stderr.isTTY)}${message}`
|
|
5497
5596
|
)
|
|
5498
5597
|
);
|
|
5499
5598
|
}
|
|
5500
5599
|
function printErrorToConsole(message) {
|
|
5501
5600
|
console.error(
|
|
5502
|
-
|
|
5601
|
+
colors2.red(`${withSymbol(symbols.error, process.stderr.isTTY)}${message}`)
|
|
5503
5602
|
);
|
|
5504
5603
|
}
|
|
5505
5604
|
function printBoxToConsole(message) {
|
|
5506
5605
|
console.error(message);
|
|
5507
5606
|
}
|
|
5508
5607
|
async function printCriticalFailureToConsoleAndExit(message) {
|
|
5608
|
+
stopAllSpinners();
|
|
5509
5609
|
const text = typeof message === "string" && message.trim() === "" ? "Command failed with no further details." : message;
|
|
5510
5610
|
console.error(
|
|
5511
|
-
`${
|
|
5611
|
+
`${colors2.bold(colors2.red(`${withSymbol(symbols.error, process.stderr.isTTY)}Error:`))} ${colors2.red(text)}`
|
|
5512
5612
|
);
|
|
5513
5613
|
await Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
|
|
5514
5614
|
process.exit(1);
|
|
@@ -5520,8 +5620,8 @@ function printJsonOnlyErrorAndExit(message) {
|
|
|
5520
5620
|
}
|
|
5521
5621
|
function printResultToConsole(message) {
|
|
5522
5622
|
console.log(
|
|
5523
|
-
|
|
5524
|
-
|
|
5623
|
+
colors2.bold(
|
|
5624
|
+
colors2.green(
|
|
5525
5625
|
`${withSymbol(symbols.success, process.stdout.isTTY)}${message}`
|
|
5526
5626
|
)
|
|
5527
5627
|
)
|
|
@@ -5529,7 +5629,7 @@ function printResultToConsole(message) {
|
|
|
5529
5629
|
}
|
|
5530
5630
|
|
|
5531
5631
|
// src/cli/common/utils/box.ts
|
|
5532
|
-
import
|
|
5632
|
+
import colors3 from "picocolors";
|
|
5533
5633
|
import stripAnsi from "strip-ansi";
|
|
5534
5634
|
var border = ["\u2500", "\u256D", "\u256E", "\u2502", "\u2502", "\u2570", "\u256F"];
|
|
5535
5635
|
var nothing = ["\u2500", "", "", "", "", "", ""];
|
|
@@ -5541,7 +5641,7 @@ function box(message, {
|
|
|
5541
5641
|
} = {}) {
|
|
5542
5642
|
const lines = message.split(/\r?\n/).map((line) => [line, stripAnsi(line).length]);
|
|
5543
5643
|
const maxLine = lines.reduce((p, [, len]) => Math.max(p, len), 0);
|
|
5544
|
-
const borderColorFn = borderColor &&
|
|
5644
|
+
const borderColorFn = borderColor && colors3[borderColor] || colors3.yellow;
|
|
5545
5645
|
const clampedSidePadding = Math.max(1, padding * 3);
|
|
5546
5646
|
const narrowMode = maxLine + 2 + clampedSidePadding * 2 > cols;
|
|
5547
5647
|
const sidePadding = narrowMode ? 0 : clampedSidePadding;
|
|
@@ -5622,12 +5722,12 @@ async function warnIfOutdatedVersion(currentVersion) {
|
|
|
5622
5722
|
if (shouldWarn) {
|
|
5623
5723
|
printBoxToConsole(
|
|
5624
5724
|
box(
|
|
5625
|
-
`Update available! ${
|
|
5725
|
+
`Update available! ${colors4.gray(`v${currentVersion}`)} \u226B ${colors4.green(
|
|
5626
5726
|
`v${versionCheckInfo.latestVersion}`
|
|
5627
5727
|
)}
|
|
5628
|
-
Run ${
|
|
5728
|
+
Run ${colors4.cyan("npm install apitogo@latest")} to update.
|
|
5629
5729
|
|
|
5630
|
-
${
|
|
5730
|
+
${colors4.gray("Upgrade to receive the latest features and fixes.")}`
|
|
5631
5731
|
)
|
|
5632
5732
|
);
|
|
5633
5733
|
}
|
|
@@ -5836,7 +5936,7 @@ init_joinUrl();
|
|
|
5836
5936
|
// src/vite/config.ts
|
|
5837
5937
|
import path26 from "node:path";
|
|
5838
5938
|
import dotenv from "dotenv";
|
|
5839
|
-
import
|
|
5939
|
+
import colors8 from "picocolors";
|
|
5840
5940
|
import {
|
|
5841
5941
|
loadConfigFromFile,
|
|
5842
5942
|
mergeConfig as mergeConfig2
|
|
@@ -5845,7 +5945,7 @@ import {
|
|
|
5845
5945
|
// package.json
|
|
5846
5946
|
var package_default = {
|
|
5847
5947
|
name: "@lukoweb/apitogo",
|
|
5848
|
-
version: "0.1.
|
|
5948
|
+
version: "0.1.147",
|
|
5849
5949
|
type: "module",
|
|
5850
5950
|
sideEffects: [
|
|
5851
5951
|
"**/*.css",
|
|
@@ -7913,7 +8013,7 @@ var SchemaManager = class {
|
|
|
7913
8013
|
init_logger();
|
|
7914
8014
|
init_loader();
|
|
7915
8015
|
import path14 from "node:path";
|
|
7916
|
-
import
|
|
8016
|
+
import colors7 from "picocolors";
|
|
7917
8017
|
|
|
7918
8018
|
// src/vite/plugin-navigation.ts
|
|
7919
8019
|
init_loader();
|
|
@@ -8220,7 +8320,7 @@ var viteConfigReloadPlugin = () => ({
|
|
|
8220
8320
|
invalidate(server);
|
|
8221
8321
|
reload(server);
|
|
8222
8322
|
logger.info(
|
|
8223
|
-
|
|
8323
|
+
colors7.blue(
|
|
8224
8324
|
`Config ${path14.basename(currentConfig.__meta.configPath)} changed. Reloading...`
|
|
8225
8325
|
),
|
|
8226
8326
|
{ timestamp: true }
|
|
@@ -9930,9 +10030,9 @@ async function getViteConfig(dir, configEnv) {
|
|
|
9930
10030
|
const cdnUrl = CdnUrlSchema.parse(config2.cdnUrl);
|
|
9931
10031
|
const base = cdnUrl?.base ? joinUrl(cdnUrl.base, config2.basePath) : config2.basePath;
|
|
9932
10032
|
if (cdnUrl && !hasLoggedCdnInfo) {
|
|
9933
|
-
logger.info(
|
|
9934
|
-
logger.info(
|
|
9935
|
-
logger.info(
|
|
10033
|
+
logger.info(colors8.blue(`Using CDN URL:`));
|
|
10034
|
+
logger.info(colors8.blue(` base: `) + colors8.dim(cdnUrl.base));
|
|
10035
|
+
logger.info(colors8.blue(` media: `) + colors8.dim(cdnUrl.media));
|
|
9936
10036
|
hasLoggedCdnInfo = true;
|
|
9937
10037
|
}
|
|
9938
10038
|
const publicVarsProcessEnvDefine = Object.fromEntries(
|
|
@@ -10082,7 +10182,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
10082
10182
|
if (!loaded) continue;
|
|
10083
10183
|
mergedViteConfig = mergeConfig2(mergedViteConfig, loaded.config, true);
|
|
10084
10184
|
if (root === dir) {
|
|
10085
|
-
logger.info(
|
|
10185
|
+
logger.info(colors8.blue(`merged with custom user Vite config`), {
|
|
10086
10186
|
timestamp: true
|
|
10087
10187
|
});
|
|
10088
10188
|
}
|
|
@@ -10218,7 +10318,7 @@ import os from "node:os";
|
|
|
10218
10318
|
import path30 from "node:path";
|
|
10219
10319
|
import { pathToFileURL } from "node:url";
|
|
10220
10320
|
import { createIndex } from "pagefind";
|
|
10221
|
-
import
|
|
10321
|
+
import colors11 from "picocolors";
|
|
10222
10322
|
import PiscinaImport from "piscina";
|
|
10223
10323
|
init_transform_config();
|
|
10224
10324
|
init_invariant();
|
|
@@ -10258,7 +10358,7 @@ init_joinUrl();
|
|
|
10258
10358
|
import { createWriteStream, existsSync as existsSync3 } from "node:fs";
|
|
10259
10359
|
import { mkdir as mkdir4 } from "node:fs/promises";
|
|
10260
10360
|
import path28 from "node:path";
|
|
10261
|
-
import
|
|
10361
|
+
import colors9 from "picocolors";
|
|
10262
10362
|
import { SitemapStream } from "sitemap";
|
|
10263
10363
|
async function generateSitemap({
|
|
10264
10364
|
outputUrls,
|
|
@@ -10299,7 +10399,7 @@ async function generateSitemap({
|
|
|
10299
10399
|
writeStream.on("error", reject);
|
|
10300
10400
|
});
|
|
10301
10401
|
console.debug(
|
|
10302
|
-
|
|
10402
|
+
colors9.blue(`\u2713 wrote sitemap to ${colors9.bold(sitemapOutputPath)}`)
|
|
10303
10403
|
);
|
|
10304
10404
|
}
|
|
10305
10405
|
|
|
@@ -10391,12 +10491,12 @@ var prerender = async ({
|
|
|
10391
10491
|
const writeProgress = throttle(
|
|
10392
10492
|
(count, total, urlPath) => {
|
|
10393
10493
|
if (quietDeployJson) return;
|
|
10394
|
-
writeLine(`prerendering (${count}/${total}) ${
|
|
10494
|
+
writeLine(`prerendering (${count}/${total}) ${colors11.dim(urlPath)}`);
|
|
10395
10495
|
}
|
|
10396
10496
|
);
|
|
10397
10497
|
if (!isTTY() && !quietDeployJson) {
|
|
10398
10498
|
logger.info(
|
|
10399
|
-
|
|
10499
|
+
colors11.dim(
|
|
10400
10500
|
`prerendering ${paths.length} routes using ${maxThreads} workers...`
|
|
10401
10501
|
)
|
|
10402
10502
|
);
|
|
@@ -10440,7 +10540,7 @@ var prerender = async ({
|
|
|
10440
10540
|
const now = performance.now();
|
|
10441
10541
|
if (now - lastLogTime >= LOG_INTERVAL_MS) {
|
|
10442
10542
|
logger.info(
|
|
10443
|
-
|
|
10543
|
+
colors11.blue(
|
|
10444
10544
|
`prerendered ${completedCount}/${paths.length} routes using ${maxThreads} workers`
|
|
10445
10545
|
)
|
|
10446
10546
|
);
|
|
@@ -10457,14 +10557,14 @@ var prerender = async ({
|
|
|
10457
10557
|
const message = `\u2713 finished prerendering ${paths.length} routes in ${seconds} seconds using ${maxThreads} workers`;
|
|
10458
10558
|
if (!quietDeployJson) {
|
|
10459
10559
|
if (isTTY()) {
|
|
10460
|
-
writeLine(
|
|
10560
|
+
writeLine(colors11.blue(`${message}
|
|
10461
10561
|
`));
|
|
10462
10562
|
} else {
|
|
10463
|
-
logger.info(
|
|
10563
|
+
logger.info(colors11.blue(message));
|
|
10464
10564
|
}
|
|
10465
10565
|
if (pagefindWriteResult?.outputPath) {
|
|
10466
10566
|
logger.info(
|
|
10467
|
-
|
|
10567
|
+
colors11.blue(
|
|
10468
10568
|
`\u2713 pagefind index built: ${pagefindWriteResult.outputPath}`
|
|
10469
10569
|
)
|
|
10470
10570
|
);
|
|
@@ -14091,10 +14191,14 @@ async function check(argv) {
|
|
|
14091
14191
|
const client = new PlatformApiClient(config2);
|
|
14092
14192
|
let result;
|
|
14093
14193
|
try {
|
|
14094
|
-
result = await
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
|
|
14194
|
+
result = await withSpinner(
|
|
14195
|
+
"Checking publish readiness...",
|
|
14196
|
+
() => checkPublishReadiness(client, config2, {
|
|
14197
|
+
sourceDirectory,
|
|
14198
|
+
validateBuild: argv.validateBuild === true
|
|
14199
|
+
}),
|
|
14200
|
+
{ silent: argv.json }
|
|
14201
|
+
);
|
|
14098
14202
|
} catch (error) {
|
|
14099
14203
|
await printCriticalFailureToConsoleAndExit(
|
|
14100
14204
|
error instanceof Error ? error.message : String(error)
|
|
@@ -15955,7 +16059,7 @@ import { stdin as input, stdout as output } from "node:process";
|
|
|
15955
16059
|
import { createInterface } from "node:readline/promises";
|
|
15956
16060
|
|
|
15957
16061
|
// src/cli/make-config/wrap-up.ts
|
|
15958
|
-
import
|
|
16062
|
+
import colors12 from "picocolors";
|
|
15959
16063
|
var DOCS = "https://docs.apitogo.com";
|
|
15960
16064
|
function printPageAddedHint(relativePath, routePath) {
|
|
15961
16065
|
printSuccessToConsole(`Page created: ${relativePath} (route ${routePath})`);
|
|
@@ -15979,7 +16083,7 @@ function printPaidPlanPlatformWarning() {
|
|
|
15979
16083
|
function printInteractiveWrapUp(hasPaidPlans) {
|
|
15980
16084
|
printDiagnosticsToConsole("");
|
|
15981
16085
|
printSuccessToConsole("Configuration is done. Next steps:");
|
|
15982
|
-
printDiagnosticsToConsole(`- Preview locally: ${
|
|
16086
|
+
printDiagnosticsToConsole(`- Preview locally: ${colors12.bold("npm run dev")}`);
|
|
15983
16087
|
if (hasPaidPlans) {
|
|
15984
16088
|
printPaidPlanPlatformWarning();
|
|
15985
16089
|
} else {
|
|
@@ -15988,7 +16092,7 @@ function printInteractiveWrapUp(hasPaidPlans) {
|
|
|
15988
16092
|
);
|
|
15989
16093
|
}
|
|
15990
16094
|
printDiagnosticsToConsole("");
|
|
15991
|
-
printDiagnosticsToConsole(
|
|
16095
|
+
printDiagnosticsToConsole(colors12.bold("Configure more:"));
|
|
15992
16096
|
printHintToConsole(`- Overview: ${DOCS}/docs/configuration/overview`);
|
|
15993
16097
|
printDiagnosticsToConsole(
|
|
15994
16098
|
`- Gateway plans: ${DOCS}/docs/configuration/plans`
|
|
@@ -16972,30 +17076,50 @@ function buildProgressSummary(options) {
|
|
|
16972
17076
|
};
|
|
16973
17077
|
}
|
|
16974
17078
|
function createConsoleProgressReporter(stream = process.stderr) {
|
|
16975
|
-
|
|
17079
|
+
const shared = { spinner: void 0 };
|
|
17080
|
+
return {
|
|
17081
|
+
...createScopedConsoleProgressReporter(stream, void 0, shared),
|
|
17082
|
+
stop() {
|
|
17083
|
+
shared.spinner?.stop();
|
|
17084
|
+
shared.spinner = void 0;
|
|
17085
|
+
}
|
|
17086
|
+
};
|
|
16976
17087
|
}
|
|
16977
|
-
function createScopedConsoleProgressReporter(stream, stepLabel) {
|
|
17088
|
+
function createScopedConsoleProgressReporter(stream, stepLabel, shared) {
|
|
16978
17089
|
let lastMessageCount = 0;
|
|
16979
17090
|
let lastLine;
|
|
17091
|
+
const animated = "isTTY" in stream && Boolean(stream.isTTY);
|
|
17092
|
+
const writeLine2 = (line) => shared.spinner ? shared.spinner.log(line) : stream.write(`${line}
|
|
17093
|
+
`);
|
|
16980
17094
|
const reporter = {
|
|
16981
17095
|
async onStep(step, detail) {
|
|
16982
17096
|
const message = detail?.message ?? (detail?.platformStatus ? `${step}: ${detail.platformStatus}` : step);
|
|
16983
17097
|
const line = stepLabel ? `[${stepLabel}] ${message}` : message;
|
|
16984
17098
|
if (line === lastLine) return;
|
|
16985
17099
|
lastLine = line;
|
|
16986
|
-
|
|
17100
|
+
if (!animated) {
|
|
17101
|
+
stream.write(`${line}
|
|
16987
17102
|
`);
|
|
17103
|
+
return;
|
|
17104
|
+
}
|
|
17105
|
+
if (shared.spinner) {
|
|
17106
|
+
shared.spinner.update(line);
|
|
17107
|
+
} else {
|
|
17108
|
+
shared.spinner = createSpinner(line, {
|
|
17109
|
+
stream
|
|
17110
|
+
});
|
|
17111
|
+
}
|
|
16988
17112
|
},
|
|
16989
17113
|
async onNewMessages(messages) {
|
|
16990
17114
|
for (const entry of messages) {
|
|
16991
|
-
|
|
16992
|
-
|
|
16993
|
-
|
|
17115
|
+
writeLine2(
|
|
17116
|
+
stepLabel ? `[${stepLabel}] ${entry.message}` : entry.message
|
|
17117
|
+
);
|
|
16994
17118
|
}
|
|
16995
17119
|
},
|
|
16996
17120
|
isCancelled: () => false,
|
|
16997
17121
|
child(label) {
|
|
16998
|
-
return createScopedConsoleProgressReporter(stream, label);
|
|
17122
|
+
return createScopedConsoleProgressReporter(stream, label, shared);
|
|
16999
17123
|
}
|
|
17000
17124
|
};
|
|
17001
17125
|
const baseOnNewMessages = reporter.onNewMessages.bind(reporter);
|
|
@@ -20414,9 +20538,9 @@ function findBackendUpdateJob(jobs, options) {
|
|
|
20414
20538
|
if (options?.jobId) {
|
|
20415
20539
|
return sorted.find((job) => job.id === options.jobId) ?? null;
|
|
20416
20540
|
}
|
|
20417
|
-
const
|
|
20418
|
-
if (
|
|
20419
|
-
return
|
|
20541
|
+
const active2 = sorted.find(isActiveBackendUpdateJob);
|
|
20542
|
+
if (active2) {
|
|
20543
|
+
return active2;
|
|
20420
20544
|
}
|
|
20421
20545
|
const baseline = options?.baselineJobIds;
|
|
20422
20546
|
if (baseline) {
|
|
@@ -22115,7 +22239,7 @@ function formatResultForHuman(parsed) {
|
|
|
22115
22239
|
import { stdin as input3, stdout as output2 } from "node:process";
|
|
22116
22240
|
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
22117
22241
|
import open from "open";
|
|
22118
|
-
import
|
|
22242
|
+
import colors13 from "picocolors";
|
|
22119
22243
|
var PLAN_CHOICES = [
|
|
22120
22244
|
"free",
|
|
22121
22245
|
"starter",
|
|
@@ -22134,7 +22258,7 @@ function printPlanCatalog(payload) {
|
|
|
22134
22258
|
const plan = entry;
|
|
22135
22259
|
printDiagnosticsToConsole("");
|
|
22136
22260
|
printDiagnosticsToConsole(
|
|
22137
|
-
|
|
22261
|
+
colors13.bold(`${plan.displayName} \u2014 ${plan.priceLabel}`)
|
|
22138
22262
|
);
|
|
22139
22263
|
if (plan.summary) {
|
|
22140
22264
|
printHintToConsole(` ${plan.summary}`);
|
|
@@ -22354,6 +22478,13 @@ async function apply(argv) {
|
|
|
22354
22478
|
await progress.onStep(
|
|
22355
22479
|
`Starting deploy from ${sourceDirectory}... this may take a few minutes.`
|
|
22356
22480
|
);
|
|
22481
|
+
const runOnceAndStop = async (plan) => {
|
|
22482
|
+
try {
|
|
22483
|
+
return await runOnce(plan);
|
|
22484
|
+
} finally {
|
|
22485
|
+
progress.stop();
|
|
22486
|
+
}
|
|
22487
|
+
};
|
|
22357
22488
|
let effectiveProjectId = argv.projectId?.trim();
|
|
22358
22489
|
let effectiveProjectName = argv.projectName?.trim();
|
|
22359
22490
|
let createNewProject = false;
|
|
@@ -22377,7 +22508,7 @@ async function apply(argv) {
|
|
|
22377
22508
|
);
|
|
22378
22509
|
let result;
|
|
22379
22510
|
try {
|
|
22380
|
-
result = await
|
|
22511
|
+
result = await runOnceAndStop(platformPlan);
|
|
22381
22512
|
} catch (error) {
|
|
22382
22513
|
await printCriticalFailureToConsoleAndExit(
|
|
22383
22514
|
error instanceof Error ? error.message : String(error)
|
|
@@ -22396,7 +22527,7 @@ async function apply(argv) {
|
|
|
22396
22527
|
effectiveProjectName = resolution.projectName;
|
|
22397
22528
|
createNewProject = true;
|
|
22398
22529
|
try {
|
|
22399
|
-
result = await
|
|
22530
|
+
result = await runOnceAndStop(platformPlan);
|
|
22400
22531
|
} catch (error) {
|
|
22401
22532
|
await printCriticalFailureToConsoleAndExit(
|
|
22402
22533
|
error instanceof Error ? error.message : String(error)
|
|
@@ -22421,7 +22552,7 @@ async function apply(argv) {
|
|
|
22421
22552
|
createNewProject = true;
|
|
22422
22553
|
}
|
|
22423
22554
|
try {
|
|
22424
|
-
result = await
|
|
22555
|
+
result = await runOnceAndStop(platformPlan);
|
|
22425
22556
|
} catch (error) {
|
|
22426
22557
|
await printCriticalFailureToConsoleAndExit(
|
|
22427
22558
|
error instanceof Error ? error.message : String(error)
|
|
@@ -22452,7 +22583,7 @@ async function apply(argv) {
|
|
|
22452
22583
|
createNewProject = false;
|
|
22453
22584
|
}
|
|
22454
22585
|
try {
|
|
22455
|
-
result = await
|
|
22586
|
+
result = await runOnceAndStop(void 0);
|
|
22456
22587
|
} catch (error) {
|
|
22457
22588
|
await printCriticalFailureToConsoleAndExit(
|
|
22458
22589
|
error instanceof Error ? error.message : String(error)
|
|
@@ -23270,10 +23401,11 @@ async function init2(argv) {
|
|
|
23270
23401
|
);
|
|
23271
23402
|
let npmInstall = null;
|
|
23272
23403
|
if (install) {
|
|
23273
|
-
|
|
23274
|
-
|
|
23275
|
-
|
|
23276
|
-
|
|
23404
|
+
npmInstall = await withSpinner(
|
|
23405
|
+
"Installing npm dependencies\u2026",
|
|
23406
|
+
() => runNpmInstall(result.outputDirectory),
|
|
23407
|
+
{ silent: json }
|
|
23408
|
+
);
|
|
23277
23409
|
}
|
|
23278
23410
|
const { openApiDiscovery, docsDiscovery, backendDiscovery } = await runScaffoldDiscovery(result.outputDirectory, { openapiSearch });
|
|
23279
23411
|
const siteValidation = await validateDevPortalSiteConfig(
|
|
@@ -23379,7 +23511,7 @@ var init_default = {
|
|
|
23379
23511
|
// src/cli/login/handler.ts
|
|
23380
23512
|
import readline from "node:readline/promises";
|
|
23381
23513
|
import open2 from "open";
|
|
23382
|
-
import
|
|
23514
|
+
import colors14 from "picocolors";
|
|
23383
23515
|
|
|
23384
23516
|
// src/cli/platform/device-auth.ts
|
|
23385
23517
|
function url(apiUrl, path74) {
|
|
@@ -23447,7 +23579,7 @@ async function login() {
|
|
|
23447
23579
|
try {
|
|
23448
23580
|
const device = await requestDeviceCode(apiUrl);
|
|
23449
23581
|
printDiagnosticsToConsole(
|
|
23450
|
-
`Your login code: ${
|
|
23582
|
+
`Your login code: ${colors14.bold(colors14.white(device.userCode))}`
|
|
23451
23583
|
);
|
|
23452
23584
|
printHintToConsole(
|
|
23453
23585
|
"We'll open your browser to confirm this code and sign in. Come back to this terminal once you're done."
|
|
@@ -23467,12 +23599,19 @@ ${device.verificationUriComplete}`
|
|
|
23467
23599
|
}
|
|
23468
23600
|
const deadline = Date.now() + device.expiresIn * 1e3;
|
|
23469
23601
|
const intervalMs = Math.max(1, device.interval) * 1e3;
|
|
23602
|
+
const spinner = createSpinner("Waiting for browser confirmation...");
|
|
23470
23603
|
while (Date.now() < deadline) {
|
|
23471
23604
|
await sleep4(intervalMs);
|
|
23472
|
-
const result = await pollDeviceToken(apiUrl, device.deviceCode)
|
|
23605
|
+
const result = await pollDeviceToken(apiUrl, device.deviceCode).catch(
|
|
23606
|
+
(error) => {
|
|
23607
|
+
spinner.stop();
|
|
23608
|
+
throw error;
|
|
23609
|
+
}
|
|
23610
|
+
);
|
|
23473
23611
|
if (result.status === "pending") {
|
|
23474
23612
|
continue;
|
|
23475
23613
|
}
|
|
23614
|
+
spinner.stop();
|
|
23476
23615
|
if (result.status === "denied") {
|
|
23477
23616
|
await printCriticalFailureToConsoleAndExit("Login request was denied.");
|
|
23478
23617
|
return;
|
|
@@ -23499,6 +23638,7 @@ ${device.verificationUriComplete}`
|
|
|
23499
23638
|
);
|
|
23500
23639
|
return;
|
|
23501
23640
|
}
|
|
23641
|
+
spinner.stop();
|
|
23502
23642
|
await printCriticalFailureToConsoleAndExit(
|
|
23503
23643
|
"Login code expired. Run `apitogo login` again."
|
|
23504
23644
|
);
|
|
@@ -23587,6 +23727,8 @@ async function createProject(argv) {
|
|
|
23587
23727
|
return;
|
|
23588
23728
|
}
|
|
23589
23729
|
const client = new PlatformApiClient(config2);
|
|
23730
|
+
const progress = createConsoleProgressReporter();
|
|
23731
|
+
progress.onStep("Creating project...");
|
|
23590
23732
|
let result;
|
|
23591
23733
|
try {
|
|
23592
23734
|
result = await handleBootstrapProject(
|
|
@@ -23600,7 +23742,7 @@ async function createProject(argv) {
|
|
|
23600
23742
|
wait: argv.wait !== false,
|
|
23601
23743
|
configureGatewayBaseline: false
|
|
23602
23744
|
},
|
|
23603
|
-
|
|
23745
|
+
progress
|
|
23604
23746
|
);
|
|
23605
23747
|
} catch (error) {
|
|
23606
23748
|
await printCriticalFailureToConsoleAndExit(
|
|
@@ -23608,6 +23750,7 @@ async function createProject(argv) {
|
|
|
23608
23750
|
);
|
|
23609
23751
|
return;
|
|
23610
23752
|
}
|
|
23753
|
+
progress.stop();
|
|
23611
23754
|
console.log(result);
|
|
23612
23755
|
if (resultLooksFailed2(result)) {
|
|
23613
23756
|
process.exit(1);
|
|
@@ -24063,7 +24206,11 @@ async function status(argv) {
|
|
|
24063
24206
|
const client = new PlatformApiClient(config2);
|
|
24064
24207
|
let whoamiJson;
|
|
24065
24208
|
try {
|
|
24066
|
-
whoamiJson = await
|
|
24209
|
+
whoamiJson = await withSpinner(
|
|
24210
|
+
"Checking account...",
|
|
24211
|
+
() => handleWhoami(client),
|
|
24212
|
+
{ silent: argv.json }
|
|
24213
|
+
);
|
|
24067
24214
|
} catch (error) {
|
|
24068
24215
|
await printCriticalFailureToConsoleAndExit(
|
|
24069
24216
|
error instanceof Error ? error.message : String(error)
|
|
@@ -24081,17 +24228,25 @@ async function status(argv) {
|
|
|
24081
24228
|
let live = null;
|
|
24082
24229
|
let liveError = null;
|
|
24083
24230
|
if (projectId) {
|
|
24084
|
-
const projectJson = await
|
|
24085
|
-
|
|
24086
|
-
|
|
24087
|
-
|
|
24231
|
+
const projectJson = await withSpinner(
|
|
24232
|
+
"Fetching project status...",
|
|
24233
|
+
() => handleGetProject(client, config2, {
|
|
24234
|
+
projectId,
|
|
24235
|
+
includeInfrastructureStatus: true
|
|
24236
|
+
}),
|
|
24237
|
+
{ silent: argv.json }
|
|
24238
|
+
);
|
|
24088
24239
|
project = JSON.parse(projectJson);
|
|
24089
24240
|
if (!argv.skipLive) {
|
|
24090
24241
|
try {
|
|
24091
|
-
const liveJson = await
|
|
24092
|
-
|
|
24093
|
-
|
|
24094
|
-
|
|
24242
|
+
const liveJson = await withSpinner(
|
|
24243
|
+
"Verifying live site...",
|
|
24244
|
+
() => handleVerifyDevPortalLive(client, config2, {
|
|
24245
|
+
projectId,
|
|
24246
|
+
sourceDirectory
|
|
24247
|
+
}),
|
|
24248
|
+
{ silent: argv.json }
|
|
24249
|
+
);
|
|
24095
24250
|
live = JSON.parse(liveJson);
|
|
24096
24251
|
} catch (error) {
|
|
24097
24252
|
liveError = error instanceof Error ? error.message : String(error);
|
|
@@ -24176,6 +24331,7 @@ async function teardown(argv) {
|
|
|
24176
24331
|
);
|
|
24177
24332
|
return;
|
|
24178
24333
|
}
|
|
24334
|
+
const progress = createConsoleProgressReporter();
|
|
24179
24335
|
let result;
|
|
24180
24336
|
try {
|
|
24181
24337
|
result = await handleTeardownProject(
|
|
@@ -24185,7 +24341,7 @@ async function teardown(argv) {
|
|
|
24185
24341
|
projectId,
|
|
24186
24342
|
wait: argv.wait !== false
|
|
24187
24343
|
},
|
|
24188
|
-
|
|
24344
|
+
progress
|
|
24189
24345
|
);
|
|
24190
24346
|
} catch (error) {
|
|
24191
24347
|
await printCriticalFailureToConsoleAndExit(
|
|
@@ -24193,6 +24349,7 @@ async function teardown(argv) {
|
|
|
24193
24349
|
);
|
|
24194
24350
|
return;
|
|
24195
24351
|
}
|
|
24352
|
+
progress.stop();
|
|
24196
24353
|
console.log(result);
|
|
24197
24354
|
if (resultLooksFailed3(result)) {
|
|
24198
24355
|
process.exit(1);
|
|
@@ -24235,7 +24392,7 @@ var teardown_default = {
|
|
|
24235
24392
|
init_package_json();
|
|
24236
24393
|
|
|
24237
24394
|
// src/cli/common/version-check.ts
|
|
24238
|
-
import
|
|
24395
|
+
import colors15 from "picocolors";
|
|
24239
24396
|
import { minVersion, satisfies } from "semver";
|
|
24240
24397
|
init_package_json();
|
|
24241
24398
|
var getPkgManager = () => {
|
|
@@ -24272,16 +24429,16 @@ var warnPackageVersionMismatch = () => {
|
|
|
24272
24429
|
return;
|
|
24273
24430
|
}
|
|
24274
24431
|
const pkgManager = getPkgManager();
|
|
24275
|
-
const message = `${
|
|
24432
|
+
const message = `${colors15.yellow("React version mismatch detected!")}
|
|
24276
24433
|
|
|
24277
24434
|
API ToGo requires specific versions of React
|
|
24278
24435
|
and React DOM to function correctly.
|
|
24279
24436
|
|
|
24280
|
-
Installed: ${
|
|
24281
|
-
Required: ${
|
|
24437
|
+
Installed: ${colors15.bold(`react@${installed.react}, react-dom@${installed["react-dom"]}`)}
|
|
24438
|
+
Required: ${colors15.green(`react@${required.react}, react-dom@${required["react-dom"]}`)}
|
|
24282
24439
|
|
|
24283
24440
|
To fix, run:
|
|
24284
|
-
${
|
|
24441
|
+
${colors15.cyan(`${pkgManager} install react@${minVersion(required.react)} react-dom@${minVersion(required["react-dom"])}`)}`;
|
|
24285
24442
|
if (isDeployJsonOnlyArgv()) {
|
|
24286
24443
|
printJsonOnlyErrorAndExit(
|
|
24287
24444
|
`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[];
|