betterstart-cli 0.0.50 → 0.0.51
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 +33 -19
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -24406,23 +24406,27 @@ function versionedVercelProjectName(base, attempt) {
|
|
|
24406
24406
|
const suffix = `-v${attempt}`;
|
|
24407
24407
|
return `${base.slice(0, 100 - suffix.length)}${suffix}`;
|
|
24408
24408
|
}
|
|
24409
|
-
async function createVercelProject(runner, cwd, name,
|
|
24409
|
+
async function createVercelProject(runner, cwd, name, options = {}) {
|
|
24410
24410
|
const base = sanitizeVercelProjectName(name);
|
|
24411
24411
|
let projectName = base;
|
|
24412
24412
|
for (let attempt = 1; attempt <= MAX_NAME_ATTEMPTS; attempt++) {
|
|
24413
24413
|
const candidate = versionedVercelProjectName(base, attempt);
|
|
24414
24414
|
projectName = candidate;
|
|
24415
|
-
const inspect = await runVercel(
|
|
24416
|
-
|
|
24417
|
-
|
|
24418
|
-
|
|
24419
|
-
|
|
24420
|
-
|
|
24415
|
+
const inspect = await runVercel(
|
|
24416
|
+
runner,
|
|
24417
|
+
withScope(["project", "inspect", candidate], options.scope),
|
|
24418
|
+
{
|
|
24419
|
+
cwd,
|
|
24420
|
+
mode: "capture",
|
|
24421
|
+
timeoutMs: INSPECT_TIMEOUT_MS,
|
|
24422
|
+
env: options.env
|
|
24423
|
+
}
|
|
24424
|
+
);
|
|
24421
24425
|
if (inspect.success) continue;
|
|
24422
|
-
const add = await runVercel(runner, ["projects", "add", candidate], {
|
|
24426
|
+
const add = await runVercel(runner, withScope(["projects", "add", candidate], options.scope), {
|
|
24423
24427
|
cwd,
|
|
24424
24428
|
mode: "capture",
|
|
24425
|
-
env
|
|
24429
|
+
env: options.env
|
|
24426
24430
|
});
|
|
24427
24431
|
if (add.success) break;
|
|
24428
24432
|
if (/already exists/i.test(`${add.stdout}
|
|
@@ -24433,17 +24437,24 @@ ${add.stderr}`)) continue;
|
|
|
24433
24437
|
fs35.rmSync(path46.join(cwd, ".vercel", "project.json"), { force: true });
|
|
24434
24438
|
} catch {
|
|
24435
24439
|
}
|
|
24436
|
-
const link = await runVercel(
|
|
24437
|
-
|
|
24438
|
-
|
|
24439
|
-
|
|
24440
|
-
|
|
24440
|
+
const link = await runVercel(
|
|
24441
|
+
runner,
|
|
24442
|
+
withScope(["link", "--project", projectName, "--yes"], options.scope),
|
|
24443
|
+
{
|
|
24444
|
+
cwd,
|
|
24445
|
+
mode: "capture",
|
|
24446
|
+
env: options.env
|
|
24447
|
+
}
|
|
24448
|
+
);
|
|
24441
24449
|
return {
|
|
24442
24450
|
name: projectName,
|
|
24443
24451
|
linked: link.success,
|
|
24444
24452
|
projectId: readLinkedProjectId(cwd)
|
|
24445
24453
|
};
|
|
24446
24454
|
}
|
|
24455
|
+
function withScope(args, scope) {
|
|
24456
|
+
return scope ? [...args, "--scope", scope] : args;
|
|
24457
|
+
}
|
|
24447
24458
|
function readLinkedProjectId(cwd) {
|
|
24448
24459
|
return readLinkedProjectJson(cwd)?.projectId;
|
|
24449
24460
|
}
|
|
@@ -24938,7 +24949,7 @@ async function runVercelNeonFlow(options) {
|
|
|
24938
24949
|
p17.log.warn(authFailureMessage(auth.reason));
|
|
24939
24950
|
return { ok: false };
|
|
24940
24951
|
}
|
|
24941
|
-
await ensureLinkedProject(runner, options.cwd, options.projectName, env);
|
|
24952
|
+
await ensureLinkedProject(runner, options.cwd, options.projectName, env, auth.username);
|
|
24942
24953
|
const neon = await provisionNeonForMode(runner, options);
|
|
24943
24954
|
if (neon.failure) {
|
|
24944
24955
|
p17.log.warn(neonFailureMessage(neon.failure));
|
|
@@ -24976,7 +24987,7 @@ async function runVercelBlobFlow(options) {
|
|
|
24976
24987
|
p17.log.warn(authFailureMessage(auth.reason));
|
|
24977
24988
|
return { ok: false };
|
|
24978
24989
|
}
|
|
24979
|
-
await ensureLinkedProject(runner, options.cwd, options.projectName, env);
|
|
24990
|
+
await ensureLinkedProject(runner, options.cwd, options.projectName, env, auth.username);
|
|
24980
24991
|
const blob = await provisionBlobForMode(runner, options);
|
|
24981
24992
|
if (blob.failure || !blob.token) {
|
|
24982
24993
|
p17.log.warn(blobFailureMessage(blob.failure));
|
|
@@ -25011,7 +25022,7 @@ async function runVercelDeployFlow(options) {
|
|
|
25011
25022
|
printManualDeployHint();
|
|
25012
25023
|
return { ok: false };
|
|
25013
25024
|
}
|
|
25014
|
-
await ensureLinkedProject(runner, options.cwd, options.projectName, env);
|
|
25025
|
+
await ensureLinkedProject(runner, options.cwd, options.projectName, env, auth.username);
|
|
25015
25026
|
const envSpinner = spinner2();
|
|
25016
25027
|
envSpinner.start("Syncing environment variables to Vercel");
|
|
25017
25028
|
const sync = await syncVercelProductionEnv(runner, options.cwd, env);
|
|
@@ -25065,12 +25076,15 @@ async function runVercelDeployFlow(options) {
|
|
|
25065
25076
|
function printManualDeployHint() {
|
|
25066
25077
|
p17.log.info(`You can deploy manually: ${pc6.cyan("vercel deploy --prod")}`);
|
|
25067
25078
|
}
|
|
25068
|
-
async function ensureLinkedProject(runner, cwd, projectName, env) {
|
|
25079
|
+
async function ensureLinkedProject(runner, cwd, projectName, env, scope) {
|
|
25069
25080
|
if (readLinkedProjectId(cwd)) return;
|
|
25070
25081
|
const projectSpinner = spinner2();
|
|
25071
25082
|
projectSpinner.start(`Creating a Vercel project ${pc6.cyan(projectName)}`);
|
|
25072
|
-
await createVercelProject(runner, cwd, projectName, env);
|
|
25083
|
+
const project2 = await createVercelProject(runner, cwd, projectName, { env, scope });
|
|
25073
25084
|
projectSpinner.clear();
|
|
25085
|
+
if (!project2.linked || !project2.projectId) {
|
|
25086
|
+
throw new Error(`Could not link Vercel project ${project2.name} to this directory.`);
|
|
25087
|
+
}
|
|
25074
25088
|
}
|
|
25075
25089
|
async function pullNeonDatabaseUrl(runner, cwd, env) {
|
|
25076
25090
|
const neonSpinner = spinner2();
|