betterstart-cli 0.0.46 → 0.0.48
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 +19 -117
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3468,7 +3468,7 @@ function schemaManifestContainsMailchimpImports(cwd, config, schemaName) {
|
|
|
3468
3468
|
return false;
|
|
3469
3469
|
}
|
|
3470
3470
|
const content = fs14.readFileSync(fullPath, "utf-8");
|
|
3471
|
-
return markers.some((
|
|
3471
|
+
return markers.some((marker) => content.includes(marker));
|
|
3472
3472
|
});
|
|
3473
3473
|
}
|
|
3474
3474
|
function findBlockingIntegrationDependencies(cwd, config, integrationId) {
|
|
@@ -21868,80 +21868,20 @@ var GREEN_CHECK = "\x1B[32m\u2713\x1B[39m";
|
|
|
21868
21868
|
function restyleStepSubmitSymbols(text7) {
|
|
21869
21869
|
return text7.split(GREEN_STEP_SUBMIT).join(GREEN_CHECK);
|
|
21870
21870
|
}
|
|
21871
|
-
var ROW_ESCAPES = /\u001B\[(\d*)([ABEF])/g;
|
|
21872
|
-
function rowDelta(text7) {
|
|
21873
|
-
let delta = text7.split("\n").length - 1;
|
|
21874
|
-
for (const match of text7.matchAll(ROW_ESCAPES)) {
|
|
21875
|
-
const n = match[1] === "" ? 1 : Number(match[1]);
|
|
21876
|
-
delta += match[2] === "A" || match[2] === "F" ? -n : n;
|
|
21877
|
-
}
|
|
21878
|
-
return delta;
|
|
21879
|
-
}
|
|
21880
21871
|
var installed = false;
|
|
21881
|
-
var armed = false;
|
|
21882
|
-
var marker = null;
|
|
21883
|
-
var generation = 0;
|
|
21884
|
-
var rawStdoutWrite;
|
|
21885
21872
|
function installPromptCheckmarks() {
|
|
21886
21873
|
if (installed || !process.stdout.isTTY || process.env.CI === "true") return () => {
|
|
21887
21874
|
};
|
|
21888
21875
|
installed = true;
|
|
21889
|
-
const
|
|
21890
|
-
const
|
|
21891
|
-
const writeOut = unpatchedOut.bind(process.stdout);
|
|
21892
|
-
const writeErr = unpatchedErr.bind(process.stderr);
|
|
21893
|
-
rawStdoutWrite = writeOut;
|
|
21876
|
+
const unpatched = process.stdout.write;
|
|
21877
|
+
const write = unpatched.bind(process.stdout);
|
|
21894
21878
|
process.stdout.write = ((chunk, encoding, callback) => {
|
|
21895
|
-
if (typeof chunk !== "string") return
|
|
21896
|
-
|
|
21897
|
-
if (idx === -1) {
|
|
21898
|
-
if (marker) marker.rowsAbove += rowDelta(chunk);
|
|
21899
|
-
return writeOut(restyleStepSubmitSymbols(chunk), encoding, callback);
|
|
21900
|
-
}
|
|
21901
|
-
armed = false;
|
|
21902
|
-
const rest = chunk.slice(idx + GREEN_STEP_SUBMIT.length);
|
|
21903
|
-
marker = { rowsAbove: rowDelta(rest) };
|
|
21904
|
-
return writeOut(
|
|
21905
|
-
restyleStepSubmitSymbols(chunk.slice(0, idx)) + GREEN_STEP_SUBMIT + restyleStepSubmitSymbols(rest),
|
|
21906
|
-
encoding,
|
|
21907
|
-
callback
|
|
21908
|
-
);
|
|
21909
|
-
});
|
|
21910
|
-
process.stderr.write = ((chunk, encoding, callback) => {
|
|
21911
|
-
if (typeof chunk === "string" && marker) marker.rowsAbove += rowDelta(chunk);
|
|
21912
|
-
return writeErr(chunk, encoding, callback);
|
|
21879
|
+
if (typeof chunk !== "string") return write(chunk, encoding, callback);
|
|
21880
|
+
return write(restyleStepSubmitSymbols(chunk), encoding, callback);
|
|
21913
21881
|
});
|
|
21914
21882
|
return () => {
|
|
21915
|
-
process.stdout.write =
|
|
21916
|
-
process.stderr.write = unpatchedErr;
|
|
21917
|
-
rawStdoutWrite = void 0;
|
|
21883
|
+
process.stdout.write = unpatched;
|
|
21918
21884
|
installed = false;
|
|
21919
|
-
armed = false;
|
|
21920
|
-
marker = null;
|
|
21921
|
-
};
|
|
21922
|
-
}
|
|
21923
|
-
function deferNextPromptCheck() {
|
|
21924
|
-
if (!installed) return { confirm() {
|
|
21925
|
-
}, skip() {
|
|
21926
|
-
} };
|
|
21927
|
-
generation += 1;
|
|
21928
|
-
const token = generation;
|
|
21929
|
-
armed = true;
|
|
21930
|
-
marker = null;
|
|
21931
|
-
return {
|
|
21932
|
-
confirm() {
|
|
21933
|
-
if (token !== generation) return;
|
|
21934
|
-
armed = false;
|
|
21935
|
-
const rows = marker?.rowsAbove;
|
|
21936
|
-
marker = null;
|
|
21937
|
-
if (rows === void 0 || rows <= 0 || rows >= (process.stdout.rows ?? 24)) return;
|
|
21938
|
-
rawStdoutWrite?.(`\x1B[${rows}A\r${GREEN_CHECK}\x1B[${rows}B\r`);
|
|
21939
|
-
},
|
|
21940
|
-
skip() {
|
|
21941
|
-
if (token !== generation) return;
|
|
21942
|
-
armed = false;
|
|
21943
|
-
marker = null;
|
|
21944
|
-
}
|
|
21945
21885
|
};
|
|
21946
21886
|
}
|
|
21947
21887
|
|
|
@@ -22198,7 +22138,6 @@ async function promptPresets(cwd, options = {}) {
|
|
|
22198
22138
|
overwriteKeys.add(key);
|
|
22199
22139
|
}
|
|
22200
22140
|
};
|
|
22201
|
-
const storageStep = deferNextPromptCheck();
|
|
22202
22141
|
const storage = await p12.select({
|
|
22203
22142
|
message: "Choose a file storage",
|
|
22204
22143
|
options: [
|
|
@@ -22224,7 +22163,6 @@ async function promptPresets(cwd, options = {}) {
|
|
|
22224
22163
|
}
|
|
22225
22164
|
if (storage === "r2") {
|
|
22226
22165
|
mergeIntegrationConfig(await collectIntegrationConfig(cwd, ["r2"]));
|
|
22227
|
-
storageStep.confirm();
|
|
22228
22166
|
} else if (storage === "vercel-blob") {
|
|
22229
22167
|
const existingToken = readEnvVar(cwd, "BLOB_READ_WRITE_TOKEN")?.trim();
|
|
22230
22168
|
const flow = !existingToken && options.provisionVercelBlob ? await options.provisionVercelBlob() : void 0;
|
|
@@ -22235,8 +22173,6 @@ async function promptPresets(cwd, options = {}) {
|
|
|
22235
22173
|
vars: [{ key: "BLOB_READ_WRITE_TOKEN", value: flow.token }]
|
|
22236
22174
|
});
|
|
22237
22175
|
overwriteKeys.add("BLOB_READ_WRITE_TOKEN");
|
|
22238
|
-
if (flow.usedTerminalFallback) storageStep.skip();
|
|
22239
|
-
else storageStep.confirm();
|
|
22240
22176
|
} else if (flow) {
|
|
22241
22177
|
p12.log.warn(
|
|
22242
22178
|
"Continuing without a Blob token \u2014 add BLOB_READ_WRITE_TOKEN to .env.local from the store on vercel.com/dashboard/stores."
|
|
@@ -22245,7 +22181,6 @@ async function promptPresets(cwd, options = {}) {
|
|
|
22245
22181
|
header: "Storage (Vercel Blob)",
|
|
22246
22182
|
vars: [{ key: "BLOB_READ_WRITE_TOKEN", value: "" }]
|
|
22247
22183
|
});
|
|
22248
|
-
storageStep.skip();
|
|
22249
22184
|
} else {
|
|
22250
22185
|
if (existingToken) {
|
|
22251
22186
|
p12.log.info(
|
|
@@ -22256,10 +22191,7 @@ async function promptPresets(cwd, options = {}) {
|
|
|
22256
22191
|
);
|
|
22257
22192
|
}
|
|
22258
22193
|
mergeIntegrationConfig(await collectIntegrationConfig(cwd, ["vercel-blob"]));
|
|
22259
|
-
storageStep.confirm();
|
|
22260
22194
|
}
|
|
22261
|
-
} else {
|
|
22262
|
-
storageStep.confirm();
|
|
22263
22195
|
}
|
|
22264
22196
|
const selectedPresets = await p12.multiselect({
|
|
22265
22197
|
message: "Select presets",
|
|
@@ -24592,11 +24524,7 @@ async function provisionBlobStoreInteractive(runner, cwd, options) {
|
|
|
24592
24524
|
return { ...storeName && { storeName }, failure: "env-pull-empty" };
|
|
24593
24525
|
}
|
|
24594
24526
|
activeSpinner.clear();
|
|
24595
|
-
return {
|
|
24596
|
-
token,
|
|
24597
|
-
...storeName && { storeName },
|
|
24598
|
-
...terminalFallbackRan && { usedTerminalFallback: true }
|
|
24599
|
-
};
|
|
24527
|
+
return { token, ...storeName && { storeName } };
|
|
24600
24528
|
};
|
|
24601
24529
|
for (let attempt = 1; attempt <= MAX_STORE_NAME_ATTEMPTS; attempt++) {
|
|
24602
24530
|
const storeName = candidateStoreName(options.name, attempt);
|
|
@@ -24980,7 +24908,7 @@ async function runVercelNeonFlow(options) {
|
|
|
24980
24908
|
p17.log.warn(authFailureMessage(auth.reason));
|
|
24981
24909
|
return { ok: false };
|
|
24982
24910
|
}
|
|
24983
|
-
|
|
24911
|
+
await ensureLinkedProject(runner, options.cwd, options.projectName, env);
|
|
24984
24912
|
const neon = await provisionNeonForMode(runner, options);
|
|
24985
24913
|
if (neon.failure) {
|
|
24986
24914
|
p17.log.warn(neonFailureMessage(neon.failure));
|
|
@@ -24988,7 +24916,7 @@ async function runVercelNeonFlow(options) {
|
|
|
24988
24916
|
return { ok: false };
|
|
24989
24917
|
}
|
|
24990
24918
|
const databaseUrl = await pullNeonDatabaseUrl(runner, options.cwd, env);
|
|
24991
|
-
const dismissSignedInNote = databaseUrl && auth.dismissNote && !neon.usedTerminalFallback ? () => auth.dismissNote?.({ linesBelow:
|
|
24919
|
+
const dismissSignedInNote = databaseUrl && auth.dismissNote && !neon.usedTerminalFallback ? () => auth.dismissNote?.({ linesBelow: 0 }) : void 0;
|
|
24992
24920
|
return {
|
|
24993
24921
|
ok: true,
|
|
24994
24922
|
databaseUrl,
|
|
@@ -25028,8 +24956,7 @@ async function runVercelBlobFlow(options) {
|
|
|
25028
24956
|
return {
|
|
25029
24957
|
ok: true,
|
|
25030
24958
|
token: blob.token,
|
|
25031
|
-
blobStoreName: blob.storeName
|
|
25032
|
-
usedTerminalFallback: blob.usedTerminalFallback
|
|
24959
|
+
blobStoreName: blob.storeName
|
|
25033
24960
|
};
|
|
25034
24961
|
} catch (error) {
|
|
25035
24962
|
p17.log.warn(
|
|
@@ -25058,32 +24985,21 @@ async function runVercelDeployFlow(options) {
|
|
|
25058
24985
|
const envSpinner = spinner2();
|
|
25059
24986
|
envSpinner.start("Syncing environment variables to Vercel");
|
|
25060
24987
|
const sync = await syncVercelProductionEnv(runner, options.cwd, env);
|
|
25061
|
-
|
|
25062
|
-
envSpinner.stop(
|
|
25063
|
-
`Synced ${sync.synced.length} environment variable${sync.synced.length === 1 ? "" : "s"} to Vercel`
|
|
25064
|
-
);
|
|
25065
|
-
} else {
|
|
25066
|
-
envSpinner.clear();
|
|
25067
|
-
}
|
|
25068
|
-
let printedWarnings = false;
|
|
24988
|
+
envSpinner.clear();
|
|
25069
24989
|
for (const key of sync.failed) {
|
|
25070
|
-
printedWarnings = true;
|
|
25071
24990
|
p17.log.warn(
|
|
25072
24991
|
`Could not set ${pc6.cyan(key)} on Vercel \u2014 add it in the project's environment settings.`
|
|
25073
24992
|
);
|
|
25074
24993
|
}
|
|
25075
|
-
|
|
25076
|
-
p17.log.success(`Created ${pc6.cyan("vercel.json")} with the Next.js framework preset`);
|
|
25077
|
-
}
|
|
24994
|
+
ensureVercelJsonFramework(options.cwd);
|
|
25078
24995
|
const packageGuard = guardProjectForDeploy(options.cwd);
|
|
25079
24996
|
for (const dep of packageGuard.localSpecDeps) {
|
|
25080
|
-
printedWarnings = true;
|
|
25081
24997
|
p17.log.warn(
|
|
25082
24998
|
`Dependency ${pc6.cyan(dep)} uses a local spec that cannot install on Vercel \u2014 the remote build may fail.`
|
|
25083
24999
|
);
|
|
25084
25000
|
}
|
|
25085
25001
|
const deploySpinner = spinner2();
|
|
25086
|
-
deploySpinner.start("Deploying to Vercel
|
|
25002
|
+
deploySpinner.start("Deploying to Vercel, This may take a moment");
|
|
25087
25003
|
let deploy;
|
|
25088
25004
|
try {
|
|
25089
25005
|
deploy = await deployVercelProject(runner, options.cwd, env);
|
|
@@ -25099,7 +25015,7 @@ async function runVercelDeployFlow(options) {
|
|
|
25099
25015
|
const linkedName = readLinkedProjectName(options.cwd);
|
|
25100
25016
|
const url = linkedName ? `https://${linkedName}.vercel.app` : deploy.url;
|
|
25101
25017
|
deploySpinner.stop(url ? `Deployed ${pc6.cyan(url)}` : "Deployed to Vercel");
|
|
25102
|
-
return { ok: true, url, syncedEnvKeys: sync.synced
|
|
25018
|
+
return { ok: true, url, syncedEnvKeys: sync.synced };
|
|
25103
25019
|
} catch (error) {
|
|
25104
25020
|
p17.log.warn(`Vercel deploy failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
25105
25021
|
printManualDeployHint();
|
|
@@ -25112,14 +25028,11 @@ function printManualDeployHint() {
|
|
|
25112
25028
|
p17.log.info(`You can deploy manually: ${pc6.cyan("vercel deploy --prod")}`);
|
|
25113
25029
|
}
|
|
25114
25030
|
async function ensureLinkedProject(runner, cwd, projectName, env) {
|
|
25115
|
-
if (readLinkedProjectId(cwd)) return
|
|
25031
|
+
if (readLinkedProjectId(cwd)) return;
|
|
25116
25032
|
const projectSpinner = spinner2();
|
|
25117
25033
|
projectSpinner.start(`Creating a Vercel project ${pc6.cyan(projectName)}`);
|
|
25118
|
-
|
|
25119
|
-
projectSpinner.
|
|
25120
|
-
project2.linked ? `Linked Vercel project ${pc6.cyan(project2.name)}` : `Using Vercel project ${pc6.cyan(project2.name)}`
|
|
25121
|
-
);
|
|
25122
|
-
return true;
|
|
25034
|
+
await createVercelProject(runner, cwd, projectName, env);
|
|
25035
|
+
projectSpinner.clear();
|
|
25123
25036
|
}
|
|
25124
25037
|
async function pullNeonDatabaseUrl(runner, cwd, env) {
|
|
25125
25038
|
const neonSpinner = spinner2();
|
|
@@ -25790,7 +25703,6 @@ async function runInitCommand(name, options) {
|
|
|
25790
25703
|
p18.log.info(`Using the existing DATABASE_URL from .env.local ${pc7.dim(`(${masked})`)}`);
|
|
25791
25704
|
databaseUrl = existingDbUrl;
|
|
25792
25705
|
} else {
|
|
25793
|
-
const databaseStep = deferNextPromptCheck();
|
|
25794
25706
|
const servicesResult = await promptServices({ allowVercel: options.vercel !== false });
|
|
25795
25707
|
if (servicesResult.provider === "vercel-cli") {
|
|
25796
25708
|
const flow = await runVercelNeonFlow({
|
|
@@ -25804,22 +25716,17 @@ async function runInitCommand(name, options) {
|
|
|
25804
25716
|
databaseUrl = flow.databaseUrl;
|
|
25805
25717
|
persistDatabaseUrl(cwd, databaseUrl);
|
|
25806
25718
|
dismissVercelSignedInNote = flow.dismissSignedInNote;
|
|
25807
|
-
if (flow.dismissSignedInNote) databaseStep.confirm();
|
|
25808
|
-
else databaseStep.skip();
|
|
25809
25719
|
} else if (flow.ok) {
|
|
25810
|
-
databaseStep.skip();
|
|
25811
25720
|
openBrowserVercelNeonResource(flow.dashboardUrl ?? flow.resourceUrl);
|
|
25812
25721
|
databaseUrl = await promptConnectionString();
|
|
25813
25722
|
persistDatabaseUrl(cwd, databaseUrl);
|
|
25814
25723
|
} else {
|
|
25815
|
-
databaseStep.skip();
|
|
25816
25724
|
p18.log.info("Falling back to a manual database connection string.");
|
|
25817
25725
|
openBrowserVercelNeon();
|
|
25818
25726
|
databaseUrl = await promptConnectionString();
|
|
25819
25727
|
}
|
|
25820
25728
|
} else {
|
|
25821
25729
|
databaseUrl = servicesResult.url;
|
|
25822
|
-
databaseStep.confirm();
|
|
25823
25730
|
}
|
|
25824
25731
|
}
|
|
25825
25732
|
const selectedPresets = (() => {
|
|
@@ -25962,7 +25869,7 @@ async function runInitCommand(name, options) {
|
|
|
25962
25869
|
}
|
|
25963
25870
|
const coreDependencyPlan = getDependencyPlan([], [], project2.linter.type === "none");
|
|
25964
25871
|
const cliDependencyPlan = getCliDependencySyncPlan(cwd);
|
|
25965
|
-
s.start("Installing dependencies
|
|
25872
|
+
s.start("Installing dependencies, This may take a moment");
|
|
25966
25873
|
const depsResult = await installDependenciesAsync({
|
|
25967
25874
|
cwd,
|
|
25968
25875
|
pm,
|
|
@@ -26265,17 +26172,12 @@ Run manually: ${pc7.cyan(betterstartExecCommand(pm, "seed"))}`,
|
|
|
26265
26172
|
if (options.vercel !== false && !options.skipDeploy) {
|
|
26266
26173
|
const linkedVercelProject = Boolean(readLinkedProjectId(cwd));
|
|
26267
26174
|
if (!options.yes) {
|
|
26268
|
-
const deployStep = deferNextPromptCheck();
|
|
26269
26175
|
const deployNow = await p18.confirm({
|
|
26270
26176
|
message: "Deploy to Vercel now?",
|
|
26271
26177
|
initialValue: linkedVercelProject
|
|
26272
26178
|
});
|
|
26273
26179
|
if (!p18.isCancel(deployNow) && deployNow) {
|
|
26274
|
-
|
|
26275
|
-
if (deployFlow.ok && deployFlow.cleanScreen) deployStep.confirm();
|
|
26276
|
-
else deployStep.skip();
|
|
26277
|
-
} else {
|
|
26278
|
-
deployStep.confirm();
|
|
26180
|
+
await runVercelDeployFlow({ cwd, projectName, env: process.env });
|
|
26279
26181
|
}
|
|
26280
26182
|
} else if (linkedVercelProject && process.env.VERCEL_TOKEN) {
|
|
26281
26183
|
const deployFlow = await runVercelDeployFlow({
|