@lukoweb/apitogo 0.1.142 → 0.1.143
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 -70
- 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.143",
|
|
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
|
}
|
|
@@ -22096,6 +22129,7 @@ function formatResultForHuman(parsed) {
|
|
|
22096
22129
|
import { stdin as input3, stdout as output2 } from "node:process";
|
|
22097
22130
|
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
22098
22131
|
import open from "open";
|
|
22132
|
+
import colors12 from "picocolors";
|
|
22099
22133
|
var PLAN_CHOICES = [
|
|
22100
22134
|
"free",
|
|
22101
22135
|
"starter",
|
|
@@ -22113,15 +22147,17 @@ function printPlanCatalog(payload) {
|
|
|
22113
22147
|
if (!entry || typeof entry !== "object") continue;
|
|
22114
22148
|
const plan = entry;
|
|
22115
22149
|
printDiagnosticsToConsole("");
|
|
22116
|
-
printDiagnosticsToConsole(
|
|
22150
|
+
printDiagnosticsToConsole(
|
|
22151
|
+
colors12.bold(`${plan.displayName} \u2014 ${plan.priceLabel}`)
|
|
22152
|
+
);
|
|
22117
22153
|
if (plan.summary) {
|
|
22118
|
-
|
|
22154
|
+
printHintToConsole(` ${plan.summary}`);
|
|
22119
22155
|
}
|
|
22120
22156
|
for (const feature of plan.features ?? []) {
|
|
22121
|
-
|
|
22157
|
+
printSuccessToConsole(` + ${feature}`);
|
|
22122
22158
|
}
|
|
22123
22159
|
for (const limitation of plan.limitations ?? []) {
|
|
22124
|
-
|
|
22160
|
+
printHintToConsole(` - ${limitation}`);
|
|
22125
22161
|
}
|
|
22126
22162
|
}
|
|
22127
22163
|
printDiagnosticsToConsole("");
|
|
@@ -22137,7 +22173,7 @@ async function askPlanChoice() {
|
|
|
22137
22173
|
if (PLAN_CHOICES.includes(answer)) {
|
|
22138
22174
|
return answer;
|
|
22139
22175
|
}
|
|
22140
|
-
|
|
22176
|
+
printErrorToConsole('Enter "free", "starter", or "professional".');
|
|
22141
22177
|
}
|
|
22142
22178
|
} finally {
|
|
22143
22179
|
rl.close();
|
|
@@ -22154,9 +22190,9 @@ async function askValidPlanChoice(validatePlansForTier) {
|
|
|
22154
22190
|
`apitogo.config.json has ${errors.length} plan ${errors.length === 1 ? "error" : "errors"} for the ${choice} plan:`
|
|
22155
22191
|
);
|
|
22156
22192
|
for (const error of errors) {
|
|
22157
|
-
|
|
22193
|
+
printErrorToConsole(` - ${error}`);
|
|
22158
22194
|
}
|
|
22159
|
-
|
|
22195
|
+
printHintToConsole(
|
|
22160
22196
|
"Pick a different plan, or leave empty to cancel and fix apitogo.config.json."
|
|
22161
22197
|
);
|
|
22162
22198
|
}
|
|
@@ -22190,9 +22226,7 @@ async function resolvePlatformPlanInteractively(client, config2, payload, valida
|
|
|
22190
22226
|
);
|
|
22191
22227
|
return false;
|
|
22192
22228
|
}
|
|
22193
|
-
|
|
22194
|
-
ensured2.message ?? "Free platform plan selected."
|
|
22195
|
-
);
|
|
22229
|
+
printSuccessToConsole(ensured2.message ?? "Free platform plan selected.");
|
|
22196
22230
|
return true;
|
|
22197
22231
|
}
|
|
22198
22232
|
const ensured = JSON.parse(
|
|
@@ -22226,7 +22260,7 @@ ${ensured.checkoutUrl}`
|
|
|
22226
22260
|
);
|
|
22227
22261
|
return false;
|
|
22228
22262
|
}
|
|
22229
|
-
|
|
22263
|
+
printSuccessToConsole(
|
|
22230
22264
|
`${choice.charAt(0).toUpperCase()}${choice.slice(1)} platform plan active.`
|
|
22231
22265
|
);
|
|
22232
22266
|
return true;
|
|
@@ -22239,10 +22273,10 @@ async function resolveProjectNotFoundInteractively(payload, defaultProjectName)
|
|
|
22239
22273
|
const projectId = typeof payload.projectId === "string" ? payload.projectId : "";
|
|
22240
22274
|
const message = typeof payload.userMessage === "string" ? payload.userMessage : `Project ${projectId} was not found.`;
|
|
22241
22275
|
printWarningToConsole(message);
|
|
22242
|
-
|
|
22276
|
+
printHintToConsole(
|
|
22243
22277
|
"This usually means the project was deleted, or it belongs to a different account than the one you're logged in as."
|
|
22244
22278
|
);
|
|
22245
|
-
|
|
22279
|
+
printHintToConsole(
|
|
22246
22280
|
"If that's unexpected, cancel here and run `apitogo login` to check your account."
|
|
22247
22281
|
);
|
|
22248
22282
|
printDiagnosticsToConsole("");
|
|
@@ -23120,7 +23154,7 @@ async function init2(argv) {
|
|
|
23120
23154
|
console.log(JSON.stringify(response, null, 2));
|
|
23121
23155
|
} else {
|
|
23122
23156
|
if (result.scaffoldWarning) {
|
|
23123
|
-
|
|
23157
|
+
printWarningToConsole(result.scaffoldWarning);
|
|
23124
23158
|
}
|
|
23125
23159
|
printResultToConsole(
|
|
23126
23160
|
`Portal scaffolded in ${result.outputDirectory}. Next: apitogo config, apitogo run, then apitogo deploy.`
|
|
@@ -23129,7 +23163,7 @@ async function init2(argv) {
|
|
|
23129
23163
|
printDiagnosticsToConsole(line);
|
|
23130
23164
|
}
|
|
23131
23165
|
if (!install) {
|
|
23132
|
-
|
|
23166
|
+
printHintToConsole(
|
|
23133
23167
|
"Skipped npm install (--no-install). Run npm install before npm run dev."
|
|
23134
23168
|
);
|
|
23135
23169
|
}
|
|
@@ -23184,6 +23218,7 @@ var init_default = {
|
|
|
23184
23218
|
// src/cli/login/handler.ts
|
|
23185
23219
|
import readline from "node:readline/promises";
|
|
23186
23220
|
import open2 from "open";
|
|
23221
|
+
import colors13 from "picocolors";
|
|
23187
23222
|
|
|
23188
23223
|
// src/cli/platform/device-auth.ts
|
|
23189
23224
|
function url(apiUrl, path73) {
|
|
@@ -23250,8 +23285,10 @@ async function login() {
|
|
|
23250
23285
|
const apiUrl = resolveLoginApiUrl();
|
|
23251
23286
|
try {
|
|
23252
23287
|
const device = await requestDeviceCode(apiUrl);
|
|
23253
|
-
printDiagnosticsToConsole(`Your login code: ${device.userCode}`);
|
|
23254
23288
|
printDiagnosticsToConsole(
|
|
23289
|
+
`Your login code: ${colors13.bold(colors13.white(device.userCode))}`
|
|
23290
|
+
);
|
|
23291
|
+
printHintToConsole(
|
|
23255
23292
|
"We'll open your browser to confirm this code and sign in. Come back to this terminal once you're done."
|
|
23256
23293
|
);
|
|
23257
23294
|
await waitForEnter("Press Enter to open your browser...");
|
|
@@ -23262,7 +23299,7 @@ async function login() {
|
|
|
23262
23299
|
openedBrowser = false;
|
|
23263
23300
|
}
|
|
23264
23301
|
if (!openedBrowser) {
|
|
23265
|
-
|
|
23302
|
+
printWarningToConsole(
|
|
23266
23303
|
`Couldn't open your browser automatically. Visit this link to continue:
|
|
23267
23304
|
${device.verificationUriComplete}`
|
|
23268
23305
|
);
|
|
@@ -23773,7 +23810,7 @@ async function dev(argv) {
|
|
|
23773
23810
|
`${server.protocol}://localhost:${server.resolvedPort}`,
|
|
23774
23811
|
vite.config.base
|
|
23775
23812
|
);
|
|
23776
|
-
|
|
23813
|
+
printHintToConsole("Ctrl+C to exit");
|
|
23777
23814
|
printDiagnosticsToConsole("");
|
|
23778
23815
|
printDiagnosticsToConsole(
|
|
23779
23816
|
`\u{1F680} Running API ToGo v${packageJson3.version}: ${url2}`
|
|
@@ -23787,7 +23824,9 @@ async function dev(argv) {
|
|
|
23787
23824
|
server.stop().then(() => {
|
|
23788
23825
|
resolve();
|
|
23789
23826
|
}).catch((e) => {
|
|
23790
|
-
|
|
23827
|
+
printErrorToConsole(
|
|
23828
|
+
`Error stopping server: ${e instanceof Error ? e.stack ?? e.message : e}`
|
|
23829
|
+
);
|
|
23791
23830
|
resolve();
|
|
23792
23831
|
});
|
|
23793
23832
|
}
|
|
@@ -23795,15 +23834,19 @@ async function dev(argv) {
|
|
|
23795
23834
|
process.on("SIGTERM", exit);
|
|
23796
23835
|
process.on("SIGINT", exit);
|
|
23797
23836
|
process.on("uncaughtException", (e) => {
|
|
23798
|
-
|
|
23837
|
+
printErrorToConsole(
|
|
23838
|
+
`Uncaught exception: ${e instanceof Error ? e.stack ?? e.message : e}`
|
|
23839
|
+
);
|
|
23799
23840
|
void exit();
|
|
23800
23841
|
});
|
|
23801
23842
|
process.on("unhandledRejection", (e) => {
|
|
23802
23843
|
if (e instanceof DOMException && e.name === "AbortError") {
|
|
23803
|
-
|
|
23844
|
+
printWarningToConsole(`[Abort] ${e.message}`);
|
|
23804
23845
|
return;
|
|
23805
23846
|
}
|
|
23806
|
-
|
|
23847
|
+
printErrorToConsole(
|
|
23848
|
+
`Unhandled rejection: ${e instanceof Error ? e.stack ?? e.message : e}`
|
|
23849
|
+
);
|
|
23807
23850
|
void exit();
|
|
23808
23851
|
});
|
|
23809
23852
|
process.on("exit", exit);
|
|
@@ -24031,7 +24074,7 @@ var teardown_default = {
|
|
|
24031
24074
|
init_package_json();
|
|
24032
24075
|
|
|
24033
24076
|
// src/cli/common/version-check.ts
|
|
24034
|
-
import
|
|
24077
|
+
import colors14 from "picocolors";
|
|
24035
24078
|
import { minVersion, satisfies } from "semver";
|
|
24036
24079
|
init_package_json();
|
|
24037
24080
|
var getPkgManager = () => {
|
|
@@ -24068,22 +24111,22 @@ var warnPackageVersionMismatch = () => {
|
|
|
24068
24111
|
return;
|
|
24069
24112
|
}
|
|
24070
24113
|
const pkgManager = getPkgManager();
|
|
24071
|
-
const message = `${
|
|
24114
|
+
const message = `${colors14.yellow("React version mismatch detected!")}
|
|
24072
24115
|
|
|
24073
24116
|
API ToGo requires specific versions of React
|
|
24074
24117
|
and React DOM to function correctly.
|
|
24075
24118
|
|
|
24076
|
-
Installed: ${
|
|
24077
|
-
Required: ${
|
|
24119
|
+
Installed: ${colors14.bold(`react@${installed.react}, react-dom@${installed["react-dom"]}`)}
|
|
24120
|
+
Required: ${colors14.green(`react@${required.react}, react-dom@${required["react-dom"]}`)}
|
|
24078
24121
|
|
|
24079
24122
|
To fix, run:
|
|
24080
|
-
${
|
|
24123
|
+
${colors14.cyan(`${pkgManager} install react@${minVersion(required.react)} react-dom@${minVersion(required["react-dom"])}`)}`;
|
|
24081
24124
|
if (isDeployJsonOnlyArgv()) {
|
|
24082
24125
|
printJsonOnlyErrorAndExit(
|
|
24083
24126
|
`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
24127
|
);
|
|
24085
24128
|
}
|
|
24086
|
-
|
|
24129
|
+
printBoxToConsole(box(message));
|
|
24087
24130
|
process.exit(1);
|
|
24088
24131
|
};
|
|
24089
24132
|
|
|
@@ -24159,7 +24202,7 @@ var handoffToLocalCli = async (argv, runningRoot) => {
|
|
|
24159
24202
|
process.on("SIGTERM", () => child.kill("SIGTERM"));
|
|
24160
24203
|
return new Promise((resolve) => {
|
|
24161
24204
|
child.on("error", (err) => {
|
|
24162
|
-
|
|
24205
|
+
printErrorToConsole(
|
|
24163
24206
|
`Failed to start local ${PACKAGE_NAME}: ${err.message}`
|
|
24164
24207
|
);
|
|
24165
24208
|
resolve(1);
|