betterstart-cli 0.0.59 → 0.0.61
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 +29 -32
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -19785,6 +19785,11 @@ function fitSpinnerMessage(message) {
|
|
|
19785
19785
|
}
|
|
19786
19786
|
var CLACK_LINE_ROWS = 2;
|
|
19787
19787
|
var LOG_PREFIX_WIDTH = 3;
|
|
19788
|
+
function clackPromptRows(message, value) {
|
|
19789
|
+
const columns = process.stdout.columns ?? 80;
|
|
19790
|
+
const rows = (text7) => Math.max(1, Math.ceil((stripVTControlCharacters(text7).length + LOG_PREFIX_WIDTH) / columns));
|
|
19791
|
+
return 1 + rows(message) + rows(value);
|
|
19792
|
+
}
|
|
19788
19793
|
function clackLogRows(message) {
|
|
19789
19794
|
const columns = process.stdout.columns ?? 80;
|
|
19790
19795
|
const width = stripVTControlCharacters(message).length + LOG_PREFIX_WIDTH;
|
|
@@ -19794,6 +19799,14 @@ function eraseRows(rows) {
|
|
|
19794
19799
|
if (rows <= 0 || !process.stdout.isTTY || process.env.CI === "true") return;
|
|
19795
19800
|
process.stdout.write(`\x1B[${rows}A\x1B[${rows}M`);
|
|
19796
19801
|
}
|
|
19802
|
+
function eraseRowsAbove(rows, rowsBelow) {
|
|
19803
|
+
if (rows <= 0 || rowsBelow < 0 || !process.stdout.isTTY || process.env.CI === "true") {
|
|
19804
|
+
return;
|
|
19805
|
+
}
|
|
19806
|
+
const up = rows + rowsBelow;
|
|
19807
|
+
const restore = rowsBelow > 0 ? `\x1B[${rowsBelow}B` : "";
|
|
19808
|
+
process.stdout.write(`\x1B[${up}A\x1B[${rows}M${restore}`);
|
|
19809
|
+
}
|
|
19797
19810
|
function eraseClackLine(options = {}) {
|
|
19798
19811
|
if (!process.stdout.isTTY || process.env.CI === "true") return;
|
|
19799
19812
|
const below = (options.linesBelow ?? 0) * CLACK_LINE_ROWS;
|
|
@@ -25737,9 +25750,7 @@ async function runInitCommand(name, options) {
|
|
|
25737
25750
|
);
|
|
25738
25751
|
process.exit(1);
|
|
25739
25752
|
}
|
|
25740
|
-
|
|
25741
|
-
const nextVersionSuffix = installedNextVersion ? `${pc6.cyan(`v${installedNextVersion}`)}` : "";
|
|
25742
|
-
createNextAppSpinner.stop(`Created a Next.js ${nextVersionSuffix} app in ${displayName}`);
|
|
25753
|
+
createNextAppSpinner.clear();
|
|
25743
25754
|
project2 = detectProject(cwd, namespace);
|
|
25744
25755
|
isFreshProject = true;
|
|
25745
25756
|
}
|
|
@@ -26189,6 +26200,8 @@ async function runInitCommand(name, options) {
|
|
|
26189
26200
|
);
|
|
26190
26201
|
seedEmail = credentials.email;
|
|
26191
26202
|
seedPassword = credentials.password;
|
|
26203
|
+
const credentialPromptRows = clackPromptRows("Admin email", credentials.email) + clackPromptRows("Admin password", p18.S_PASSWORD_MASK.repeat(credentials.password.length));
|
|
26204
|
+
let rowsBelowCredentialPrompts = 0;
|
|
26192
26205
|
let seedOverwriteMode = replaceExistingAdmin ? "admin" : void 0;
|
|
26193
26206
|
s.start(replaceExistingAdmin ? "Replacing admin user" : "Creating admin user");
|
|
26194
26207
|
let seedResult = await runSeed(
|
|
@@ -26200,11 +26213,18 @@ async function runInitCommand(name, options) {
|
|
|
26200
26213
|
seedOverwriteMode
|
|
26201
26214
|
);
|
|
26202
26215
|
if (seedResult.existingUser) {
|
|
26203
|
-
|
|
26216
|
+
const existingAccountMessage = `${pc6.yellow("\u25B2")} An account already exists for ${credentials.email}`;
|
|
26217
|
+
s.stop(existingAccountMessage);
|
|
26218
|
+
rowsBelowCredentialPrompts += clackLogRows(existingAccountMessage);
|
|
26219
|
+
const replaceAccountMessage = "Replace the existing account with this email?";
|
|
26204
26220
|
const replace = await p18.confirm({
|
|
26205
|
-
message:
|
|
26221
|
+
message: replaceAccountMessage,
|
|
26206
26222
|
initialValue: false
|
|
26207
26223
|
});
|
|
26224
|
+
rowsBelowCredentialPrompts += clackPromptRows(
|
|
26225
|
+
replaceAccountMessage,
|
|
26226
|
+
replace === true ? "Yes" : "No"
|
|
26227
|
+
);
|
|
26208
26228
|
if (!p18.isCancel(replace) && replace) {
|
|
26209
26229
|
seedOverwriteMode = "email";
|
|
26210
26230
|
s.start("Replacing admin user");
|
|
@@ -26219,9 +26239,10 @@ async function runInitCommand(name, options) {
|
|
|
26219
26239
|
}
|
|
26220
26240
|
}
|
|
26221
26241
|
if (seedResult.success) {
|
|
26222
|
-
|
|
26223
|
-
|
|
26224
|
-
);
|
|
26242
|
+
const seedSuccessMessage = seedOverwriteMode === "admin" ? `${pc6.green("\u2713")} Admin user replaced` : `${pc6.green("\u2713")} Admin user created`;
|
|
26243
|
+
s.stop(seedSuccessMessage);
|
|
26244
|
+
rowsBelowCredentialPrompts += clackLogRows(seedSuccessMessage);
|
|
26245
|
+
eraseRowsAbove(credentialPromptRows, rowsBelowCredentialPrompts);
|
|
26225
26246
|
seedSuccess = true;
|
|
26226
26247
|
adminAccountReady = true;
|
|
26227
26248
|
} else if (seedResult.error) {
|
|
@@ -26338,30 +26359,6 @@ function hasDbUrl(cwd) {
|
|
|
26338
26359
|
}
|
|
26339
26360
|
return false;
|
|
26340
26361
|
}
|
|
26341
|
-
function detectInstalledNextVersion(cwd) {
|
|
26342
|
-
const installedNextPackagePath = path50.join(cwd, "node_modules", "next", "package.json");
|
|
26343
|
-
if (fs39.existsSync(installedNextPackagePath)) {
|
|
26344
|
-
try {
|
|
26345
|
-
const installedPkg = JSON.parse(fs39.readFileSync(installedNextPackagePath, "utf-8"));
|
|
26346
|
-
if (typeof installedPkg.version === "string" && installedPkg.version.length > 0) {
|
|
26347
|
-
return installedPkg.version;
|
|
26348
|
-
}
|
|
26349
|
-
} catch {
|
|
26350
|
-
}
|
|
26351
|
-
}
|
|
26352
|
-
const projectPackagePath = path50.join(cwd, "package.json");
|
|
26353
|
-
if (!fs39.existsSync(projectPackagePath)) return void 0;
|
|
26354
|
-
try {
|
|
26355
|
-
const projectPkg = JSON.parse(fs39.readFileSync(projectPackagePath, "utf-8"));
|
|
26356
|
-
const nextVersion = projectPkg.dependencies?.next ?? projectPkg.devDependencies?.next;
|
|
26357
|
-
if (typeof nextVersion !== "string" || nextVersion.length === 0) {
|
|
26358
|
-
return void 0;
|
|
26359
|
-
}
|
|
26360
|
-
return nextVersion.replace(/^[~^<>=\s]+/, "");
|
|
26361
|
-
} catch {
|
|
26362
|
-
return void 0;
|
|
26363
|
-
}
|
|
26364
|
-
}
|
|
26365
26362
|
function shouldUseTerminalForDbPush(options) {
|
|
26366
26363
|
return !options.yes && process.env.CI !== "true" && Boolean(process.stdin.isTTY) && Boolean(process.stdout.isTTY);
|
|
26367
26364
|
}
|