betterstart-cli 0.0.44 → 0.0.46
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 +6 -71
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -24889,8 +24889,6 @@ import * as p16 from "@clack/prompts";
|
|
|
24889
24889
|
import pc5 from "picocolors";
|
|
24890
24890
|
var PROVISION_TIMEOUT_MS2 = 18e4;
|
|
24891
24891
|
var INTERACTIVE_PROVISION_TIMEOUT_MS2 = 6e5;
|
|
24892
|
-
var RESOURCE_CONNECT_TIMEOUT_MS = 6e4;
|
|
24893
|
-
var NEON_FREE_PLAN_ID = "free_v3";
|
|
24894
24892
|
async function provisionNeonInteractive(runner, cwd, options) {
|
|
24895
24893
|
const quietSpinner = spinner2();
|
|
24896
24894
|
quietSpinner.start("Creating your Neon database");
|
|
@@ -24955,54 +24953,12 @@ function readNeonProvisionInfo(stdout) {
|
|
|
24955
24953
|
const info = {};
|
|
24956
24954
|
if (meta.dashboardUrl) info.dashboardUrl = meta.dashboardUrl;
|
|
24957
24955
|
if (meta.ssoUrl?.resource) info.resourceUrl = meta.ssoUrl.resource;
|
|
24958
|
-
if (meta.resource?.name) info.resourceName = meta.resource.name;
|
|
24959
|
-
const connectWarning = (meta.warnings ?? []).some((warning) => /failed to connect/i.test(warning));
|
|
24960
|
-
if (meta.envPulled === false || connectWarning) info.connectedToProject = false;
|
|
24961
|
-
else if (meta.envPulled === true) info.connectedToProject = true;
|
|
24962
24956
|
return info;
|
|
24963
24957
|
}
|
|
24964
|
-
async function replaceNeonProjectConnection(runner, cwd, resourceName, env) {
|
|
24965
|
-
const list = await runVercel(runner, ["integration", "list", "--format", "json"], {
|
|
24966
|
-
cwd,
|
|
24967
|
-
mode: "capture",
|
|
24968
|
-
timeoutMs: RESOURCE_CONNECT_TIMEOUT_MS,
|
|
24969
|
-
env
|
|
24970
|
-
});
|
|
24971
|
-
if (list.success) {
|
|
24972
|
-
const payload = parseVercelJson(list.stdout);
|
|
24973
|
-
for (const resource of payload?.resources ?? []) {
|
|
24974
|
-
if (!resource.name || resource.name === resourceName) continue;
|
|
24975
|
-
if (resource.product && !/neon/i.test(resource.product)) continue;
|
|
24976
|
-
await runVercel(runner, ["integration-resource", "disconnect", resource.name, "--yes"], {
|
|
24977
|
-
cwd,
|
|
24978
|
-
mode: "capture",
|
|
24979
|
-
timeoutMs: RESOURCE_CONNECT_TIMEOUT_MS,
|
|
24980
|
-
env
|
|
24981
|
-
});
|
|
24982
|
-
}
|
|
24983
|
-
}
|
|
24984
|
-
const connect = await runVercel(
|
|
24985
|
-
runner,
|
|
24986
|
-
["integration-resource", "connect", resourceName, "--yes"],
|
|
24987
|
-
{
|
|
24988
|
-
cwd,
|
|
24989
|
-
mode: "capture",
|
|
24990
|
-
timeoutMs: RESOURCE_CONNECT_TIMEOUT_MS,
|
|
24991
|
-
env
|
|
24992
|
-
}
|
|
24993
|
-
);
|
|
24994
|
-
return connect.success;
|
|
24995
|
-
}
|
|
24996
24958
|
function neonAddArgs(options) {
|
|
24997
|
-
|
|
24998
|
-
|
|
24999
|
-
|
|
25000
|
-
"neon",
|
|
25001
|
-
"--format",
|
|
25002
|
-
"json",
|
|
25003
|
-
"--plan",
|
|
25004
|
-
options.plan ?? NEON_FREE_PLAN_ID
|
|
25005
|
-
];
|
|
24959
|
+
const addArgs = ["integration", "add", "neon", "--format", "json"];
|
|
24960
|
+
if (options.plan) addArgs.push("--plan", options.plan);
|
|
24961
|
+
return addArgs;
|
|
25006
24962
|
}
|
|
25007
24963
|
function connectedNeonAddArgs(options) {
|
|
25008
24964
|
const addArgs = ["integration", "add", "neon"];
|
|
@@ -25024,28 +24980,14 @@ async function runVercelNeonFlow(options) {
|
|
|
25024
24980
|
p17.log.warn(authFailureMessage(auth.reason));
|
|
25025
24981
|
return { ok: false };
|
|
25026
24982
|
}
|
|
25027
|
-
const linkPreExisted = Boolean(readLinkedProjectId(options.cwd));
|
|
25028
24983
|
const linkLinePrinted = await ensureLinkedProject(runner, options.cwd, options.projectName, env);
|
|
25029
|
-
const preExistingDbUrl = linkPreExisted ? await pullPreExistingDbUrl(runner, options.cwd, env) : void 0;
|
|
25030
24984
|
const neon = await provisionNeonForMode(runner, options);
|
|
25031
24985
|
if (neon.failure) {
|
|
25032
24986
|
p17.log.warn(neonFailureMessage(neon.failure));
|
|
25033
24987
|
if (neon.detail) p17.log.message(pc6.dim(neon.detail));
|
|
25034
24988
|
return { ok: false };
|
|
25035
24989
|
}
|
|
25036
|
-
|
|
25037
|
-
const connectSpinner = spinner2();
|
|
25038
|
-
connectSpinner.start("Connecting the database to your Vercel project");
|
|
25039
|
-
await replaceNeonProjectConnection(runner, options.cwd, neon.resourceName, env);
|
|
25040
|
-
connectSpinner.clear();
|
|
25041
|
-
}
|
|
25042
|
-
let databaseUrl = await pullNeonDatabaseUrl(runner, options.cwd, env);
|
|
25043
|
-
if (databaseUrl && databaseUrl === preExistingDbUrl) {
|
|
25044
|
-
databaseUrl = void 0;
|
|
25045
|
-
p17.log.warn(
|
|
25046
|
-
"The linked Vercel project still returns its previous DATABASE_URL \u2014 the new database could not be connected."
|
|
25047
|
-
);
|
|
25048
|
-
}
|
|
24990
|
+
const databaseUrl = await pullNeonDatabaseUrl(runner, options.cwd, env);
|
|
25049
24991
|
const dismissSignedInNote = databaseUrl && auth.dismissNote && !neon.usedTerminalFallback ? () => auth.dismissNote?.({ linesBelow: linkLinePrinted ? 1 : 0 }) : void 0;
|
|
25050
24992
|
return {
|
|
25051
24993
|
ok: true,
|
|
@@ -25141,7 +25083,7 @@ async function runVercelDeployFlow(options) {
|
|
|
25141
25083
|
);
|
|
25142
25084
|
}
|
|
25143
25085
|
const deploySpinner = spinner2();
|
|
25144
|
-
deploySpinner.start("Deploying to Vercel
|
|
25086
|
+
deploySpinner.start("Deploying to Vercel (this may take a few minutes)");
|
|
25145
25087
|
let deploy;
|
|
25146
25088
|
try {
|
|
25147
25089
|
deploy = await deployVercelProject(runner, options.cwd, env);
|
|
@@ -25179,13 +25121,6 @@ async function ensureLinkedProject(runner, cwd, projectName, env) {
|
|
|
25179
25121
|
);
|
|
25180
25122
|
return true;
|
|
25181
25123
|
}
|
|
25182
|
-
async function pullPreExistingDbUrl(runner, cwd, env) {
|
|
25183
|
-
const snapshotSpinner = spinner2();
|
|
25184
|
-
snapshotSpinner.start("Checking the linked Vercel project");
|
|
25185
|
-
const url = await pullVercelEnvValue(runner, cwd, readDbUrlFromDotenv, env);
|
|
25186
|
-
snapshotSpinner.clear();
|
|
25187
|
-
return url;
|
|
25188
|
-
}
|
|
25189
25124
|
async function pullNeonDatabaseUrl(runner, cwd, env) {
|
|
25190
25125
|
const neonSpinner = spinner2();
|
|
25191
25126
|
neonSpinner.start("Retrieving DATABASE_URL from Vercel");
|
|
@@ -26027,7 +25962,7 @@ async function runInitCommand(name, options) {
|
|
|
26027
25962
|
}
|
|
26028
25963
|
const coreDependencyPlan = getDependencyPlan([], [], project2.linter.type === "none");
|
|
26029
25964
|
const cliDependencyPlan = getCliDependencySyncPlan(cwd);
|
|
26030
|
-
s.start("Installing dependencies
|
|
25965
|
+
s.start("Installing dependencies (this may take a minute)");
|
|
26031
25966
|
const depsResult = await installDependenciesAsync({
|
|
26032
25967
|
cwd,
|
|
26033
25968
|
pm,
|