betterstart-cli 0.0.53 → 0.0.55
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.js +66 -82
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -22232,18 +22232,11 @@ async function promptPresets(cwd, options = {}) {
|
|
|
22232
22232
|
|
|
22233
22233
|
// adapters/next/init/prompts/project.ts
|
|
22234
22234
|
import * as p13 from "@clack/prompts";
|
|
22235
|
-
import pc2 from "picocolors";
|
|
22236
22235
|
async function promptProject(defaultName) {
|
|
22237
22236
|
const projectName = await p13.text({
|
|
22238
|
-
message:
|
|
22239
|
-
|
|
22240
|
-
|
|
22241
|
-
pc2.cyan(".")
|
|
22242
|
-
)}${pc2.dim("` and hit enter.")}`,
|
|
22243
|
-
pc2.cyan("\u2502")
|
|
22244
|
-
].join("\n"),
|
|
22245
|
-
placeholder: defaultName ?? "my-app",
|
|
22246
|
-
defaultValue: defaultName ?? "my-app",
|
|
22237
|
+
message: "Enter the project name",
|
|
22238
|
+
placeholder: defaultName ?? "(Leave blank to skip directory creation)",
|
|
22239
|
+
defaultValue: defaultName ?? ".",
|
|
22247
22240
|
validate: (value) => {
|
|
22248
22241
|
if (!value?.trim()) return "Project name is required";
|
|
22249
22242
|
if (value.trim() === ".") return void 0;
|
|
@@ -22257,15 +22250,7 @@ async function promptProject(defaultName) {
|
|
|
22257
22250
|
p13.cancel("Setup cancelled.");
|
|
22258
22251
|
process.exit(0);
|
|
22259
22252
|
}
|
|
22260
|
-
|
|
22261
|
-
message: "Use src/ directory?",
|
|
22262
|
-
initialValue: false
|
|
22263
|
-
});
|
|
22264
|
-
if (p13.isCancel(useSrcDir)) {
|
|
22265
|
-
p13.cancel("Setup cancelled.");
|
|
22266
|
-
process.exit(0);
|
|
22267
|
-
}
|
|
22268
|
-
return { projectName: projectName.trim(), useSrcDir };
|
|
22253
|
+
return { projectName: projectName.trim() };
|
|
22269
22254
|
}
|
|
22270
22255
|
|
|
22271
22256
|
// adapters/next/init/scaffolders/api-routes.ts
|
|
@@ -24109,11 +24094,11 @@ function scaffoldTsconfig(cwd, config) {
|
|
|
24109
24094
|
|
|
24110
24095
|
// adapters/next/init/vercel/flow.ts
|
|
24111
24096
|
import * as p17 from "@clack/prompts";
|
|
24112
|
-
import
|
|
24097
|
+
import pc5 from "picocolors";
|
|
24113
24098
|
|
|
24114
24099
|
// adapters/next/init/vercel/auth.ts
|
|
24115
24100
|
import * as p14 from "@clack/prompts";
|
|
24116
|
-
import
|
|
24101
|
+
import pc2 from "picocolors";
|
|
24117
24102
|
|
|
24118
24103
|
// adapters/next/init/vercel/runner.ts
|
|
24119
24104
|
import { spawn as spawn3 } from "child_process";
|
|
@@ -24338,7 +24323,7 @@ async function ensureVercelAuth(runner, cwd, options) {
|
|
|
24338
24323
|
return { authed: false, reason: "login-failed" };
|
|
24339
24324
|
}
|
|
24340
24325
|
checkSpinner.clear();
|
|
24341
|
-
const signInMessage = `Sign in to Vercel to continue ${
|
|
24326
|
+
const signInMessage = `Sign in to Vercel to continue ${pc2.dim("(or press Ctrl-C to enter a connection string manually)")}`;
|
|
24342
24327
|
const signInRows = clackLogRows(signInMessage);
|
|
24343
24328
|
p14.log.info(signInMessage);
|
|
24344
24329
|
let streamedRows = 0;
|
|
@@ -24368,12 +24353,12 @@ async function ensureVercelAuth(runner, cwd, options) {
|
|
|
24368
24353
|
return { authed: false, reason: "login-failed" };
|
|
24369
24354
|
}
|
|
24370
24355
|
function signedInMessage(username) {
|
|
24371
|
-
return username ? `Signed in to Vercel as ${
|
|
24356
|
+
return username ? `Signed in to Vercel as ${pc2.cyan(username)}` : "Signed in to Vercel";
|
|
24372
24357
|
}
|
|
24373
24358
|
|
|
24374
24359
|
// adapters/next/init/vercel/blob.ts
|
|
24375
24360
|
import * as p15 from "@clack/prompts";
|
|
24376
|
-
import
|
|
24361
|
+
import pc3 from "picocolors";
|
|
24377
24362
|
|
|
24378
24363
|
// adapters/next/init/vercel/env-pull.ts
|
|
24379
24364
|
import fs34 from "fs";
|
|
@@ -24576,7 +24561,7 @@ async function provisionBlobStoreInteractive(runner, cwd, options) {
|
|
|
24576
24561
|
terminalFallbackRan = true;
|
|
24577
24562
|
quietSpinner.clear();
|
|
24578
24563
|
p15.log.info(
|
|
24579
|
-
`Create your Blob store in the Vercel prompts below ${
|
|
24564
|
+
`Create your Blob store in the Vercel prompts below ${pc3.dim(
|
|
24580
24565
|
"(connect it to all environments)."
|
|
24581
24566
|
)}`
|
|
24582
24567
|
);
|
|
@@ -24873,7 +24858,7 @@ function guardEnvLocal(cwd) {
|
|
|
24873
24858
|
|
|
24874
24859
|
// adapters/next/init/vercel/neon.ts
|
|
24875
24860
|
import * as p16 from "@clack/prompts";
|
|
24876
|
-
import
|
|
24861
|
+
import pc4 from "picocolors";
|
|
24877
24862
|
var PROVISION_TIMEOUT_MS2 = 18e4;
|
|
24878
24863
|
var INTERACTIVE_PROVISION_TIMEOUT_MS2 = 6e5;
|
|
24879
24864
|
async function provisionNeonInteractive(runner, cwd, options) {
|
|
@@ -24891,7 +24876,7 @@ async function provisionNeonInteractive(runner, cwd, options) {
|
|
|
24891
24876
|
}
|
|
24892
24877
|
quietSpinner.clear();
|
|
24893
24878
|
p16.log.info(
|
|
24894
|
-
`Create your Neon database in the Vercel prompts below ${
|
|
24879
|
+
`Create your Neon database in the Vercel prompts below ${pc4.dim(
|
|
24895
24880
|
"(the Free plan is recommended)."
|
|
24896
24881
|
)}`
|
|
24897
24882
|
);
|
|
@@ -24971,7 +24956,7 @@ async function runVercelNeonFlow(options) {
|
|
|
24971
24956
|
const neon = await provisionNeonForMode(runner, options);
|
|
24972
24957
|
if (neon.failure) {
|
|
24973
24958
|
p17.log.warn(neonFailureMessage(neon.failure));
|
|
24974
|
-
if (neon.detail) p17.log.message(
|
|
24959
|
+
if (neon.detail) p17.log.message(pc5.dim(neon.detail));
|
|
24975
24960
|
return { ok: false };
|
|
24976
24961
|
}
|
|
24977
24962
|
const databaseUrl = await pullNeonDatabaseUrl(runner, options.cwd, env);
|
|
@@ -25009,7 +24994,7 @@ async function runVercelBlobFlow(options) {
|
|
|
25009
24994
|
const blob = await provisionBlobForMode(runner, options);
|
|
25010
24995
|
if (blob.failure || !blob.token) {
|
|
25011
24996
|
p17.log.warn(blobFailureMessage(blob.failure));
|
|
25012
|
-
if (blob.detail) p17.log.message(
|
|
24997
|
+
if (blob.detail) p17.log.message(pc5.dim(blob.detail));
|
|
25013
24998
|
return { ok: false };
|
|
25014
24999
|
}
|
|
25015
25000
|
return {
|
|
@@ -25047,7 +25032,7 @@ async function runVercelDeployFlow(options) {
|
|
|
25047
25032
|
envSpinner.clear();
|
|
25048
25033
|
for (const key of sync.failed) {
|
|
25049
25034
|
p17.log.warn(
|
|
25050
|
-
`Could not set ${
|
|
25035
|
+
`Could not set ${pc5.cyan(key)} on Vercel \u2014 add it in the project's environment settings.`
|
|
25051
25036
|
);
|
|
25052
25037
|
}
|
|
25053
25038
|
ensureVercelJsonFramework(options.cwd);
|
|
@@ -25062,7 +25047,7 @@ async function runVercelDeployFlow(options) {
|
|
|
25062
25047
|
}
|
|
25063
25048
|
for (const dep of packageGuard.localSpecDeps) {
|
|
25064
25049
|
p17.log.warn(
|
|
25065
|
-
`Dependency ${
|
|
25050
|
+
`Dependency ${pc5.cyan(dep)} uses a local spec that cannot install on Vercel \u2014 the remote build may fail.`
|
|
25066
25051
|
);
|
|
25067
25052
|
}
|
|
25068
25053
|
const deploySpinner = spinner2();
|
|
@@ -25077,13 +25062,13 @@ async function runVercelDeployFlow(options) {
|
|
|
25077
25062
|
packageGuard.restore();
|
|
25078
25063
|
}
|
|
25079
25064
|
if (deploy.failure) {
|
|
25080
|
-
deploySpinner.stop(`${
|
|
25081
|
-
if (deploy.detail) p17.log.message(
|
|
25065
|
+
deploySpinner.stop(`${pc5.yellow("\u25B2")} ${deployFailureMessage(deploy.failure)}`);
|
|
25066
|
+
if (deploy.detail) p17.log.message(pc5.dim(deploy.detail));
|
|
25082
25067
|
printManualDeployHint();
|
|
25083
25068
|
return { ok: false };
|
|
25084
25069
|
}
|
|
25085
25070
|
const url = deploy.url;
|
|
25086
|
-
deploySpinner.stop(url ? `Deployed ${
|
|
25071
|
+
deploySpinner.stop(url ? `Deployed ${pc5.cyan(url)}` : "Deployed to Vercel");
|
|
25087
25072
|
return { ok: true, url, syncedEnvKeys: sync.synced };
|
|
25088
25073
|
} catch (error) {
|
|
25089
25074
|
p17.log.warn(`Vercel deploy failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -25094,12 +25079,12 @@ async function runVercelDeployFlow(options) {
|
|
|
25094
25079
|
}
|
|
25095
25080
|
}
|
|
25096
25081
|
function printManualDeployHint() {
|
|
25097
|
-
p17.log.info(`You can deploy manually: ${
|
|
25082
|
+
p17.log.info(`You can deploy manually: ${pc5.cyan("vercel deploy --prod")}`);
|
|
25098
25083
|
}
|
|
25099
25084
|
async function ensureLinkedProject(runner, cwd, projectName, env, scope) {
|
|
25100
25085
|
if (readLinkedProjectId(cwd)) return;
|
|
25101
25086
|
const projectSpinner = spinner2();
|
|
25102
|
-
projectSpinner.start(`Creating a Vercel project ${
|
|
25087
|
+
projectSpinner.start(`Creating a Vercel project ${pc5.cyan(projectName)}`);
|
|
25103
25088
|
const project2 = await createVercelProject(runner, cwd, projectName, { env, scope });
|
|
25104
25089
|
projectSpinner.clear();
|
|
25105
25090
|
if (!project2.linked || !project2.projectId) {
|
|
@@ -25111,7 +25096,7 @@ async function pullNeonDatabaseUrl(runner, cwd, env) {
|
|
|
25111
25096
|
neonSpinner.start("Retrieving DATABASE_URL from Vercel");
|
|
25112
25097
|
const databaseUrl = await pullVercelEnvValue(runner, cwd, readDbUrlFromDotenv, env);
|
|
25113
25098
|
if (!databaseUrl) {
|
|
25114
|
-
neonSpinner.stop(`${
|
|
25099
|
+
neonSpinner.stop(`${pc5.yellow("\u25B2")} No DATABASE_URL came back from Vercel`);
|
|
25115
25100
|
return void 0;
|
|
25116
25101
|
}
|
|
25117
25102
|
neonSpinner.clear();
|
|
@@ -25171,7 +25156,7 @@ function neonFailureMessage(reason) {
|
|
|
25171
25156
|
}
|
|
25172
25157
|
|
|
25173
25158
|
// adapters/next/commands/init.ts
|
|
25174
|
-
import
|
|
25159
|
+
import pc6 from "picocolors";
|
|
25175
25160
|
|
|
25176
25161
|
// adapters/next/commands/seed.ts
|
|
25177
25162
|
import fs38 from "fs";
|
|
@@ -25486,7 +25471,7 @@ function resolveNonInteractiveProject(name) {
|
|
|
25486
25471
|
if (projectName !== "." && !/^[a-z0-9_-]+$/i.test(projectName)) {
|
|
25487
25472
|
throw new Error("Project name can only contain letters, numbers, hyphens, and underscores");
|
|
25488
25473
|
}
|
|
25489
|
-
return { projectName
|
|
25474
|
+
return { projectName };
|
|
25490
25475
|
}
|
|
25491
25476
|
async function readExistingConfigNamespace(cwd) {
|
|
25492
25477
|
const configPath = path50.resolve(cwd, "admin.config.ts");
|
|
@@ -25608,22 +25593,22 @@ async function runInitCommand(name, options) {
|
|
|
25608
25593
|
if (forceMode) {
|
|
25609
25594
|
const nuked = removeExistingAdminPaths(cwd, await resolveForceInitNamespaces(cwd, namespace));
|
|
25610
25595
|
if (nuked > 0) {
|
|
25611
|
-
p18.log.warn(`${
|
|
25596
|
+
p18.log.warn(`${pc6.yellow("Force mode:")} removed ${nuked} existing admin paths`);
|
|
25612
25597
|
}
|
|
25613
25598
|
project2 = detectProject(cwd, namespace);
|
|
25614
25599
|
} else if (project2.conflicts.length > 0) {
|
|
25615
|
-
const conflictLines = project2.conflicts.map((c) => `${
|
|
25600
|
+
const conflictLines = project2.conflicts.map((c) => `${pc6.yellow("\u25B2")} ${c}`);
|
|
25616
25601
|
conflictLines.push(
|
|
25617
25602
|
"",
|
|
25618
|
-
|
|
25603
|
+
pc6.dim(`Use ${pc6.bold("--force")} to remove existing admin files before scaffolding.`)
|
|
25619
25604
|
);
|
|
25620
|
-
p18.note(conflictLines.join("\n"),
|
|
25605
|
+
p18.note(conflictLines.join("\n"), pc6.yellow("Conflicts"));
|
|
25621
25606
|
if (!options.yes) {
|
|
25622
25607
|
const proceed = await p18.confirm({
|
|
25623
25608
|
message: [
|
|
25624
|
-
`Continue with ${
|
|
25625
|
-
`${
|
|
25626
|
-
|
|
25609
|
+
`Continue with ${pc6.bold(pc6.cyan("--force"))}?`,
|
|
25610
|
+
`${pc6.cyan("\u2502")} ${pc6.dim("This will force overwrite the existing admin code.")}`,
|
|
25611
|
+
pc6.cyan("\u2502")
|
|
25627
25612
|
].join("\n"),
|
|
25628
25613
|
initialValue: true
|
|
25629
25614
|
});
|
|
@@ -25637,13 +25622,12 @@ async function runInitCommand(name, options) {
|
|
|
25637
25622
|
await resolveForceInitNamespaces(cwd, namespace)
|
|
25638
25623
|
);
|
|
25639
25624
|
if (nuked > 0) {
|
|
25640
|
-
p18.log.warn(`${
|
|
25625
|
+
p18.log.warn(`${pc6.yellow("Force mode:")} removed ${nuked} existing admin paths`);
|
|
25641
25626
|
}
|
|
25642
25627
|
project2 = detectProject(cwd, namespace);
|
|
25643
25628
|
}
|
|
25644
25629
|
}
|
|
25645
25630
|
} else {
|
|
25646
|
-
p18.log.info("No Next.js app found \u2014 Running the fresh project mode...");
|
|
25647
25631
|
let projectPrompt;
|
|
25648
25632
|
try {
|
|
25649
25633
|
projectPrompt = options.yes ? resolveNonInteractiveProject(name) : await promptProject(name);
|
|
@@ -25651,7 +25635,7 @@ async function runInitCommand(name, options) {
|
|
|
25651
25635
|
p18.log.error(error instanceof Error ? error.message : String(error));
|
|
25652
25636
|
process.exit(1);
|
|
25653
25637
|
}
|
|
25654
|
-
srcDir =
|
|
25638
|
+
srcDir = false;
|
|
25655
25639
|
if (!options.yes) {
|
|
25656
25640
|
const pmChoice = await p18.select({
|
|
25657
25641
|
message: "Which package manager do you want to use?",
|
|
@@ -25700,8 +25684,8 @@ async function runInitCommand(name, options) {
|
|
|
25700
25684
|
p18.log.error(createNextAppResult.error);
|
|
25701
25685
|
p18.log.info(
|
|
25702
25686
|
`You can create the project manually:
|
|
25703
|
-
${
|
|
25704
|
-
Then run ${
|
|
25687
|
+
${pc6.cyan(`npx create-next-app@latest ${projectPrompt.projectName} --typescript --tailwind --app`)}
|
|
25688
|
+
Then run ${pc6.cyan("betterstart init")} inside it.`
|
|
25705
25689
|
);
|
|
25706
25690
|
process.exit(1);
|
|
25707
25691
|
}
|
|
@@ -25718,13 +25702,13 @@ async function runInitCommand(name, options) {
|
|
|
25718
25702
|
const manualCmd = `npx create-next-app@latest ${projectPrompt.projectName} --typescript --tailwind --app`;
|
|
25719
25703
|
p18.log.info(
|
|
25720
25704
|
`Create the project manually:
|
|
25721
|
-
${
|
|
25722
|
-
Then run ${
|
|
25705
|
+
${pc6.cyan(manualCmd)}
|
|
25706
|
+
Then run ${pc6.cyan("betterstart init")} inside it.`
|
|
25723
25707
|
);
|
|
25724
25708
|
process.exit(1);
|
|
25725
25709
|
}
|
|
25726
25710
|
const installedNextVersion = detectInstalledNextVersion(cwd);
|
|
25727
|
-
const nextVersionSuffix = installedNextVersion ? `${
|
|
25711
|
+
const nextVersionSuffix = installedNextVersion ? `${pc6.cyan(`v${installedNextVersion}`)}` : "";
|
|
25728
25712
|
createNextAppSpinner.stop(`Created a Next.js ${nextVersionSuffix} app in ${displayName}`);
|
|
25729
25713
|
project2 = detectProject(cwd, namespace);
|
|
25730
25714
|
isFreshProject = true;
|
|
@@ -25736,7 +25720,7 @@ async function runInitCommand(name, options) {
|
|
|
25736
25720
|
if (options.databaseUrl) {
|
|
25737
25721
|
if (!isValidDbUrl(options.databaseUrl)) {
|
|
25738
25722
|
p18.log.error(
|
|
25739
|
-
`Invalid database URL. Must start with ${
|
|
25723
|
+
`Invalid database URL. Must start with ${pc6.cyan("postgres://")} or ${pc6.cyan("postgresql://")}`
|
|
25740
25724
|
);
|
|
25741
25725
|
process.exit(1);
|
|
25742
25726
|
}
|
|
@@ -25759,11 +25743,11 @@ async function runInitCommand(name, options) {
|
|
|
25759
25743
|
const resourceUrl = flow.dashboardUrl ?? flow.resourceUrl;
|
|
25760
25744
|
if (resourceUrl) {
|
|
25761
25745
|
p18.log.info(
|
|
25762
|
-
`Open ${
|
|
25746
|
+
`Open ${pc6.cyan(resourceUrl)} to copy DATABASE_URL, then rerun ${pc6.cyan("betterstart init --database-url <url> --yes")}.`
|
|
25763
25747
|
);
|
|
25764
25748
|
} else {
|
|
25765
25749
|
p18.log.info(
|
|
25766
|
-
`Rerun ${
|
|
25750
|
+
`Rerun ${pc6.cyan("betterstart init --database-url <url> --yes")} with a Postgres connection string.`
|
|
25767
25751
|
);
|
|
25768
25752
|
}
|
|
25769
25753
|
} else {
|
|
@@ -25772,7 +25756,7 @@ async function runInitCommand(name, options) {
|
|
|
25772
25756
|
}
|
|
25773
25757
|
} else if (existingDbUrl) {
|
|
25774
25758
|
const masked = maskDbUrl(existingDbUrl);
|
|
25775
|
-
p18.log.info(`Using the existing DATABASE_URL from .env.local ${
|
|
25759
|
+
p18.log.info(`Using the existing DATABASE_URL from .env.local ${pc6.dim(`(${masked})`)}`);
|
|
25776
25760
|
databaseUrl = existingDbUrl;
|
|
25777
25761
|
} else {
|
|
25778
25762
|
const servicesResult = await promptServices({ allowVercel: options.vercel !== false });
|
|
@@ -25964,8 +25948,8 @@ async function runInitCommand(name, options) {
|
|
|
25964
25948
|
p18.log.warning(depsResult.error ?? "Unknown error");
|
|
25965
25949
|
p18.log.info(
|
|
25966
25950
|
`You can install them manually:
|
|
25967
|
-
${
|
|
25968
|
-
${
|
|
25951
|
+
${pc6.cyan(`${pm} add ${depsResult.dependencies.join(" ")}`)}
|
|
25952
|
+
${pc6.cyan(`${pm} add -D ${depsResult.devDeps.join(" ")}`)}`
|
|
25969
25953
|
);
|
|
25970
25954
|
}
|
|
25971
25955
|
if (depsInstalled) {
|
|
@@ -26033,7 +26017,7 @@ async function runInitCommand(name, options) {
|
|
|
26033
26017
|
}
|
|
26034
26018
|
let dbPushed = false;
|
|
26035
26019
|
if (depsResult.success && options.skipMigration && hasDbUrl(cwd)) {
|
|
26036
|
-
p18.log.info(`Skipping database schema push ${
|
|
26020
|
+
p18.log.info(`Skipping database schema push ${pc6.dim("(--skip-migration)")}`);
|
|
26037
26021
|
} else if (depsResult.success && hasDbUrl(cwd)) {
|
|
26038
26022
|
let driverReady = hasDrizzleKitPostgresDriverDependency(cwd);
|
|
26039
26023
|
if (!driverReady) {
|
|
@@ -26050,11 +26034,11 @@ async function runInitCommand(name, options) {
|
|
|
26050
26034
|
s.stop("Database push failed");
|
|
26051
26035
|
p18.log.warning(driverResult.error ?? `Failed to install ${DRIZZLE_KIT_POSTGRES_DRIVER_DEP}`);
|
|
26052
26036
|
p18.log.info(
|
|
26053
|
-
`Install ${DRIZZLE_KIT_POSTGRES_DRIVER_DEP} manually, then run: ${
|
|
26037
|
+
`Install ${DRIZZLE_KIT_POSTGRES_DRIVER_DEP} manually, then run: ${pc6.cyan(drizzlePushCommand(pm))}`
|
|
26054
26038
|
);
|
|
26055
26039
|
} else {
|
|
26056
26040
|
driverReady = hasDrizzleKitPostgresDriverDependency(cwd);
|
|
26057
|
-
s.stop(`${
|
|
26041
|
+
s.stop(`${pc6.green("\u2713")} Drizzle Kit Postgres driver dependency installed`);
|
|
26058
26042
|
}
|
|
26059
26043
|
}
|
|
26060
26044
|
if (driverReady) {
|
|
@@ -26096,7 +26080,7 @@ async function runInitCommand(name, options) {
|
|
|
26096
26080
|
p18.log.error("Database was not reachable. Aborting setup.");
|
|
26097
26081
|
process.exit(1);
|
|
26098
26082
|
}
|
|
26099
|
-
p18.log.info(`You can run it manually: ${
|
|
26083
|
+
p18.log.info(`You can run it manually: ${pc6.cyan(drizzlePushCommand(pm))}`);
|
|
26100
26084
|
}
|
|
26101
26085
|
}
|
|
26102
26086
|
}
|
|
@@ -26106,7 +26090,7 @@ async function runInitCommand(name, options) {
|
|
|
26106
26090
|
let adminAccountReady = false;
|
|
26107
26091
|
if (dbPushed && options.skipAdminCreation) {
|
|
26108
26092
|
p18.log.info(
|
|
26109
|
-
`Skipping admin user creation ${
|
|
26093
|
+
`Skipping admin user creation ${pc6.dim(`(use ${betterstartExecCommand(pm, "seed")} later)`)}`
|
|
26110
26094
|
);
|
|
26111
26095
|
}
|
|
26112
26096
|
if (dbPushed && !options.yes && !options.skipAdminCreation) {
|
|
@@ -26117,7 +26101,7 @@ async function runInitCommand(name, options) {
|
|
|
26117
26101
|
const adminCheck = await checkExistingAdmin(cwd, adminDir, authBasePath);
|
|
26118
26102
|
s.clear();
|
|
26119
26103
|
if (adminCheck.error) {
|
|
26120
|
-
p18.log.warning(`Could not verify existing admin account ${
|
|
26104
|
+
p18.log.warning(`Could not verify existing admin account ${pc6.dim(`(${adminCheck.error})`)}`);
|
|
26121
26105
|
if (isDatabaseReachabilityError(adminCheck.error)) {
|
|
26122
26106
|
p18.log.error("Database was not reachable. Aborting setup.");
|
|
26123
26107
|
process.exit(1);
|
|
@@ -26144,7 +26128,7 @@ async function runInitCommand(name, options) {
|
|
|
26144
26128
|
}
|
|
26145
26129
|
if (adminAction === "skip") {
|
|
26146
26130
|
adminAccountReady = true;
|
|
26147
|
-
p18.log.info(`Keeping existing admin account ${
|
|
26131
|
+
p18.log.info(`Keeping existing admin account ${pc6.dim(`(${existingAdminLabel})`)}`);
|
|
26148
26132
|
} else {
|
|
26149
26133
|
replaceExistingAdmin = true;
|
|
26150
26134
|
}
|
|
@@ -26186,7 +26170,7 @@ async function runInitCommand(name, options) {
|
|
|
26186
26170
|
seedOverwriteMode
|
|
26187
26171
|
);
|
|
26188
26172
|
if (seedResult.existingUser) {
|
|
26189
|
-
s.stop(`${
|
|
26173
|
+
s.stop(`${pc6.yellow("\u25B2")} An account already exists for ${credentials.email}`);
|
|
26190
26174
|
const replace = await p18.confirm({
|
|
26191
26175
|
message: "Replace the existing account with this email?",
|
|
26192
26176
|
initialValue: false
|
|
@@ -26206,17 +26190,17 @@ async function runInitCommand(name, options) {
|
|
|
26206
26190
|
}
|
|
26207
26191
|
if (seedResult.success) {
|
|
26208
26192
|
s.stop(
|
|
26209
|
-
seedOverwriteMode === "admin" ? `${
|
|
26193
|
+
seedOverwriteMode === "admin" ? `${pc6.green("\u2713")} Admin user replaced` : `${pc6.green("\u2713")} Admin user created`
|
|
26210
26194
|
);
|
|
26211
26195
|
seedSuccess = true;
|
|
26212
26196
|
adminAccountReady = true;
|
|
26213
26197
|
} else if (seedResult.error) {
|
|
26214
|
-
s.stop(`${
|
|
26198
|
+
s.stop(`${pc6.red("\u2717")} Failed to create admin user`);
|
|
26215
26199
|
p18.note(
|
|
26216
|
-
`${
|
|
26200
|
+
`${pc6.red(seedResult.error)}
|
|
26217
26201
|
|
|
26218
|
-
Run manually: ${
|
|
26219
|
-
|
|
26202
|
+
Run manually: ${pc6.cyan(betterstartExecCommand(pm, "seed"))}`,
|
|
26203
|
+
pc6.red("Seed failed")
|
|
26220
26204
|
);
|
|
26221
26205
|
if (isDatabaseReachabilityError(seedResult.error)) {
|
|
26222
26206
|
p18.log.error("Database was not reachable. Aborting setup.");
|
|
@@ -26646,10 +26630,10 @@ function stripAnsi2(value) {
|
|
|
26646
26630
|
return value.replace(ANSI_ESCAPE_PATTERN2, "");
|
|
26647
26631
|
}
|
|
26648
26632
|
function printAdminReadyNote(state) {
|
|
26649
|
-
const lines = [`Admin: ${
|
|
26633
|
+
const lines = [`Admin: ${pc6.cyan(state.adminLoginUrl)}`];
|
|
26650
26634
|
if (state.adminEmail && state.adminPassword) {
|
|
26651
|
-
lines.unshift(`Password: ${
|
|
26652
|
-
lines.unshift(`Admin user: ${
|
|
26635
|
+
lines.unshift(`Password: ${pc6.cyan(state.adminPassword)}`);
|
|
26636
|
+
lines.unshift(`Admin user: ${pc6.cyan(state.adminEmail)}`);
|
|
26653
26637
|
}
|
|
26654
26638
|
p18.note(lines.join("\n"), "Admin ready");
|
|
26655
26639
|
}
|
|
@@ -27019,7 +27003,7 @@ async function runRemoveSchemaCommand(schemaName, options) {
|
|
|
27019
27003
|
import fs42 from "fs";
|
|
27020
27004
|
import path55 from "path";
|
|
27021
27005
|
import * as p22 from "@clack/prompts";
|
|
27022
|
-
import
|
|
27006
|
+
import pc7 from "picocolors";
|
|
27023
27007
|
|
|
27024
27008
|
// adapters/next/commands/uninstall-cleaners.ts
|
|
27025
27009
|
import fs41 from "fs";
|
|
@@ -27305,7 +27289,7 @@ function buildUninstallPlan(cwd, namespaceValue) {
|
|
|
27305
27289
|
}
|
|
27306
27290
|
async function runUninstallCommand(options) {
|
|
27307
27291
|
const cwd = options.cwd ? path55.resolve(options.cwd) : process.cwd();
|
|
27308
|
-
p22.intro(
|
|
27292
|
+
p22.intro(pc7.bgRed(pc7.white(" BetterStart Uninstall ")));
|
|
27309
27293
|
let namespace = DEFAULT_ADMIN_NAMESPACE;
|
|
27310
27294
|
try {
|
|
27311
27295
|
const config = await resolveConfig(cwd);
|
|
@@ -27314,14 +27298,14 @@ async function runUninstallCommand(options) {
|
|
|
27314
27298
|
}
|
|
27315
27299
|
const steps = buildUninstallPlan(cwd, namespace);
|
|
27316
27300
|
if (steps.length === 0) {
|
|
27317
|
-
p22.log.success(`${
|
|
27301
|
+
p22.log.success(`${pc7.green("\u2713")} Nothing to remove \u2014 project is already clean.`);
|
|
27318
27302
|
p22.outro("Done");
|
|
27319
27303
|
return;
|
|
27320
27304
|
}
|
|
27321
27305
|
const planLines = steps.map((step) => {
|
|
27322
27306
|
const names = step.items.join(" ");
|
|
27323
|
-
const countLabel =
|
|
27324
|
-
return `${
|
|
27307
|
+
const countLabel = pc7.dim(`${step.count} ${step.unit}`);
|
|
27308
|
+
return `${pc7.red("\xD7")} ${names} ${countLabel}`;
|
|
27325
27309
|
});
|
|
27326
27310
|
p22.note(planLines.join("\n"), "Uninstall plan");
|
|
27327
27311
|
if (!options.force) {
|
|
@@ -27342,7 +27326,7 @@ async function runUninstallCommand(options) {
|
|
|
27342
27326
|
}
|
|
27343
27327
|
const parts = steps.map((step) => `${step.count} ${step.unit}`);
|
|
27344
27328
|
s.stop(`Removed ${parts.join(", ")}`);
|
|
27345
|
-
p22.note(
|
|
27329
|
+
p22.note(pc7.dim("Database tables were NOT dropped \u2014 drop them manually if needed."), "Next steps");
|
|
27346
27330
|
p22.outro("Uninstall complete");
|
|
27347
27331
|
}
|
|
27348
27332
|
|