@lukoweb/apitogo 0.1.142 → 0.1.144
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 +113 -97
- package/package.json +1 -1
package/dist/cli/cli.js
CHANGED
|
@@ -5471,15 +5471,45 @@ function isDeployJsonOnlyArgv() {
|
|
|
5471
5471
|
// src/cli/common/output.ts
|
|
5472
5472
|
import * as Sentry from "@sentry/node";
|
|
5473
5473
|
import colors from "picocolors";
|
|
5474
|
+
var symbols = {
|
|
5475
|
+
success: "\u2714",
|
|
5476
|
+
error: "\u2716",
|
|
5477
|
+
warning: "\u26A0"
|
|
5478
|
+
};
|
|
5479
|
+
var withSymbol = (symbol, isTTY2) => isTTY2 ? `${symbol} ` : "";
|
|
5474
5480
|
function printDiagnosticsToConsole(message) {
|
|
5475
|
-
console.error(colors.
|
|
5481
|
+
console.error(colors.cyan(message));
|
|
5482
|
+
}
|
|
5483
|
+
function printSuccessToConsole(message) {
|
|
5484
|
+
console.error(
|
|
5485
|
+
colors.green(
|
|
5486
|
+
`${withSymbol(symbols.success, process.stderr.isTTY)}${message}`
|
|
5487
|
+
)
|
|
5488
|
+
);
|
|
5489
|
+
}
|
|
5490
|
+
function printHintToConsole(message) {
|
|
5491
|
+
console.error(colors.dim(message));
|
|
5476
5492
|
}
|
|
5477
5493
|
function printWarningToConsole(message) {
|
|
5494
|
+
console.error(
|
|
5495
|
+
colors.yellow(
|
|
5496
|
+
`${withSymbol(symbols.warning, process.stderr.isTTY)}${message}`
|
|
5497
|
+
)
|
|
5498
|
+
);
|
|
5499
|
+
}
|
|
5500
|
+
function printErrorToConsole(message) {
|
|
5501
|
+
console.error(
|
|
5502
|
+
colors.red(`${withSymbol(symbols.error, process.stderr.isTTY)}${message}`)
|
|
5503
|
+
);
|
|
5504
|
+
}
|
|
5505
|
+
function printBoxToConsole(message) {
|
|
5478
5506
|
console.error(message);
|
|
5479
5507
|
}
|
|
5480
5508
|
async function printCriticalFailureToConsoleAndExit(message) {
|
|
5481
5509
|
const text = typeof message === "string" && message.trim() === "" ? "Command failed with no further details." : message;
|
|
5482
|
-
console.error(
|
|
5510
|
+
console.error(
|
|
5511
|
+
`${colors.bold(colors.red(`${withSymbol(symbols.error, process.stderr.isTTY)}Error:`))} ${colors.red(text)}`
|
|
5512
|
+
);
|
|
5483
5513
|
await Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
|
|
5484
5514
|
process.exit(1);
|
|
5485
5515
|
});
|
|
@@ -5489,7 +5519,13 @@ function printJsonOnlyErrorAndExit(message) {
|
|
|
5489
5519
|
process.exit(1);
|
|
5490
5520
|
}
|
|
5491
5521
|
function printResultToConsole(message) {
|
|
5492
|
-
console.log(
|
|
5522
|
+
console.log(
|
|
5523
|
+
colors.bold(
|
|
5524
|
+
colors.green(
|
|
5525
|
+
`${withSymbol(symbols.success, process.stdout.isTTY)}${message}`
|
|
5526
|
+
)
|
|
5527
|
+
)
|
|
5528
|
+
);
|
|
5493
5529
|
}
|
|
5494
5530
|
|
|
5495
5531
|
// src/cli/common/utils/box.ts
|
|
@@ -5584,7 +5620,7 @@ async function warnIfOutdatedVersion(currentVersion) {
|
|
|
5584
5620
|
}
|
|
5585
5621
|
const shouldWarn = gt(versionCheckInfo.latestVersion, currentVersion) && !process.env.ZUDOKU_INTERNAL_DEV;
|
|
5586
5622
|
if (shouldWarn) {
|
|
5587
|
-
|
|
5623
|
+
printBoxToConsole(
|
|
5588
5624
|
box(
|
|
5589
5625
|
`Update available! ${colors3.gray(`v${currentVersion}`)} \u226B ${colors3.green(
|
|
5590
5626
|
`v${versionCheckInfo.latestVersion}`
|
|
@@ -5809,7 +5845,7 @@ import {
|
|
|
5809
5845
|
// package.json
|
|
5810
5846
|
var package_default = {
|
|
5811
5847
|
name: "@lukoweb/apitogo",
|
|
5812
|
-
version: "0.1.
|
|
5848
|
+
version: "0.1.144",
|
|
5813
5849
|
type: "module",
|
|
5814
5850
|
sideEffects: [
|
|
5815
5851
|
"**/*.css",
|
|
@@ -10657,7 +10693,7 @@ async function preview(argv) {
|
|
|
10657
10693
|
printDiagnosticsToConsole(
|
|
10658
10694
|
`Build preview server running at: ${server.resolvedUrls?.local[0]}`
|
|
10659
10695
|
);
|
|
10660
|
-
|
|
10696
|
+
printHintToConsole("Press Ctrl+C to stop");
|
|
10661
10697
|
await new Promise((resolve) => {
|
|
10662
10698
|
const exit = async () => {
|
|
10663
10699
|
await server.close();
|
|
@@ -15912,16 +15948,15 @@ import { stdin as input, stdout as output } from "node:process";
|
|
|
15912
15948
|
import { createInterface } from "node:readline/promises";
|
|
15913
15949
|
|
|
15914
15950
|
// src/cli/make-config/wrap-up.ts
|
|
15951
|
+
import colors11 from "picocolors";
|
|
15915
15952
|
var DOCS = "https://docs.apitogo.com";
|
|
15916
15953
|
function printPageAddedHint(relativePath, routePath) {
|
|
15917
|
-
|
|
15918
|
-
|
|
15919
|
-
);
|
|
15920
|
-
printDiagnosticsToConsole("Edit that file to change the content.");
|
|
15921
|
-
printDiagnosticsToConsole(`Predefined components: ${DOCS}/docs/components`);
|
|
15954
|
+
printSuccessToConsole(`Page created: ${relativePath} (route ${routePath})`);
|
|
15955
|
+
printHintToConsole("Edit that file to change the content.");
|
|
15956
|
+
printHintToConsole(`Predefined components: ${DOCS}/docs/components`);
|
|
15922
15957
|
}
|
|
15923
15958
|
function printPlanAddedHint(displayName) {
|
|
15924
|
-
|
|
15959
|
+
printSuccessToConsole(
|
|
15925
15960
|
`Plan "${displayName}" added to modules.userPanel.plans.items in apitogo.config.json.`
|
|
15926
15961
|
);
|
|
15927
15962
|
printDiagnosticsToConsole(
|
|
@@ -15930,34 +15965,34 @@ function printPlanAddedHint(displayName) {
|
|
|
15930
15965
|
printDiagnosticsToConsole(`Docs: ${DOCS}/docs/configuration/plans`);
|
|
15931
15966
|
}
|
|
15932
15967
|
function printPaidPlanPlatformWarning() {
|
|
15933
|
-
|
|
15968
|
+
printWarningToConsole(
|
|
15934
15969
|
"Paid API plans require Starter or Professional platform hosting. Free cannot publish paid gateway plans."
|
|
15935
15970
|
);
|
|
15936
15971
|
}
|
|
15937
15972
|
function printInteractiveWrapUp(hasPaidPlans) {
|
|
15938
15973
|
printDiagnosticsToConsole("");
|
|
15939
|
-
|
|
15940
|
-
printDiagnosticsToConsole(
|
|
15974
|
+
printSuccessToConsole("Configuration is done. Next steps:");
|
|
15975
|
+
printDiagnosticsToConsole(`- Preview locally: ${colors11.bold("npm run dev")}`);
|
|
15941
15976
|
if (hasPaidPlans) {
|
|
15942
15977
|
printPaidPlanPlatformWarning();
|
|
15943
15978
|
} else {
|
|
15944
|
-
|
|
15979
|
+
printHintToConsole(
|
|
15945
15980
|
"Platform note: Free hosting does not support paid API plans or custom domains \u2014 use Starter or Professional for those."
|
|
15946
15981
|
);
|
|
15947
15982
|
}
|
|
15948
15983
|
printDiagnosticsToConsole("");
|
|
15949
|
-
printDiagnosticsToConsole("Configure more:");
|
|
15950
|
-
|
|
15984
|
+
printDiagnosticsToConsole(colors11.bold("Configure more:"));
|
|
15985
|
+
printHintToConsole(`- Overview: ${DOCS}/docs/configuration/overview`);
|
|
15951
15986
|
printDiagnosticsToConsole(
|
|
15952
15987
|
`- Gateway plans: ${DOCS}/docs/configuration/plans`
|
|
15953
15988
|
);
|
|
15954
|
-
|
|
15989
|
+
printHintToConsole(`- Custom pages: ${DOCS}/docs/guides/custom-pages`);
|
|
15955
15990
|
printDiagnosticsToConsole(
|
|
15956
15991
|
`- API reference: ${DOCS}/docs/configuration/api-reference`
|
|
15957
15992
|
);
|
|
15958
|
-
|
|
15959
|
-
|
|
15960
|
-
|
|
15993
|
+
printHintToConsole(`- Theme: ${DOCS}/docs/customization/colors-theme`);
|
|
15994
|
+
printHintToConsole(`- Fonts: ${DOCS}/docs/customization/fonts`);
|
|
15995
|
+
printHintToConsole(`- CLI shape: ${DOCS}/docs/cli/shape`);
|
|
15961
15996
|
}
|
|
15962
15997
|
|
|
15963
15998
|
// src/cli/make-config/interactive.ts
|
|
@@ -15973,7 +16008,7 @@ var askNonNegativeNumber = async (rl, question, defaultValue) => {
|
|
|
15973
16008
|
if (!Number.isNaN(parsed) && parsed >= 0) {
|
|
15974
16009
|
return parsed;
|
|
15975
16010
|
}
|
|
15976
|
-
|
|
16011
|
+
printErrorToConsole("Enter a non-negative number.");
|
|
15977
16012
|
}
|
|
15978
16013
|
};
|
|
15979
16014
|
var parseLoopChoice = (raw) => {
|
|
@@ -15998,9 +16033,7 @@ async function promptMakeConfigInteractive(options) {
|
|
|
15998
16033
|
);
|
|
15999
16034
|
const choice = parseLoopChoice(choiceRaw);
|
|
16000
16035
|
if (!choice) {
|
|
16001
|
-
|
|
16002
|
-
"Choose backend, openapi, page, plan, or done."
|
|
16003
|
-
);
|
|
16036
|
+
printErrorToConsole("Choose backend, openapi, page, plan, or done.");
|
|
16004
16037
|
continue;
|
|
16005
16038
|
}
|
|
16006
16039
|
if (choice === "done") {
|
|
@@ -16013,7 +16046,7 @@ async function promptMakeConfigInteractive(options) {
|
|
|
16013
16046
|
".."
|
|
16014
16047
|
);
|
|
16015
16048
|
if (!sourceDirectory.trim()) {
|
|
16016
|
-
|
|
16049
|
+
printErrorToConsole("Backend source directory is required.");
|
|
16017
16050
|
continue;
|
|
16018
16051
|
}
|
|
16019
16052
|
let runtime = null;
|
|
@@ -16025,7 +16058,7 @@ async function promptMakeConfigInteractive(options) {
|
|
|
16025
16058
|
);
|
|
16026
16059
|
runtime = parseBackendRuntime(runtimeRaw);
|
|
16027
16060
|
if (!runtime) {
|
|
16028
|
-
|
|
16061
|
+
printErrorToConsole(
|
|
16029
16062
|
`Choose one of: ${BACKEND_RUNTIMES.join(", ")} (node \u2192 nodejs).`
|
|
16030
16063
|
);
|
|
16031
16064
|
}
|
|
@@ -16040,7 +16073,7 @@ async function promptMakeConfigInteractive(options) {
|
|
|
16040
16073
|
);
|
|
16041
16074
|
runtimeVersion = parseRuntimeVersion(runtime, versionRaw);
|
|
16042
16075
|
if (!runtimeVersion) {
|
|
16043
|
-
|
|
16076
|
+
printErrorToConsole(`Choose one of: ${versions.join(", ")}.`);
|
|
16044
16077
|
}
|
|
16045
16078
|
}
|
|
16046
16079
|
const backend = {
|
|
@@ -16049,7 +16082,7 @@ async function promptMakeConfigInteractive(options) {
|
|
|
16049
16082
|
runtimeVersion
|
|
16050
16083
|
};
|
|
16051
16084
|
await options.onApplied({ kind: "backend", backend });
|
|
16052
|
-
|
|
16085
|
+
printSuccessToConsole(
|
|
16053
16086
|
`Backend saved: ${backend.runtime} ${backend.runtimeVersion} (sourceDirectory: ${backend.sourceDirectory}).`
|
|
16054
16087
|
);
|
|
16055
16088
|
continue;
|
|
@@ -16061,11 +16094,11 @@ async function promptMakeConfigInteractive(options) {
|
|
|
16061
16094
|
options.discoveredOpenApi ?? ""
|
|
16062
16095
|
);
|
|
16063
16096
|
if (!entered) {
|
|
16064
|
-
|
|
16097
|
+
printHintToConsole("OpenAPI skipped.");
|
|
16065
16098
|
continue;
|
|
16066
16099
|
}
|
|
16067
16100
|
await options.onApplied({ kind: "openapi", openApiPath: entered });
|
|
16068
|
-
|
|
16101
|
+
printSuccessToConsole(
|
|
16069
16102
|
`OpenAPI linked as a relative path in apitogo.config.json.`
|
|
16070
16103
|
);
|
|
16071
16104
|
continue;
|
|
@@ -16073,7 +16106,7 @@ async function promptMakeConfigInteractive(options) {
|
|
|
16073
16106
|
if (choice === "page") {
|
|
16074
16107
|
const pageTitle = await ask(rl, "Page title");
|
|
16075
16108
|
if (!pageTitle.trim()) {
|
|
16076
|
-
|
|
16109
|
+
printErrorToConsole("Page title is required.");
|
|
16077
16110
|
continue;
|
|
16078
16111
|
}
|
|
16079
16112
|
const address = await ask(
|
|
@@ -16082,7 +16115,7 @@ async function promptMakeConfigInteractive(options) {
|
|
|
16082
16115
|
);
|
|
16083
16116
|
const slug = normalizePageSlug(address);
|
|
16084
16117
|
if (!slug) {
|
|
16085
|
-
|
|
16118
|
+
printErrorToConsole("Page URL path is required.");
|
|
16086
16119
|
continue;
|
|
16087
16120
|
}
|
|
16088
16121
|
const routePath = `/${slug}`;
|
|
@@ -16099,7 +16132,7 @@ async function promptMakeConfigInteractive(options) {
|
|
|
16099
16132
|
}
|
|
16100
16133
|
const displayName = await ask(rl, "Plan title");
|
|
16101
16134
|
if (!displayName.trim()) {
|
|
16102
|
-
|
|
16135
|
+
printErrorToConsole("Plan title is required.");
|
|
16103
16136
|
continue;
|
|
16104
16137
|
}
|
|
16105
16138
|
const pricingAnswer = (await ask(
|
|
@@ -16428,7 +16461,7 @@ async function persistConfig(config2, ctx) {
|
|
|
16428
16461
|
const tsxRoutes = tsxFiles.map((file) => toRoutePath(file, ctx.pagesDir));
|
|
16429
16462
|
const docRoutes = [.../* @__PURE__ */ new Set([...markdownRoutes, ...tsxRoutes])];
|
|
16430
16463
|
if (docRoutes.length === 0) {
|
|
16431
|
-
|
|
16464
|
+
printHintToConsole(
|
|
16432
16465
|
`No docs pages under '${ctx.pagesDir}/' \u2014 skipping documentation nav scan.`
|
|
16433
16466
|
);
|
|
16434
16467
|
}
|
|
@@ -16479,12 +16512,12 @@ async function makeConfig(argv) {
|
|
|
16479
16512
|
const createdPackageJson = await ensurePackageJson(dir);
|
|
16480
16513
|
const createdTsconfig = await ensureTsconfigJson(dir);
|
|
16481
16514
|
if (createdPackageJson && !json) {
|
|
16482
|
-
|
|
16515
|
+
printSuccessToConsole(
|
|
16483
16516
|
"Created package.json with dev, build, and preview scripts."
|
|
16484
16517
|
);
|
|
16485
16518
|
}
|
|
16486
16519
|
if (createdTsconfig && !json) {
|
|
16487
|
-
|
|
16520
|
+
printSuccessToConsole("Created tsconfig.json.");
|
|
16488
16521
|
}
|
|
16489
16522
|
await ensurePortalStubFiles(dir);
|
|
16490
16523
|
const jsonPath = path52.join(dir, APITOGO_JSON_FILENAME);
|
|
@@ -16499,13 +16532,13 @@ async function makeConfig(argv) {
|
|
|
16499
16532
|
});
|
|
16500
16533
|
createdJson = true;
|
|
16501
16534
|
if (!json) {
|
|
16502
|
-
|
|
16535
|
+
printSuccessToConsole(`Created ${APITOGO_JSON_FILENAME}`);
|
|
16503
16536
|
}
|
|
16504
16537
|
changes.push("created_config");
|
|
16505
16538
|
}
|
|
16506
16539
|
const createdTsx = await ensureThinConfigTsx(dir);
|
|
16507
16540
|
if (createdTsx && !json) {
|
|
16508
|
-
|
|
16541
|
+
printSuccessToConsole("Created apitogo.config.tsx");
|
|
16509
16542
|
}
|
|
16510
16543
|
const flagPatches = {
|
|
16511
16544
|
site: parseJsonObjectFlag(argv.site, "site"),
|
|
@@ -16713,7 +16746,7 @@ async function makeConfig(argv) {
|
|
|
16713
16746
|
} else {
|
|
16714
16747
|
printResultToConsole(`${action} ${APITOGO_JSON_FILENAME}.`);
|
|
16715
16748
|
if (createdPackageJson) {
|
|
16716
|
-
|
|
16749
|
+
printHintToConsole(
|
|
16717
16750
|
"Next: run npm install (or pnpm install / yarn) in this directory, then npm run dev."
|
|
16718
16751
|
);
|
|
16719
16752
|
}
|
|
@@ -18434,11 +18467,6 @@ function isPollableJobValue(value) {
|
|
|
18434
18467
|
|
|
18435
18468
|
// src/cli/platform/helpers/warm-pool.ts
|
|
18436
18469
|
var WARM_POOL_CAPACITY_TEMPORARILY_UNAVAILABLE = "WARM_POOL_CAPACITY_TEMPORARILY_UNAVAILABLE";
|
|
18437
|
-
var COLD_MODULE_INFRA_RESOURCE_TYPES = /* @__PURE__ */ new Set([
|
|
18438
|
-
"AzureProjectInfrastructure",
|
|
18439
|
-
"DevPortalInfrastructure",
|
|
18440
|
-
"BackendInfrastructure"
|
|
18441
|
-
]);
|
|
18442
18470
|
var WARM_POOL_CREATE_RETRY_BUDGET_MS = 10 * 60 * 1e3;
|
|
18443
18471
|
function sleep3(ms) {
|
|
18444
18472
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -18466,16 +18494,6 @@ function isWarmPoolInfrastructureTerminal(project) {
|
|
|
18466
18494
|
const status2 = project.infrastructureStatus?.toLowerCase() ?? "";
|
|
18467
18495
|
return status2 === "ready" || status2 === "failed" || status2 === "deleting";
|
|
18468
18496
|
}
|
|
18469
|
-
function shouldSkipColdModuleInfrastructureWait(project, infraStatus) {
|
|
18470
|
-
const resourceType = infraStatus?.resourceType;
|
|
18471
|
-
if (resourceType && COLD_MODULE_INFRA_RESOURCE_TYPES.has(resourceType)) {
|
|
18472
|
-
return false;
|
|
18473
|
-
}
|
|
18474
|
-
if (resourceType === "WarmPoolBinding") {
|
|
18475
|
-
return true;
|
|
18476
|
-
}
|
|
18477
|
-
return isWarmPoolInfrastructureReady(project);
|
|
18478
|
-
}
|
|
18479
18497
|
function resolvePortalBackendFqdn(project) {
|
|
18480
18498
|
const portalApiUrl = project.portalApiUrl?.trim();
|
|
18481
18499
|
if (!portalApiUrl) {
|
|
@@ -20025,12 +20043,6 @@ async function ensureModuleProvisioned(client, config2, projectId, moduleType, w
|
|
|
20025
20043
|
if (isModuleProvisioned(project, moduleType)) {
|
|
20026
20044
|
return;
|
|
20027
20045
|
}
|
|
20028
|
-
if (isWarmPoolInfrastructureReady(project)) {
|
|
20029
|
-
const infra = await client.getInfrastructureStatus(projectId, moduleType);
|
|
20030
|
-
if (shouldSkipColdModuleInfrastructureWait(project, infra) || isTerminalInfrastructureStatus(infra.status)) {
|
|
20031
|
-
return;
|
|
20032
|
-
}
|
|
20033
|
-
}
|
|
20034
20046
|
await progress?.onStep(`Activating module ${moduleType}`);
|
|
20035
20047
|
try {
|
|
20036
20048
|
await handleActivateModule(
|
|
@@ -20054,12 +20066,6 @@ async function ensureModuleProvisioned(client, config2, projectId, moduleType, w
|
|
|
20054
20066
|
if (isModuleProvisioned(project, moduleType)) {
|
|
20055
20067
|
return;
|
|
20056
20068
|
}
|
|
20057
|
-
if (isWarmPoolInfrastructureReady(project)) {
|
|
20058
|
-
const infra = await client.getInfrastructureStatus(projectId, moduleType);
|
|
20059
|
-
if (shouldSkipColdModuleInfrastructureWait(project, infra) || isTerminalInfrastructureStatus(infra.status)) {
|
|
20060
|
-
return;
|
|
20061
|
-
}
|
|
20062
|
-
}
|
|
20063
20069
|
const waitedJson = await handleWaitForJob(
|
|
20064
20070
|
client,
|
|
20065
20071
|
{ ...config2, defaultProjectId: projectId },
|
|
@@ -22096,6 +22102,7 @@ function formatResultForHuman(parsed) {
|
|
|
22096
22102
|
import { stdin as input3, stdout as output2 } from "node:process";
|
|
22097
22103
|
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
22098
22104
|
import open from "open";
|
|
22105
|
+
import colors12 from "picocolors";
|
|
22099
22106
|
var PLAN_CHOICES = [
|
|
22100
22107
|
"free",
|
|
22101
22108
|
"starter",
|
|
@@ -22113,15 +22120,17 @@ function printPlanCatalog(payload) {
|
|
|
22113
22120
|
if (!entry || typeof entry !== "object") continue;
|
|
22114
22121
|
const plan = entry;
|
|
22115
22122
|
printDiagnosticsToConsole("");
|
|
22116
|
-
printDiagnosticsToConsole(
|
|
22123
|
+
printDiagnosticsToConsole(
|
|
22124
|
+
colors12.bold(`${plan.displayName} \u2014 ${plan.priceLabel}`)
|
|
22125
|
+
);
|
|
22117
22126
|
if (plan.summary) {
|
|
22118
|
-
|
|
22127
|
+
printHintToConsole(` ${plan.summary}`);
|
|
22119
22128
|
}
|
|
22120
22129
|
for (const feature of plan.features ?? []) {
|
|
22121
|
-
|
|
22130
|
+
printSuccessToConsole(` + ${feature}`);
|
|
22122
22131
|
}
|
|
22123
22132
|
for (const limitation of plan.limitations ?? []) {
|
|
22124
|
-
|
|
22133
|
+
printHintToConsole(` - ${limitation}`);
|
|
22125
22134
|
}
|
|
22126
22135
|
}
|
|
22127
22136
|
printDiagnosticsToConsole("");
|
|
@@ -22137,7 +22146,7 @@ async function askPlanChoice() {
|
|
|
22137
22146
|
if (PLAN_CHOICES.includes(answer)) {
|
|
22138
22147
|
return answer;
|
|
22139
22148
|
}
|
|
22140
|
-
|
|
22149
|
+
printErrorToConsole('Enter "free", "starter", or "professional".');
|
|
22141
22150
|
}
|
|
22142
22151
|
} finally {
|
|
22143
22152
|
rl.close();
|
|
@@ -22154,9 +22163,9 @@ async function askValidPlanChoice(validatePlansForTier) {
|
|
|
22154
22163
|
`apitogo.config.json has ${errors.length} plan ${errors.length === 1 ? "error" : "errors"} for the ${choice} plan:`
|
|
22155
22164
|
);
|
|
22156
22165
|
for (const error of errors) {
|
|
22157
|
-
|
|
22166
|
+
printErrorToConsole(` - ${error}`);
|
|
22158
22167
|
}
|
|
22159
|
-
|
|
22168
|
+
printHintToConsole(
|
|
22160
22169
|
"Pick a different plan, or leave empty to cancel and fix apitogo.config.json."
|
|
22161
22170
|
);
|
|
22162
22171
|
}
|
|
@@ -22190,9 +22199,7 @@ async function resolvePlatformPlanInteractively(client, config2, payload, valida
|
|
|
22190
22199
|
);
|
|
22191
22200
|
return false;
|
|
22192
22201
|
}
|
|
22193
|
-
|
|
22194
|
-
ensured2.message ?? "Free platform plan selected."
|
|
22195
|
-
);
|
|
22202
|
+
printSuccessToConsole(ensured2.message ?? "Free platform plan selected.");
|
|
22196
22203
|
return true;
|
|
22197
22204
|
}
|
|
22198
22205
|
const ensured = JSON.parse(
|
|
@@ -22226,7 +22233,7 @@ ${ensured.checkoutUrl}`
|
|
|
22226
22233
|
);
|
|
22227
22234
|
return false;
|
|
22228
22235
|
}
|
|
22229
|
-
|
|
22236
|
+
printSuccessToConsole(
|
|
22230
22237
|
`${choice.charAt(0).toUpperCase()}${choice.slice(1)} platform plan active.`
|
|
22231
22238
|
);
|
|
22232
22239
|
return true;
|
|
@@ -22239,10 +22246,10 @@ async function resolveProjectNotFoundInteractively(payload, defaultProjectName)
|
|
|
22239
22246
|
const projectId = typeof payload.projectId === "string" ? payload.projectId : "";
|
|
22240
22247
|
const message = typeof payload.userMessage === "string" ? payload.userMessage : `Project ${projectId} was not found.`;
|
|
22241
22248
|
printWarningToConsole(message);
|
|
22242
|
-
|
|
22249
|
+
printHintToConsole(
|
|
22243
22250
|
"This usually means the project was deleted, or it belongs to a different account than the one you're logged in as."
|
|
22244
22251
|
);
|
|
22245
|
-
|
|
22252
|
+
printHintToConsole(
|
|
22246
22253
|
"If that's unexpected, cancel here and run `apitogo login` to check your account."
|
|
22247
22254
|
);
|
|
22248
22255
|
printDiagnosticsToConsole("");
|
|
@@ -23120,7 +23127,7 @@ async function init2(argv) {
|
|
|
23120
23127
|
console.log(JSON.stringify(response, null, 2));
|
|
23121
23128
|
} else {
|
|
23122
23129
|
if (result.scaffoldWarning) {
|
|
23123
|
-
|
|
23130
|
+
printWarningToConsole(result.scaffoldWarning);
|
|
23124
23131
|
}
|
|
23125
23132
|
printResultToConsole(
|
|
23126
23133
|
`Portal scaffolded in ${result.outputDirectory}. Next: apitogo config, apitogo run, then apitogo deploy.`
|
|
@@ -23129,7 +23136,7 @@ async function init2(argv) {
|
|
|
23129
23136
|
printDiagnosticsToConsole(line);
|
|
23130
23137
|
}
|
|
23131
23138
|
if (!install) {
|
|
23132
|
-
|
|
23139
|
+
printHintToConsole(
|
|
23133
23140
|
"Skipped npm install (--no-install). Run npm install before npm run dev."
|
|
23134
23141
|
);
|
|
23135
23142
|
}
|
|
@@ -23184,6 +23191,7 @@ var init_default = {
|
|
|
23184
23191
|
// src/cli/login/handler.ts
|
|
23185
23192
|
import readline from "node:readline/promises";
|
|
23186
23193
|
import open2 from "open";
|
|
23194
|
+
import colors13 from "picocolors";
|
|
23187
23195
|
|
|
23188
23196
|
// src/cli/platform/device-auth.ts
|
|
23189
23197
|
function url(apiUrl, path73) {
|
|
@@ -23250,8 +23258,10 @@ async function login() {
|
|
|
23250
23258
|
const apiUrl = resolveLoginApiUrl();
|
|
23251
23259
|
try {
|
|
23252
23260
|
const device = await requestDeviceCode(apiUrl);
|
|
23253
|
-
printDiagnosticsToConsole(`Your login code: ${device.userCode}`);
|
|
23254
23261
|
printDiagnosticsToConsole(
|
|
23262
|
+
`Your login code: ${colors13.bold(colors13.white(device.userCode))}`
|
|
23263
|
+
);
|
|
23264
|
+
printHintToConsole(
|
|
23255
23265
|
"We'll open your browser to confirm this code and sign in. Come back to this terminal once you're done."
|
|
23256
23266
|
);
|
|
23257
23267
|
await waitForEnter("Press Enter to open your browser...");
|
|
@@ -23262,7 +23272,7 @@ async function login() {
|
|
|
23262
23272
|
openedBrowser = false;
|
|
23263
23273
|
}
|
|
23264
23274
|
if (!openedBrowser) {
|
|
23265
|
-
|
|
23275
|
+
printWarningToConsole(
|
|
23266
23276
|
`Couldn't open your browser automatically. Visit this link to continue:
|
|
23267
23277
|
${device.verificationUriComplete}`
|
|
23268
23278
|
);
|
|
@@ -23773,7 +23783,7 @@ async function dev(argv) {
|
|
|
23773
23783
|
`${server.protocol}://localhost:${server.resolvedPort}`,
|
|
23774
23784
|
vite.config.base
|
|
23775
23785
|
);
|
|
23776
|
-
|
|
23786
|
+
printHintToConsole("Ctrl+C to exit");
|
|
23777
23787
|
printDiagnosticsToConsole("");
|
|
23778
23788
|
printDiagnosticsToConsole(
|
|
23779
23789
|
`\u{1F680} Running API ToGo v${packageJson3.version}: ${url2}`
|
|
@@ -23787,7 +23797,9 @@ async function dev(argv) {
|
|
|
23787
23797
|
server.stop().then(() => {
|
|
23788
23798
|
resolve();
|
|
23789
23799
|
}).catch((e) => {
|
|
23790
|
-
|
|
23800
|
+
printErrorToConsole(
|
|
23801
|
+
`Error stopping server: ${e instanceof Error ? e.stack ?? e.message : e}`
|
|
23802
|
+
);
|
|
23791
23803
|
resolve();
|
|
23792
23804
|
});
|
|
23793
23805
|
}
|
|
@@ -23795,15 +23807,19 @@ async function dev(argv) {
|
|
|
23795
23807
|
process.on("SIGTERM", exit);
|
|
23796
23808
|
process.on("SIGINT", exit);
|
|
23797
23809
|
process.on("uncaughtException", (e) => {
|
|
23798
|
-
|
|
23810
|
+
printErrorToConsole(
|
|
23811
|
+
`Uncaught exception: ${e instanceof Error ? e.stack ?? e.message : e}`
|
|
23812
|
+
);
|
|
23799
23813
|
void exit();
|
|
23800
23814
|
});
|
|
23801
23815
|
process.on("unhandledRejection", (e) => {
|
|
23802
23816
|
if (e instanceof DOMException && e.name === "AbortError") {
|
|
23803
|
-
|
|
23817
|
+
printWarningToConsole(`[Abort] ${e.message}`);
|
|
23804
23818
|
return;
|
|
23805
23819
|
}
|
|
23806
|
-
|
|
23820
|
+
printErrorToConsole(
|
|
23821
|
+
`Unhandled rejection: ${e instanceof Error ? e.stack ?? e.message : e}`
|
|
23822
|
+
);
|
|
23807
23823
|
void exit();
|
|
23808
23824
|
});
|
|
23809
23825
|
process.on("exit", exit);
|
|
@@ -24031,7 +24047,7 @@ var teardown_default = {
|
|
|
24031
24047
|
init_package_json();
|
|
24032
24048
|
|
|
24033
24049
|
// src/cli/common/version-check.ts
|
|
24034
|
-
import
|
|
24050
|
+
import colors14 from "picocolors";
|
|
24035
24051
|
import { minVersion, satisfies } from "semver";
|
|
24036
24052
|
init_package_json();
|
|
24037
24053
|
var getPkgManager = () => {
|
|
@@ -24068,22 +24084,22 @@ var warnPackageVersionMismatch = () => {
|
|
|
24068
24084
|
return;
|
|
24069
24085
|
}
|
|
24070
24086
|
const pkgManager = getPkgManager();
|
|
24071
|
-
const message = `${
|
|
24087
|
+
const message = `${colors14.yellow("React version mismatch detected!")}
|
|
24072
24088
|
|
|
24073
24089
|
API ToGo requires specific versions of React
|
|
24074
24090
|
and React DOM to function correctly.
|
|
24075
24091
|
|
|
24076
|
-
Installed: ${
|
|
24077
|
-
Required: ${
|
|
24092
|
+
Installed: ${colors14.bold(`react@${installed.react}, react-dom@${installed["react-dom"]}`)}
|
|
24093
|
+
Required: ${colors14.green(`react@${required.react}, react-dom@${required["react-dom"]}`)}
|
|
24078
24094
|
|
|
24079
24095
|
To fix, run:
|
|
24080
|
-
${
|
|
24096
|
+
${colors14.cyan(`${pkgManager} install react@${minVersion(required.react)} react-dom@${minVersion(required["react-dom"])}`)}`;
|
|
24081
24097
|
if (isDeployJsonOnlyArgv()) {
|
|
24082
24098
|
printJsonOnlyErrorAndExit(
|
|
24083
24099
|
`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"])}`
|
|
24084
24100
|
);
|
|
24085
24101
|
}
|
|
24086
|
-
|
|
24102
|
+
printBoxToConsole(box(message));
|
|
24087
24103
|
process.exit(1);
|
|
24088
24104
|
};
|
|
24089
24105
|
|
|
@@ -24159,7 +24175,7 @@ var handoffToLocalCli = async (argv, runningRoot) => {
|
|
|
24159
24175
|
process.on("SIGTERM", () => child.kill("SIGTERM"));
|
|
24160
24176
|
return new Promise((resolve) => {
|
|
24161
24177
|
child.on("error", (err) => {
|
|
24162
|
-
|
|
24178
|
+
printErrorToConsole(
|
|
24163
24179
|
`Failed to start local ${PACKAGE_NAME}: ${err.message}`
|
|
24164
24180
|
);
|
|
24165
24181
|
resolve(1);
|