vela 0.12.2 → 0.12.3
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/bin.js +403 -247
- package/dist/bin.js.map +4 -4
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/bin.ts
|
|
4
|
-
import
|
|
4
|
+
import process43 from "node:process";
|
|
5
5
|
|
|
6
6
|
// src/lib/argv.ts
|
|
7
7
|
function normalizeArgv(argv) {
|
|
@@ -11,17 +11,17 @@ function normalizeArgv(argv) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
// src/program.ts
|
|
14
|
-
import
|
|
15
|
-
import * as
|
|
16
|
-
import { Command as
|
|
14
|
+
import process42 from "node:process";
|
|
15
|
+
import * as p64 from "@clack/prompts";
|
|
16
|
+
import { Command as Command108 } from "commander";
|
|
17
17
|
import nodePath from "node:path";
|
|
18
18
|
import dotenv2 from "dotenv";
|
|
19
|
-
import
|
|
19
|
+
import pc39 from "picocolors";
|
|
20
20
|
|
|
21
21
|
// package.json
|
|
22
22
|
var package_default = {
|
|
23
23
|
name: "vela",
|
|
24
|
-
version: "0.12.
|
|
24
|
+
version: "0.12.3",
|
|
25
25
|
type: "module",
|
|
26
26
|
description: "A CLI for creating and updating SvelteKit projects",
|
|
27
27
|
license: "MIT",
|
|
@@ -2171,6 +2171,14 @@ async function finishDeployment(apiKey, projectId, deploymentId, input) {
|
|
|
2171
2171
|
body: JSON.stringify(input)
|
|
2172
2172
|
});
|
|
2173
2173
|
}
|
|
2174
|
+
async function getSiteDeploy(apiKey, projectId) {
|
|
2175
|
+
return apiFetch(apiKey, `/v1/projects/${projectId}/site/deploy`);
|
|
2176
|
+
}
|
|
2177
|
+
async function startSiteDeploy(apiKey, projectId) {
|
|
2178
|
+
return apiFetch(apiKey, `/v1/projects/${projectId}/site/deploy`, {
|
|
2179
|
+
method: "POST"
|
|
2180
|
+
});
|
|
2181
|
+
}
|
|
2174
2182
|
async function destroyEnvironment(apiKey, projectId, envTag) {
|
|
2175
2183
|
return apiFetch(apiKey, `/v1/projects/${projectId}/environments/${encodeURIComponent(envTag)}`, {
|
|
2176
2184
|
method: "DELETE"
|
|
@@ -2679,7 +2687,7 @@ async function runPattern(slug2, argv, input, report4) {
|
|
|
2679
2687
|
}
|
|
2680
2688
|
checkProviderInput(pattern, argv, input);
|
|
2681
2689
|
const { workspaceRootDir, features } = await getWorkspace();
|
|
2682
|
-
const
|
|
2690
|
+
const log46 = p9.taskLog({ title: report4.task.title });
|
|
2683
2691
|
let result;
|
|
2684
2692
|
try {
|
|
2685
2693
|
result = await pattern.generate({
|
|
@@ -2699,11 +2707,11 @@ async function runPattern(slug2, argv, input, report4) {
|
|
|
2699
2707
|
});
|
|
2700
2708
|
return collections2;
|
|
2701
2709
|
},
|
|
2702
|
-
logger: { info: (message) =>
|
|
2710
|
+
logger: { info: (message) => log46.message(message) }
|
|
2703
2711
|
});
|
|
2704
|
-
|
|
2712
|
+
log46.success(report4.task.success);
|
|
2705
2713
|
} catch (e) {
|
|
2706
|
-
|
|
2714
|
+
log46.error(report4.task.error);
|
|
2707
2715
|
throw e;
|
|
2708
2716
|
}
|
|
2709
2717
|
const rel = (f) => toRelative(workspaceRootDir, f);
|
|
@@ -2783,17 +2791,17 @@ async function aiLoop(opts) {
|
|
|
2783
2791
|
let attempt = 0;
|
|
2784
2792
|
while (true) {
|
|
2785
2793
|
attempt++;
|
|
2786
|
-
const
|
|
2787
|
-
|
|
2794
|
+
const spinner8 = p10.spinner();
|
|
2795
|
+
spinner8.start(`${opts.stageLabel} (${attempt > 1 ? "iteration " + attempt : "first pass"})\u2026`);
|
|
2788
2796
|
let result;
|
|
2789
2797
|
let turn;
|
|
2790
2798
|
try {
|
|
2791
2799
|
const out = await opts.call({ prompt, history });
|
|
2792
2800
|
result = out.result;
|
|
2793
2801
|
turn = out.turn;
|
|
2794
|
-
|
|
2802
|
+
spinner8.stop(`${opts.stageLabel} ready.`);
|
|
2795
2803
|
} catch (e) {
|
|
2796
|
-
|
|
2804
|
+
spinner8.stop(`${opts.stageLabel} failed.`);
|
|
2797
2805
|
throw e;
|
|
2798
2806
|
}
|
|
2799
2807
|
opts.renderPreview(result);
|
|
@@ -5145,7 +5153,7 @@ var contentNegotiation = new Command25("content-negotiation").description("enabl
|
|
|
5145
5153
|
var enable = new Command26("enable").description("enable features").configureHelp(helpConfig).addCommand(analytics).addCommand(auth).addCommand(api).addCommand(apiKeys).addCommand(backend).addCommand(contentNegotiation).addCommand(i18n).addCommand(teams).addCommand(payments).addCommand(subscriptions).addCommand(notifications).addCommand(s3).addCommand(smtp).addCommand(cms).addCommand(blog);
|
|
5146
5154
|
|
|
5147
5155
|
// src/commands/disable.ts
|
|
5148
|
-
import { Command as
|
|
5156
|
+
import { Command as Command39 } from "commander";
|
|
5149
5157
|
|
|
5150
5158
|
// src/commands/disable/auth.ts
|
|
5151
5159
|
import { Command as Command27 } from "commander";
|
|
@@ -5316,19 +5324,43 @@ var i18n2 = new Command32("i18n").description("disable internationalization").op
|
|
|
5316
5324
|
)
|
|
5317
5325
|
);
|
|
5318
5326
|
|
|
5319
|
-
// src/commands/disable/
|
|
5327
|
+
// src/commands/disable/notifications.ts
|
|
5320
5328
|
import { Command as Command33 } from "commander";
|
|
5321
|
-
var
|
|
5329
|
+
var notifications2 = new Command33("notifications").description("disable in-app notifications").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5322
5330
|
(opts, cmd) => runCommand(
|
|
5323
5331
|
() => runDisable(
|
|
5324
5332
|
{
|
|
5325
|
-
slug: "disable-
|
|
5326
|
-
confirmMessage: "Disable
|
|
5333
|
+
slug: "disable-notifications",
|
|
5334
|
+
confirmMessage: "Disable notifications? Drops the notifications collection, removes the bell, the /notifications page and $lib/server/notifications, and takes the bell out of the (app) layout.",
|
|
5327
5335
|
report: {
|
|
5328
|
-
summary: "Disabled
|
|
5336
|
+
summary: "Disabled notifications.",
|
|
5329
5337
|
nextSteps: [
|
|
5330
|
-
"
|
|
5338
|
+
"The timeAgo helper enable-notifications added to $lib/utils is kept in case other code uses it."
|
|
5331
5339
|
],
|
|
5340
|
+
task: {
|
|
5341
|
+
title: "Disabling notifications",
|
|
5342
|
+
success: "Disabled notifications",
|
|
5343
|
+
error: "Failed to disable notifications"
|
|
5344
|
+
}
|
|
5345
|
+
}
|
|
5346
|
+
},
|
|
5347
|
+
opts,
|
|
5348
|
+
cmd.args
|
|
5349
|
+
),
|
|
5350
|
+
"Failed to disable notifications."
|
|
5351
|
+
)
|
|
5352
|
+
);
|
|
5353
|
+
|
|
5354
|
+
// src/commands/disable/teams.ts
|
|
5355
|
+
import { Command as Command34 } from "commander";
|
|
5356
|
+
var teams2 = new Command34("teams").description("disable teams").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5357
|
+
(opts, cmd) => runCommand(
|
|
5358
|
+
() => runDisable(
|
|
5359
|
+
{
|
|
5360
|
+
slug: "disable-teams",
|
|
5361
|
+
confirmMessage: "Disable teams? Drops the teams, team_users, team_memberships, team_invites, and team_invite_links collections, removes team routes, and reverts the team switcher, nav item, layout props and loader.",
|
|
5362
|
+
report: {
|
|
5363
|
+
summary: "Disabled teams.",
|
|
5332
5364
|
task: {
|
|
5333
5365
|
title: "Disabling teams",
|
|
5334
5366
|
success: "Disabled teams",
|
|
@@ -5344,8 +5376,8 @@ var teams2 = new Command33("teams").description("disable teams").option("-y, --y
|
|
|
5344
5376
|
);
|
|
5345
5377
|
|
|
5346
5378
|
// src/commands/disable/payments.ts
|
|
5347
|
-
import { Command as
|
|
5348
|
-
var payments2 = new
|
|
5379
|
+
import { Command as Command35 } from "commander";
|
|
5380
|
+
var payments2 = new Command35("payments").description("disable payments").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5349
5381
|
(opts, cmd) => runCommand(
|
|
5350
5382
|
() => runDisable(
|
|
5351
5383
|
{
|
|
@@ -5372,11 +5404,11 @@ var payments2 = new Command34("payments").description("disable payments").option
|
|
|
5372
5404
|
);
|
|
5373
5405
|
|
|
5374
5406
|
// src/commands/disable/s3.ts
|
|
5375
|
-
import { Command as
|
|
5407
|
+
import { Command as Command36 } from "commander";
|
|
5376
5408
|
import * as p24 from "@clack/prompts";
|
|
5377
5409
|
import pc10 from "picocolors";
|
|
5378
5410
|
var s32 = addTargetOptions(
|
|
5379
|
-
new
|
|
5411
|
+
new Command36("s3").description("disable S3 file storage").option("--backups", "keep backups on the server again, rather than uploads").configureHelp(helpConfig),
|
|
5380
5412
|
"local"
|
|
5381
5413
|
).action(
|
|
5382
5414
|
(raw) => runCommand(() => {
|
|
@@ -5404,9 +5436,37 @@ function label2(filesystem) {
|
|
|
5404
5436
|
return filesystem === "backups" ? "backup storage" : "file storage";
|
|
5405
5437
|
}
|
|
5406
5438
|
|
|
5439
|
+
// src/commands/disable/subscriptions.ts
|
|
5440
|
+
import { Command as Command37 } from "commander";
|
|
5441
|
+
var subscriptions2 = new Command37("subscriptions").description("disable Stripe subscriptions").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5442
|
+
(opts, cmd) => runCommand(
|
|
5443
|
+
() => runDisable(
|
|
5444
|
+
{
|
|
5445
|
+
slug: "disable-subscriptions",
|
|
5446
|
+
confirmMessage: "Disable subscriptions? Drops the stripe_subscriptions collection, removes the subscription webhook handlers and sync endpoint, and reverts the billing pages, nav and (app) layout to their payments-only state. Payments stay enabled.",
|
|
5447
|
+
report: {
|
|
5448
|
+
summary: "Disabled subscriptions.",
|
|
5449
|
+
nextSteps: [
|
|
5450
|
+
"Recurring prices in the Stripe dashboard are not deleted \u2014 archive them there if you no longer need them.",
|
|
5451
|
+
"One-time payments are untouched; run `vela disable payments` to remove Stripe entirely."
|
|
5452
|
+
],
|
|
5453
|
+
task: {
|
|
5454
|
+
title: "Disabling subscriptions",
|
|
5455
|
+
success: "Disabled subscriptions",
|
|
5456
|
+
error: "Failed to disable subscriptions"
|
|
5457
|
+
}
|
|
5458
|
+
}
|
|
5459
|
+
},
|
|
5460
|
+
opts,
|
|
5461
|
+
cmd.args
|
|
5462
|
+
),
|
|
5463
|
+
"Failed to disable subscriptions."
|
|
5464
|
+
)
|
|
5465
|
+
);
|
|
5466
|
+
|
|
5407
5467
|
// src/commands/disable/smtp.ts
|
|
5408
|
-
import { Command as
|
|
5409
|
-
var smtp2 = new
|
|
5468
|
+
import { Command as Command38 } from "commander";
|
|
5469
|
+
var smtp2 = new Command38("smtp").description("disable SMTP configuration").configureHelp(helpConfig).action(
|
|
5410
5470
|
() => runCommand(async () => {
|
|
5411
5471
|
const { workspaceRootDir } = await getWorkspace();
|
|
5412
5472
|
await withPocketbase(workspaceRootDir, async (pb) => {
|
|
@@ -5423,13 +5483,13 @@ var smtp2 = new Command36("smtp").description("disable SMTP configuration").conf
|
|
|
5423
5483
|
);
|
|
5424
5484
|
|
|
5425
5485
|
// src/commands/disable.ts
|
|
5426
|
-
var disable = new
|
|
5486
|
+
var disable = new Command39("disable").description("disable features").configureHelp(helpConfig).addCommand(auth2).addCommand(api2).addCommand(apiKeys2).addCommand(backend2).addCommand(contentNegotiation2).addCommand(i18n2).addCommand(notifications2).addCommand(teams2).addCommand(payments2).addCommand(subscriptions2).addCommand(s32).addCommand(smtp2);
|
|
5427
5487
|
|
|
5428
5488
|
// src/commands/destroy.ts
|
|
5429
|
-
import { Command as
|
|
5489
|
+
import { Command as Command45 } from "commander";
|
|
5430
5490
|
|
|
5431
5491
|
// src/commands/destroy/form.ts
|
|
5432
|
-
import { Command as
|
|
5492
|
+
import { Command as Command40 } from "commander";
|
|
5433
5493
|
|
|
5434
5494
|
// src/commands/destroy/_shared.ts
|
|
5435
5495
|
import process20 from "node:process";
|
|
@@ -5446,7 +5506,7 @@ async function runDestroy(slug2, model, confirmMessage, report4, flags) {
|
|
|
5446
5506
|
}
|
|
5447
5507
|
|
|
5448
5508
|
// src/commands/destroy/form.ts
|
|
5449
|
-
var form2 = new
|
|
5509
|
+
var form2 = new Command40("form").description("destroy a form generated by `vela generate form`").argument("<model>", "model name used when the form was generated (e.g., contact, login)").option("-y, --yes", "skip confirmation prompt").option(
|
|
5450
5510
|
"--route <route>",
|
|
5451
5511
|
"custom route the form was generated at (must match the --route used at generation)"
|
|
5452
5512
|
).allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
@@ -5470,8 +5530,8 @@ var form2 = new Command38("form").description("destroy a form generated by `vela
|
|
|
5470
5530
|
);
|
|
5471
5531
|
|
|
5472
5532
|
// src/commands/destroy/schema.ts
|
|
5473
|
-
import { Command as
|
|
5474
|
-
var schema2 = new
|
|
5533
|
+
import { Command as Command41 } from "commander";
|
|
5534
|
+
var schema2 = new Command41("schema").description("destroy a zod schema generated by `vela generate schema`").argument("<model>", "schema model name (e.g., contact, login)").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5475
5535
|
(model, opts) => runCommand(
|
|
5476
5536
|
() => runDestroy(
|
|
5477
5537
|
"destroy-schema",
|
|
@@ -5492,8 +5552,8 @@ var schema2 = new Command39("schema").description("destroy a zod schema generate
|
|
|
5492
5552
|
);
|
|
5493
5553
|
|
|
5494
5554
|
// src/commands/destroy/resource.ts
|
|
5495
|
-
import { Command as
|
|
5496
|
-
var resource2 = new
|
|
5555
|
+
import { Command as Command42 } from "commander";
|
|
5556
|
+
var resource2 = new Command42("resource").description("destroy a resource generated by `vela generate resource`").argument("<model>", "model path used when the resource was generated (e.g., contacts, articles)").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5497
5557
|
(model, opts) => runCommand(
|
|
5498
5558
|
() => runDestroy(
|
|
5499
5559
|
"destroy-resource",
|
|
@@ -5514,8 +5574,8 @@ var resource2 = new Command40("resource").description("destroy a resource genera
|
|
|
5514
5574
|
);
|
|
5515
5575
|
|
|
5516
5576
|
// src/commands/destroy/scaffold.ts
|
|
5517
|
-
import { Command as
|
|
5518
|
-
var scaffold2 = new
|
|
5577
|
+
import { Command as Command43 } from "commander";
|
|
5578
|
+
var scaffold2 = new Command43("scaffold").description("destroy a scaffold generated by `vela generate scaffold`").argument("<model>", "model name used when the scaffold was generated (e.g., contact, todo)").option("-y, --yes", "skip confirmation prompt").option(
|
|
5519
5579
|
"--route <route>",
|
|
5520
5580
|
"custom route the scaffold was generated at (must match the --route used at generation)"
|
|
5521
5581
|
).allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
@@ -5543,7 +5603,7 @@ var scaffold2 = new Command41("scaffold").description("destroy a scaffold genera
|
|
|
5543
5603
|
|
|
5544
5604
|
// src/commands/destroy/deployment.ts
|
|
5545
5605
|
import process21 from "node:process";
|
|
5546
|
-
import { Command as
|
|
5606
|
+
import { Command as Command44 } from "commander";
|
|
5547
5607
|
import * as p28 from "@clack/prompts";
|
|
5548
5608
|
import pc13 from "picocolors";
|
|
5549
5609
|
|
|
@@ -5709,7 +5769,7 @@ ${pc12.dim(err instanceof Error ? err.message : String(err))}`
|
|
|
5709
5769
|
// src/commands/destroy/deployment.ts
|
|
5710
5770
|
var deployment = addLockWaitOption(
|
|
5711
5771
|
addTargetOptions(
|
|
5712
|
-
new
|
|
5772
|
+
new Command44("deployment").description("remove a deployed environment from its server").configureHelp(helpConfig),
|
|
5713
5773
|
"production"
|
|
5714
5774
|
)
|
|
5715
5775
|
).option("--purge", "also delete the database and uploaded files").option("-y, --yes", "skip the confirmation prompt").option(
|
|
@@ -5788,13 +5848,13 @@ async function confirm8(appName, targetName, byName) {
|
|
|
5788
5848
|
}
|
|
5789
5849
|
|
|
5790
5850
|
// src/commands/destroy.ts
|
|
5791
|
-
var destroy = new
|
|
5851
|
+
var destroy = new Command45("destroy").description("destroy scaffolding, or a deployment").configureHelp(helpConfig).addCommand(form2).addCommand(schema2).addCommand(resource2).addCommand(scaffold2).addCommand(deployment);
|
|
5792
5852
|
|
|
5793
5853
|
// src/commands/ui.ts
|
|
5794
|
-
import { Command as
|
|
5854
|
+
import { Command as Command51 } from "commander";
|
|
5795
5855
|
|
|
5796
5856
|
// src/commands/ui/add.ts
|
|
5797
|
-
import { Command as
|
|
5857
|
+
import { Command as Command46 } from "commander";
|
|
5798
5858
|
import * as p29 from "@clack/prompts";
|
|
5799
5859
|
import { installComponents } from "@velastack/patterns";
|
|
5800
5860
|
|
|
@@ -5844,21 +5904,21 @@ function uiAddReport(requested, outcome) {
|
|
|
5844
5904
|
}
|
|
5845
5905
|
|
|
5846
5906
|
// src/commands/ui/add.ts
|
|
5847
|
-
var add = new
|
|
5907
|
+
var add = new Command46("add").description("add ui components (shadcn-svelte items and vela components such as data-table)").argument("<components...>", "the components to add").option("--overwrite", "replace components that already exist", false).configureHelp(helpConfig).action(
|
|
5848
5908
|
(components, options) => runCommand(async () => {
|
|
5849
5909
|
const { workspaceRootDir } = await getWorkspace();
|
|
5850
|
-
const
|
|
5910
|
+
const log46 = p29.taskLog({ title: "Adding UI components..." });
|
|
5851
5911
|
let outcome;
|
|
5852
5912
|
try {
|
|
5853
5913
|
outcome = await installComponents({
|
|
5854
5914
|
root: workspaceRootDir,
|
|
5855
5915
|
components,
|
|
5856
5916
|
overwrite: options.overwrite,
|
|
5857
|
-
logger: { info: (message) =>
|
|
5917
|
+
logger: { info: (message) => log46.message(message) }
|
|
5858
5918
|
});
|
|
5859
|
-
|
|
5919
|
+
log46.success("UI components ready");
|
|
5860
5920
|
} catch (e) {
|
|
5861
|
-
|
|
5921
|
+
log46.error("Could not add UI components");
|
|
5862
5922
|
throw e;
|
|
5863
5923
|
}
|
|
5864
5924
|
reportResult(uiAddReport(components, outcome));
|
|
@@ -5866,19 +5926,19 @@ var add = new Command44("add").description("add ui components (shadcn-svelte ite
|
|
|
5866
5926
|
);
|
|
5867
5927
|
|
|
5868
5928
|
// src/commands/ui/base.ts
|
|
5869
|
-
import { Command as
|
|
5929
|
+
import { Command as Command47 } from "commander";
|
|
5870
5930
|
import * as p30 from "@clack/prompts";
|
|
5871
5931
|
import { applyBaseColor } from "@velastack/patterns";
|
|
5872
|
-
var base = new
|
|
5932
|
+
var base = new Command47("base").description("change the base (gray) palette").argument("<color>", `base color to use (${BASE_COLORS.join(", ")})`).configureHelp(helpConfig).action(
|
|
5873
5933
|
(color) => runCommand(async () => {
|
|
5874
5934
|
const { workspaceRootDir } = await getWorkspace();
|
|
5875
|
-
const
|
|
5935
|
+
const log46 = p30.taskLog({ title: `Applying the ${color} palette...` });
|
|
5876
5936
|
let outcome;
|
|
5877
5937
|
try {
|
|
5878
5938
|
outcome = await applyBaseColor({ root: workspaceRootDir, color });
|
|
5879
|
-
|
|
5939
|
+
log46.success("Palette applied");
|
|
5880
5940
|
} catch (e) {
|
|
5881
|
-
|
|
5941
|
+
log46.error("Could not change the base color");
|
|
5882
5942
|
throw e;
|
|
5883
5943
|
}
|
|
5884
5944
|
reportResult({
|
|
@@ -5894,7 +5954,7 @@ var base = new Command45("base").description("change the base (gray) palette").a
|
|
|
5894
5954
|
);
|
|
5895
5955
|
|
|
5896
5956
|
// src/commands/ui/list.ts
|
|
5897
|
-
import { Command as
|
|
5957
|
+
import { Command as Command48 } from "commander";
|
|
5898
5958
|
import * as p31 from "@clack/prompts";
|
|
5899
5959
|
import { listComponents } from "@velastack/patterns";
|
|
5900
5960
|
|
|
@@ -5926,7 +5986,7 @@ function uiListReport(result) {
|
|
|
5926
5986
|
}
|
|
5927
5987
|
|
|
5928
5988
|
// src/commands/ui/list.ts
|
|
5929
|
-
var list = new
|
|
5989
|
+
var list = new Command48("list").description("list installed ui components, vela components and the style registry").option("--json", "print the result as JSON", false).configureHelp(helpConfig).action(
|
|
5930
5990
|
(options) => runCommand(async () => {
|
|
5931
5991
|
const { workspaceRootDir } = await getWorkspace();
|
|
5932
5992
|
if (options.json) {
|
|
@@ -5934,16 +5994,16 @@ var list = new Command46("list").description("list installed ui components, vela
|
|
|
5934
5994
|
console.log(JSON.stringify(result2, null, 2));
|
|
5935
5995
|
return;
|
|
5936
5996
|
}
|
|
5937
|
-
const
|
|
5938
|
-
|
|
5997
|
+
const spinner8 = p31.spinner();
|
|
5998
|
+
spinner8.start("Reading the registry...");
|
|
5939
5999
|
let result;
|
|
5940
6000
|
try {
|
|
5941
6001
|
result = await listComponents({ root: workspaceRootDir });
|
|
5942
6002
|
} catch (e) {
|
|
5943
|
-
|
|
6003
|
+
spinner8.stop("Could not list UI components");
|
|
5944
6004
|
throw e;
|
|
5945
6005
|
}
|
|
5946
|
-
|
|
6006
|
+
spinner8.stop(`Read the ${result.style} registry`);
|
|
5947
6007
|
reportResult(uiListReport(result));
|
|
5948
6008
|
if (result.registryUnavailable) {
|
|
5949
6009
|
p31.log.warn(`${result.registryUnavailable}
|
|
@@ -5953,7 +6013,7 @@ Registry components are not listed.`);
|
|
|
5953
6013
|
);
|
|
5954
6014
|
|
|
5955
6015
|
// src/commands/ui/style.ts
|
|
5956
|
-
import { Command as
|
|
6016
|
+
import { Command as Command49 } from "commander";
|
|
5957
6017
|
import * as p32 from "@clack/prompts";
|
|
5958
6018
|
import { switchStyle } from "@velastack/patterns";
|
|
5959
6019
|
|
|
@@ -5980,21 +6040,21 @@ function uiStyleReport(result) {
|
|
|
5980
6040
|
}
|
|
5981
6041
|
|
|
5982
6042
|
// src/commands/ui/style.ts
|
|
5983
|
-
var style = new
|
|
6043
|
+
var style = new Command49("style").description("switch the shadcn-svelte style, re-adding its components").argument("<style>", `style to switch to (${STYLES.join(", ")})`).option("-y, --yes", "skip the confirmation prompt").option("--no-font", "keep the current font instead of applying the style's").configureHelp(helpConfig).action(
|
|
5984
6044
|
(name, options) => runCommand(async () => {
|
|
5985
6045
|
const { workspaceRootDir } = await getWorkspace();
|
|
5986
|
-
const
|
|
5987
|
-
|
|
5988
|
-
let
|
|
6046
|
+
const spinner8 = p32.spinner();
|
|
6047
|
+
spinner8.start(`Reading the ${name} registry...`);
|
|
6048
|
+
let log46;
|
|
5989
6049
|
let outcome;
|
|
5990
6050
|
try {
|
|
5991
6051
|
outcome = await switchStyle({
|
|
5992
6052
|
root: workspaceRootDir,
|
|
5993
6053
|
style: name,
|
|
5994
6054
|
font: options.font,
|
|
5995
|
-
logger: { info: (message) =>
|
|
6055
|
+
logger: { info: (message) => log46?.message(message) },
|
|
5996
6056
|
confirm: async (components) => {
|
|
5997
|
-
|
|
6057
|
+
spinner8.stop(`Read the ${name} registry`);
|
|
5998
6058
|
if (components.length > 0) {
|
|
5999
6059
|
p32.log.info(
|
|
6000
6060
|
`Re-adds ${components.length} component(s) from the ${name} registry; local edits to their files are lost:
|
|
@@ -6009,16 +6069,16 @@ ${components.map((c) => `- ${c}`).join("\n")}`
|
|
|
6009
6069
|
const ok = await p32.confirm({ message: `Switch to ${name}?`, initialValue: false });
|
|
6010
6070
|
if (p32.isCancel(ok) || !ok) return false;
|
|
6011
6071
|
}
|
|
6012
|
-
|
|
6072
|
+
log46 = p32.taskLog({ title: `Switching to the ${name} style...` });
|
|
6013
6073
|
return true;
|
|
6014
6074
|
}
|
|
6015
6075
|
});
|
|
6016
6076
|
} catch (e) {
|
|
6017
|
-
|
|
6018
|
-
|
|
6077
|
+
spinner8.stop(`Could not switch to ${name}`);
|
|
6078
|
+
log46?.error("Could not switch style");
|
|
6019
6079
|
throw e;
|
|
6020
6080
|
}
|
|
6021
|
-
|
|
6081
|
+
spinner8.stop(`Read the ${name} registry`);
|
|
6022
6082
|
if (outcome.status === "unchanged") {
|
|
6023
6083
|
p32.log.info(`Already using the ${name} style.`);
|
|
6024
6084
|
return;
|
|
@@ -6027,25 +6087,25 @@ ${components.map((c) => `- ${c}`).join("\n")}`
|
|
|
6027
6087
|
p32.cancel("Operation cancelled.");
|
|
6028
6088
|
return;
|
|
6029
6089
|
}
|
|
6030
|
-
|
|
6090
|
+
log46?.success("Style switched");
|
|
6031
6091
|
reportResult(uiStyleReport(outcome));
|
|
6032
6092
|
}, "Failed to switch style.")
|
|
6033
6093
|
);
|
|
6034
6094
|
|
|
6035
6095
|
// src/commands/ui/theme.ts
|
|
6036
|
-
import { Command as
|
|
6096
|
+
import { Command as Command50 } from "commander";
|
|
6037
6097
|
import * as p33 from "@clack/prompts";
|
|
6038
6098
|
import { applyTheme } from "@velastack/patterns";
|
|
6039
|
-
var theme = new
|
|
6099
|
+
var theme = new Command50("theme").description("change the accent color, keeping the base palette").argument("<accent>", `accent to use (${THEMES.join(", ")})`).configureHelp(helpConfig).action(
|
|
6040
6100
|
(accent) => runCommand(async () => {
|
|
6041
6101
|
const { workspaceRootDir } = await getWorkspace();
|
|
6042
|
-
const
|
|
6102
|
+
const log46 = p33.taskLog({ title: `Applying the ${accent} accent...` });
|
|
6043
6103
|
let outcome;
|
|
6044
6104
|
try {
|
|
6045
6105
|
outcome = await applyTheme({ root: workspaceRootDir, theme: accent });
|
|
6046
|
-
|
|
6106
|
+
log46.success("Accent applied");
|
|
6047
6107
|
} catch (e) {
|
|
6048
|
-
|
|
6108
|
+
log46.error("Could not change the accent");
|
|
6049
6109
|
throw e;
|
|
6050
6110
|
}
|
|
6051
6111
|
reportResult({
|
|
@@ -6061,15 +6121,15 @@ var theme = new Command48("theme").description("change the accent color, keeping
|
|
|
6061
6121
|
);
|
|
6062
6122
|
|
|
6063
6123
|
// src/commands/ui.ts
|
|
6064
|
-
var ui = new
|
|
6124
|
+
var ui = new Command51("ui").description("generate ui components").configureHelp(helpConfig).addCommand(add).addCommand(list).addCommand(style).addCommand(base).addCommand(theme);
|
|
6065
6125
|
|
|
6066
6126
|
// src/commands/legal.ts
|
|
6067
|
-
import { Command as
|
|
6127
|
+
import { Command as Command54 } from "commander";
|
|
6068
6128
|
|
|
6069
6129
|
// src/commands/legal/terms.ts
|
|
6070
6130
|
import fs26 from "node:fs";
|
|
6071
6131
|
import path23 from "node:path";
|
|
6072
|
-
import { Command as
|
|
6132
|
+
import { Command as Command52 } from "commander";
|
|
6073
6133
|
import * as p35 from "@clack/prompts";
|
|
6074
6134
|
|
|
6075
6135
|
// src/commands/legal/shared.ts
|
|
@@ -6655,16 +6715,16 @@ async function termsAction() {
|
|
|
6655
6715
|
]
|
|
6656
6716
|
});
|
|
6657
6717
|
if (p35.isCancel(canBuyGoods)) onCancel();
|
|
6658
|
-
const
|
|
6718
|
+
const subscriptions3 = await p35.select({
|
|
6659
6719
|
message: "Do you offer subscription plans?",
|
|
6660
6720
|
options: [
|
|
6661
6721
|
{ value: "yes", label: "Yes, we offer subscription plans" },
|
|
6662
6722
|
{ value: "no", label: "No" }
|
|
6663
6723
|
]
|
|
6664
6724
|
});
|
|
6665
|
-
if (p35.isCancel(
|
|
6725
|
+
if (p35.isCancel(subscriptions3)) onCancel();
|
|
6666
6726
|
let freeTrial;
|
|
6667
|
-
if (
|
|
6727
|
+
if (subscriptions3 === "yes") {
|
|
6668
6728
|
const ft = await p35.select({
|
|
6669
6729
|
message: "Do you offer a free trial?",
|
|
6670
6730
|
options: [
|
|
@@ -6719,7 +6779,7 @@ async function termsAction() {
|
|
|
6719
6779
|
userContent,
|
|
6720
6780
|
infringementEmail,
|
|
6721
6781
|
canBuyGoods,
|
|
6722
|
-
subscriptions:
|
|
6782
|
+
subscriptions: subscriptions3,
|
|
6723
6783
|
freeTrial,
|
|
6724
6784
|
exclusiveContent,
|
|
6725
6785
|
feedbackReuse,
|
|
@@ -6753,12 +6813,12 @@ async function termsAction() {
|
|
|
6753
6813
|
]
|
|
6754
6814
|
});
|
|
6755
6815
|
}
|
|
6756
|
-
var terms = new
|
|
6816
|
+
var terms = new Command52("terms").description("generate placeholder terms and conditions").configureHelp(helpConfig).action(() => runCommand(termsAction, "Failed to generate terms and conditions."));
|
|
6757
6817
|
|
|
6758
6818
|
// src/commands/legal/privacy.ts
|
|
6759
6819
|
import fs27 from "node:fs";
|
|
6760
6820
|
import path24 from "node:path";
|
|
6761
|
-
import { Command as
|
|
6821
|
+
import { Command as Command53 } from "commander";
|
|
6762
6822
|
import * as p36 from "@clack/prompts";
|
|
6763
6823
|
var mapLabels = {
|
|
6764
6824
|
personalInfo: {
|
|
@@ -7502,16 +7562,16 @@ async function privacyAction() {
|
|
|
7502
7562
|
]
|
|
7503
7563
|
});
|
|
7504
7564
|
}
|
|
7505
|
-
var privacy = new
|
|
7565
|
+
var privacy = new Command53("privacy").description("generate placeholder privacy policy").configureHelp(helpConfig).action(() => runCommand(privacyAction, "Failed to generate privacy policy."));
|
|
7506
7566
|
|
|
7507
7567
|
// src/commands/legal.ts
|
|
7508
|
-
var legal = new
|
|
7568
|
+
var legal = new Command54("legal").description("generate placeholder legal documents").configureHelp(helpConfig).addCommand(terms).addCommand(privacy);
|
|
7509
7569
|
|
|
7510
7570
|
// src/commands/fixtures.ts
|
|
7511
|
-
import { Command as
|
|
7571
|
+
import { Command as Command60 } from "commander";
|
|
7512
7572
|
|
|
7513
7573
|
// src/commands/fixtures/load.ts
|
|
7514
|
-
import { Command as
|
|
7574
|
+
import { Command as Command55 } from "commander";
|
|
7515
7575
|
|
|
7516
7576
|
// src/lib/data.ts
|
|
7517
7577
|
import fs28 from "node:fs";
|
|
@@ -7701,7 +7761,7 @@ async function hasLoadedFixtures(pb) {
|
|
|
7701
7761
|
}
|
|
7702
7762
|
|
|
7703
7763
|
// src/commands/fixtures/load.ts
|
|
7704
|
-
var load = new
|
|
7764
|
+
var load = new Command55("load").description("load fixtures into the database").configureHelp(helpConfig).action(
|
|
7705
7765
|
() => runCommand(async () => {
|
|
7706
7766
|
const { workspaceRootDir } = await getWorkspace();
|
|
7707
7767
|
let loaded = [];
|
|
@@ -7727,8 +7787,8 @@ var load = new Command53("load").description("load fixtures into the database").
|
|
|
7727
7787
|
);
|
|
7728
7788
|
|
|
7729
7789
|
// src/commands/fixtures/clear.ts
|
|
7730
|
-
import { Command as
|
|
7731
|
-
var clear = new
|
|
7790
|
+
import { Command as Command56 } from "commander";
|
|
7791
|
+
var clear = new Command56("clear").description("clear loaded fixtures").configureHelp(helpConfig).action(
|
|
7732
7792
|
() => runCommand(async () => {
|
|
7733
7793
|
const { workspaceRootDir } = await getWorkspace();
|
|
7734
7794
|
let cleared = [];
|
|
@@ -7757,8 +7817,8 @@ var clear = new Command54("clear").description("clear loaded fixtures").configur
|
|
|
7757
7817
|
);
|
|
7758
7818
|
|
|
7759
7819
|
// src/commands/fixtures/reset.ts
|
|
7760
|
-
import { Command as
|
|
7761
|
-
var reset = new
|
|
7820
|
+
import { Command as Command57 } from "commander";
|
|
7821
|
+
var reset = new Command57("reset").description("clear and reload fixtures").configureHelp(helpConfig).action(
|
|
7762
7822
|
() => runCommand(async () => {
|
|
7763
7823
|
const { workspaceRootDir } = await getWorkspace();
|
|
7764
7824
|
let cleared = [];
|
|
@@ -7790,7 +7850,7 @@ var reset = new Command55("reset").description("clear and reload fixtures").conf
|
|
|
7790
7850
|
// src/commands/fixtures/generate.ts
|
|
7791
7851
|
import fs29 from "node:fs";
|
|
7792
7852
|
import path26 from "node:path";
|
|
7793
|
-
import { Command as
|
|
7853
|
+
import { Command as Command58, InvalidArgumentError } from "commander";
|
|
7794
7854
|
import * as p37 from "@clack/prompts";
|
|
7795
7855
|
import { annotate } from "annotate-json-schema";
|
|
7796
7856
|
import { createGenerator } from "json-schema-faker";
|
|
@@ -7901,7 +7961,7 @@ async function generateFixtureFiles(pb, workspaceRootDir, opts) {
|
|
|
7901
7961
|
}
|
|
7902
7962
|
return { writtenFiles, warnings };
|
|
7903
7963
|
}
|
|
7904
|
-
var generate2 = new
|
|
7964
|
+
var generate2 = new Command58("generate").description("generate fixture data").option("-c, --count <count>", "number of records per collection", parseCount, 10).option("-s, --seed <seed>", "seed for deterministic output", parseSeed).option("-f, --force", "overwrite existing fixture files and clear loaded fixtures").configureHelp(helpConfig).action(
|
|
7905
7965
|
(opts) => runCommand(async () => {
|
|
7906
7966
|
const { workspaceRootDir } = await getWorkspace();
|
|
7907
7967
|
const existing = getFixtureFiles(workspaceRootDir);
|
|
@@ -7954,7 +8014,7 @@ var generate2 = new Command56("generate").description("generate fixture data").o
|
|
|
7954
8014
|
);
|
|
7955
8015
|
|
|
7956
8016
|
// src/commands/fixtures/regen.ts
|
|
7957
|
-
import { Command as
|
|
8017
|
+
import { Command as Command59, InvalidArgumentError as InvalidArgumentError2 } from "commander";
|
|
7958
8018
|
import * as p38 from "@clack/prompts";
|
|
7959
8019
|
function parseCount2(value) {
|
|
7960
8020
|
const n = parseInt(value, 10);
|
|
@@ -7970,7 +8030,7 @@ function parseSeed2(value) {
|
|
|
7970
8030
|
}
|
|
7971
8031
|
return n;
|
|
7972
8032
|
}
|
|
7973
|
-
var regen = new
|
|
8033
|
+
var regen = new Command59("regen").description("clear the database, regenerate fixture files, and reload them").option("-c, --count <count>", "number of records per collection", parseCount2, 10).option("-s, --seed <seed>", "seed for deterministic output", parseSeed2).configureHelp(helpConfig).action(
|
|
7974
8034
|
(opts) => runCommand(async () => {
|
|
7975
8035
|
const { workspaceRootDir } = await getWorkspace();
|
|
7976
8036
|
let cleared = [];
|
|
@@ -7999,14 +8059,14 @@ var regen = new Command57("regen").description("clear the database, regenerate f
|
|
|
7999
8059
|
);
|
|
8000
8060
|
|
|
8001
8061
|
// src/commands/fixtures.ts
|
|
8002
|
-
var fixtures = new
|
|
8062
|
+
var fixtures = new Command60("fixtures").description("manage fixture data").configureHelp(helpConfig).addCommand(generate2).addCommand(load).addCommand(clear).addCommand(reset).addCommand(regen);
|
|
8003
8063
|
|
|
8004
8064
|
// src/commands/seeds.ts
|
|
8005
|
-
import { Command as
|
|
8065
|
+
import { Command as Command64 } from "commander";
|
|
8006
8066
|
|
|
8007
8067
|
// src/commands/seeds/load.ts
|
|
8008
|
-
import { Command as
|
|
8009
|
-
var load2 = new
|
|
8068
|
+
import { Command as Command61 } from "commander";
|
|
8069
|
+
var load2 = new Command61("load").description("load seeds into the database").option("-f, --force", "load even if target collections already have records").configureHelp(helpConfig).action(
|
|
8010
8070
|
(opts) => runCommand(async () => {
|
|
8011
8071
|
const { workspaceRootDir } = await getWorkspace();
|
|
8012
8072
|
const seedFiles = getSeedFiles(workspaceRootDir);
|
|
@@ -8045,7 +8105,7 @@ var load2 = new Command59("load").description("load seeds into the database").op
|
|
|
8045
8105
|
// src/commands/seeds/save.ts
|
|
8046
8106
|
import fs30 from "node:fs";
|
|
8047
8107
|
import path27 from "node:path";
|
|
8048
|
-
import { Command as
|
|
8108
|
+
import { Command as Command62 } from "commander";
|
|
8049
8109
|
var padZeros2 = (num, length) => num.toString().padStart(length, "0");
|
|
8050
8110
|
function filterSystemFields(record, systemFieldNames) {
|
|
8051
8111
|
const out = {};
|
|
@@ -8056,7 +8116,7 @@ function filterSystemFields(record, systemFieldNames) {
|
|
|
8056
8116
|
}
|
|
8057
8117
|
return out;
|
|
8058
8118
|
}
|
|
8059
|
-
var save = new
|
|
8119
|
+
var save = new Command62("save").description("save the current data as seeds").option("-f, --force", "overwrite existing seed files").configureHelp(helpConfig).action(
|
|
8060
8120
|
(opts) => runCommand(async () => {
|
|
8061
8121
|
const { workspaceRootDir } = await getWorkspace();
|
|
8062
8122
|
const seedsPath = dataDir(workspaceRootDir, "seeds");
|
|
@@ -8128,8 +8188,8 @@ var save = new Command60("save").description("save the current data as seeds").o
|
|
|
8128
8188
|
);
|
|
8129
8189
|
|
|
8130
8190
|
// src/commands/seeds/clear.ts
|
|
8131
|
-
import { Command as
|
|
8132
|
-
var clear2 = new
|
|
8191
|
+
import { Command as Command63 } from "commander";
|
|
8192
|
+
var clear2 = new Command63("clear").description("clear seeded records").configureHelp(helpConfig).action(
|
|
8133
8193
|
() => runCommand(async () => {
|
|
8134
8194
|
const { workspaceRootDir } = await getWorkspace();
|
|
8135
8195
|
const seedFiles = getSeedFiles(workspaceRootDir);
|
|
@@ -8160,13 +8220,13 @@ var clear2 = new Command61("clear").description("clear seeded records").configur
|
|
|
8160
8220
|
);
|
|
8161
8221
|
|
|
8162
8222
|
// src/commands/seeds.ts
|
|
8163
|
-
var seeds = new
|
|
8223
|
+
var seeds = new Command64("seeds").description("manage seed data").configureHelp(helpConfig).addCommand(load2).addCommand(save).addCommand(clear2);
|
|
8164
8224
|
|
|
8165
8225
|
// src/commands/signup.ts
|
|
8166
|
-
import { Command as
|
|
8226
|
+
import { Command as Command65 } from "commander";
|
|
8167
8227
|
import * as p39 from "@clack/prompts";
|
|
8168
8228
|
import makeFetchCookie2 from "fetch-cookie";
|
|
8169
|
-
var signup = new
|
|
8229
|
+
var signup = new Command65("signup").description("signup to velastack.dev").configureHelp(helpConfig).action(
|
|
8170
8230
|
() => runCommand(async () => {
|
|
8171
8231
|
const { email: email3, password: password11, passwordConfirm } = await p39.group({
|
|
8172
8232
|
email: () => p39.text({ message: "Email" }),
|
|
@@ -8201,9 +8261,9 @@ var signup = new Command63("signup").description("signup to velastack.dev").conf
|
|
|
8201
8261
|
);
|
|
8202
8262
|
|
|
8203
8263
|
// src/commands/logout.ts
|
|
8204
|
-
import { Command as
|
|
8264
|
+
import { Command as Command66 } from "commander";
|
|
8205
8265
|
import * as p40 from "@clack/prompts";
|
|
8206
|
-
var logout = new
|
|
8266
|
+
var logout = new Command66("logout").alias("signout").description("logout from velastack.dev").configureHelp(helpConfig).action(
|
|
8207
8267
|
() => runCommand(() => {
|
|
8208
8268
|
if (!readConfig()) {
|
|
8209
8269
|
p40.log.info("Not logged in");
|
|
@@ -8215,9 +8275,9 @@ var logout = new Command64("logout").alias("signout").description("logout from v
|
|
|
8215
8275
|
);
|
|
8216
8276
|
|
|
8217
8277
|
// src/commands/whoami.ts
|
|
8218
|
-
import { Command as
|
|
8278
|
+
import { Command as Command67 } from "commander";
|
|
8219
8279
|
import * as p41 from "@clack/prompts";
|
|
8220
|
-
var whoami = new
|
|
8280
|
+
var whoami = new Command67("whoami").description("show the current user").configureHelp(helpConfig).action(
|
|
8221
8281
|
() => runCommand(async () => {
|
|
8222
8282
|
const apiKey = readConfig()?.apiKey;
|
|
8223
8283
|
if (!apiKey) {
|
|
@@ -8234,10 +8294,10 @@ var whoami = new Command65("whoami").description("show the current user").config
|
|
|
8234
8294
|
);
|
|
8235
8295
|
|
|
8236
8296
|
// src/commands/migrate.ts
|
|
8237
|
-
import { Command as
|
|
8297
|
+
import { Command as Command73 } from "commander";
|
|
8238
8298
|
|
|
8239
8299
|
// src/commands/migrate/up.ts
|
|
8240
|
-
import { Command as
|
|
8300
|
+
import { Command as Command68 } from "commander";
|
|
8241
8301
|
|
|
8242
8302
|
// src/lib/migrate.ts
|
|
8243
8303
|
import path28 from "node:path";
|
|
@@ -8276,10 +8336,10 @@ async function runMigrateUp() {
|
|
|
8276
8336
|
]
|
|
8277
8337
|
});
|
|
8278
8338
|
}
|
|
8279
|
-
var up = new
|
|
8339
|
+
var up = new Command68("up").description("apply all pending migrations").configureHelp(helpConfig).action(() => runCommand(runMigrateUp, "Failed to run migrations."));
|
|
8280
8340
|
|
|
8281
8341
|
// src/commands/migrate/down.ts
|
|
8282
|
-
import { Command as
|
|
8342
|
+
import { Command as Command69, InvalidArgumentError as InvalidArgumentError3 } from "commander";
|
|
8283
8343
|
function parseSteps(value) {
|
|
8284
8344
|
const n = parseInt(value, 10);
|
|
8285
8345
|
if (!Number.isFinite(n) || n <= 0) {
|
|
@@ -8287,7 +8347,7 @@ function parseSteps(value) {
|
|
|
8287
8347
|
}
|
|
8288
8348
|
return n;
|
|
8289
8349
|
}
|
|
8290
|
-
var down = new
|
|
8350
|
+
var down = new Command69("down").alias("rollback").description("revert the last N applied migrations").argument("[number]", "how many migrations to revert", parseSteps, 1).configureHelp(helpConfig).action(
|
|
8291
8351
|
(n) => runCommand(async () => {
|
|
8292
8352
|
await runPocketbaseMigrate(["down", String(n)]);
|
|
8293
8353
|
reportResult({
|
|
@@ -8304,8 +8364,8 @@ var down = new Command67("down").alias("rollback").description("revert the last
|
|
|
8304
8364
|
import fs31 from "node:fs";
|
|
8305
8365
|
import path29 from "node:path";
|
|
8306
8366
|
import process24 from "node:process";
|
|
8307
|
-
import { Command as
|
|
8308
|
-
var create2 = new
|
|
8367
|
+
import { Command as Command70 } from "commander";
|
|
8368
|
+
var create2 = new Command70("create").alias("new").description("create a new blank migration").argument("<name>", "migration name (snake_case)").configureHelp(helpConfig).action(
|
|
8309
8369
|
(name) => runCommand(async () => {
|
|
8310
8370
|
const cwd = process24.cwd();
|
|
8311
8371
|
const before = listMigrationFiles(cwd);
|
|
@@ -8332,8 +8392,8 @@ function listMigrationFiles(cwd) {
|
|
|
8332
8392
|
import fs32 from "node:fs";
|
|
8333
8393
|
import path30 from "node:path";
|
|
8334
8394
|
import process25 from "node:process";
|
|
8335
|
-
import { Command as
|
|
8336
|
-
var collections = new
|
|
8395
|
+
import { Command as Command71 } from "commander";
|
|
8396
|
+
var collections = new Command71("collections").alias("snapshot").description("snapshot local collections into a new migration").configureHelp(helpConfig).action(
|
|
8337
8397
|
() => runCommand(async () => {
|
|
8338
8398
|
const cwd = process25.cwd();
|
|
8339
8399
|
const before = listMigrationFiles2(cwd);
|
|
@@ -8364,8 +8424,8 @@ function listMigrationFiles2(cwd) {
|
|
|
8364
8424
|
}
|
|
8365
8425
|
|
|
8366
8426
|
// src/commands/migrate/history-sync.ts
|
|
8367
|
-
import { Command as
|
|
8368
|
-
var historySync = new
|
|
8427
|
+
import { Command as Command72 } from "commander";
|
|
8428
|
+
var historySync = new Command72("history-sync").description("drop _migrations rows whose files no longer exist").configureHelp(helpConfig).action(
|
|
8369
8429
|
() => runCommand(async () => {
|
|
8370
8430
|
await runPocketbaseMigrate(["history-sync"]);
|
|
8371
8431
|
reportResult({
|
|
@@ -8376,14 +8436,14 @@ var historySync = new Command70("history-sync").description("drop _migrations ro
|
|
|
8376
8436
|
);
|
|
8377
8437
|
|
|
8378
8438
|
// src/commands/migrate.ts
|
|
8379
|
-
var migrate = new
|
|
8439
|
+
var migrate = new Command73("migrate").description("manage database migrations").configureHelp(helpConfig).action(() => runCommand(runMigrateUp, "Failed to run migrations.")).addCommand(up).addCommand(down).addCommand(create2).addCommand(collections).addCommand(historySync);
|
|
8380
8440
|
|
|
8381
8441
|
// src/commands/dev.ts
|
|
8382
8442
|
import fs33 from "node:fs";
|
|
8383
8443
|
import path32 from "node:path";
|
|
8384
8444
|
import process27 from "node:process";
|
|
8385
8445
|
import { performance } from "node:perf_hooks";
|
|
8386
|
-
import { Command as
|
|
8446
|
+
import { Command as Command74, InvalidArgumentError as InvalidArgumentError4 } from "commander";
|
|
8387
8447
|
import pc15 from "picocolors";
|
|
8388
8448
|
import PocketBase4 from "pocketbase";
|
|
8389
8449
|
|
|
@@ -8432,7 +8492,7 @@ function parsePort(value) {
|
|
|
8432
8492
|
}
|
|
8433
8493
|
return port;
|
|
8434
8494
|
}
|
|
8435
|
-
var dev = new
|
|
8495
|
+
var dev = new Command74("dev").description("start the development server").option("--open [path]", "open the app in a browser once the server is ready").option("--host [host]", "expose the server on the network").option("--port <port>", "port to listen on", parsePort).option("--strictPort", "exit if the port is already in use instead of taking the next one").option("--cors", "enable CORS").option("--force", "re-bundle dependencies, ignoring the optimizer cache").configureHelp(helpConfig).action(async (options) => {
|
|
8436
8496
|
const cwd = process27.cwd();
|
|
8437
8497
|
process27.env.VELA_DATA_DIR ??= localDataDir(cwd);
|
|
8438
8498
|
const startTime = performance.now();
|
|
@@ -8541,7 +8601,7 @@ async function startWatchingTypes(cwd, pb) {
|
|
|
8541
8601
|
import fs34 from "node:fs";
|
|
8542
8602
|
import path33 from "node:path";
|
|
8543
8603
|
import process29 from "node:process";
|
|
8544
|
-
import { Command as
|
|
8604
|
+
import { Command as Command75 } from "commander";
|
|
8545
8605
|
import * as p42 from "@clack/prompts";
|
|
8546
8606
|
import pc16 from "picocolors";
|
|
8547
8607
|
import { x as x3 } from "tinyexec";
|
|
@@ -8578,7 +8638,7 @@ function splitHosts(value) {
|
|
|
8578
8638
|
|
|
8579
8639
|
// src/commands/build.ts
|
|
8580
8640
|
var PRERENDERED_DIR = path33.join(".svelte-kit", "output", "prerendered");
|
|
8581
|
-
var build = new
|
|
8641
|
+
var build = new Command75("build").description("build the app").configureHelp(helpConfig).option("-t, --target <target>", "which copy of the app to build for", PRODUCTION_TARGET).action(async (options) => {
|
|
8582
8642
|
const cwd = process29.cwd();
|
|
8583
8643
|
applyBuildEnv(cwd);
|
|
8584
8644
|
const origin = await originForBuild(cwd, options.target);
|
|
@@ -8646,11 +8706,11 @@ Set one with ${pc16.cyan("vela deploy --domain example.com")}, or pass ${pc16.cy
|
|
|
8646
8706
|
// src/commands/preview.ts
|
|
8647
8707
|
import path34 from "node:path";
|
|
8648
8708
|
import process30 from "node:process";
|
|
8649
|
-
import { Command as
|
|
8709
|
+
import { Command as Command76 } from "commander";
|
|
8650
8710
|
import { x as x4 } from "tinyexec";
|
|
8651
8711
|
import { detect as detect6 } from "package-manager-detector";
|
|
8652
8712
|
import { resolveCommand as resolveCommand6 } from "package-manager-detector/commands";
|
|
8653
|
-
var preview = new
|
|
8713
|
+
var preview = new Command76("preview").description("preview the built app").configureHelp(helpConfig).action(async () => {
|
|
8654
8714
|
const cwd = process30.cwd();
|
|
8655
8715
|
process30.env.VELA_DATA_DIR ??= localDataDir(cwd);
|
|
8656
8716
|
let pbProc;
|
|
@@ -8690,8 +8750,8 @@ var preview = new Command74("preview").description("preview the built app").conf
|
|
|
8690
8750
|
|
|
8691
8751
|
// src/commands/sync.ts
|
|
8692
8752
|
import path35 from "node:path";
|
|
8693
|
-
import { Command as
|
|
8694
|
-
var sync = new
|
|
8753
|
+
import { Command as Command77 } from "commander";
|
|
8754
|
+
var sync = new Command77("sync").description("sync types from the database").configureHelp(helpConfig).action(
|
|
8695
8755
|
() => runCommand(async () => {
|
|
8696
8756
|
const { workspaceRootDir } = await getWorkspace();
|
|
8697
8757
|
const typesDir = path35.join(workspaceRootDir, ".svelte-kit", "types");
|
|
@@ -8704,7 +8764,7 @@ var sync = new Command75("sync").description("sync types from the database").con
|
|
|
8704
8764
|
);
|
|
8705
8765
|
|
|
8706
8766
|
// src/commands/provision.ts
|
|
8707
|
-
import { Command as
|
|
8767
|
+
import { Command as Command78 } from "commander";
|
|
8708
8768
|
import * as p43 from "@clack/prompts";
|
|
8709
8769
|
import pc17 from "picocolors";
|
|
8710
8770
|
import * as v7 from "valibot";
|
|
@@ -8714,7 +8774,7 @@ var OptionsSchema2 = v7.object({
|
|
|
8714
8774
|
nodeMajor: v7.optional(v7.string())
|
|
8715
8775
|
});
|
|
8716
8776
|
var provision = addSshOptions(
|
|
8717
|
-
new
|
|
8777
|
+
new Command78("provision").description("prepare a server to host vela apps").argument("<target>", "SSH target \u2014 an alias from ~/.ssh/config, or user@host").configureHelp(helpConfig)
|
|
8718
8778
|
).option("--pb-version <version>", "PocketBase version to install").option("--node-major <version>", "Node.js major version to install", "22").action(
|
|
8719
8779
|
(target, raw) => runCommand(async () => {
|
|
8720
8780
|
const options = parseOptions(OptionsSchema2, raw);
|
|
@@ -8758,7 +8818,7 @@ var provision = addSshOptions(
|
|
|
8758
8818
|
// src/commands/deploy.ts
|
|
8759
8819
|
import path38 from "node:path";
|
|
8760
8820
|
import fs37 from "node:fs";
|
|
8761
|
-
import { Command as
|
|
8821
|
+
import { Command as Command79, Option as Option2 } from "commander";
|
|
8762
8822
|
import * as p44 from "@clack/prompts";
|
|
8763
8823
|
import pc18 from "picocolors";
|
|
8764
8824
|
import * as v8 from "valibot";
|
|
@@ -9102,7 +9162,7 @@ var OptionsSchema3 = v8.object({
|
|
|
9102
9162
|
});
|
|
9103
9163
|
var deploy = addLockWaitOption(
|
|
9104
9164
|
addTargetOptions(
|
|
9105
|
-
new
|
|
9165
|
+
new Command79("deploy").description("deploy the app").configureHelp(helpConfig),
|
|
9106
9166
|
"production"
|
|
9107
9167
|
)
|
|
9108
9168
|
).option("--project <name>", "override the project name").option("--domain <hosts>", "hostname(s) to serve on, comma separated").option("--health-path <path>", "path the health check requests").option("--keep <count>", "how many old releases to keep on the server").option("--pb-version <version>", "PocketBase version to run").option("--no-build", "deploy the existing build output without rebuilding").addOption(
|
|
@@ -9469,10 +9529,10 @@ async function serverTimeOrLocal(session) {
|
|
|
9469
9529
|
// src/commands/link.ts
|
|
9470
9530
|
import path39 from "node:path";
|
|
9471
9531
|
import process32 from "node:process";
|
|
9472
|
-
import { Command as
|
|
9532
|
+
import { Command as Command80 } from "commander";
|
|
9473
9533
|
import * as p45 from "@clack/prompts";
|
|
9474
9534
|
var CREATE_NEW = "__new__";
|
|
9475
|
-
var link = new
|
|
9535
|
+
var link = new Command80("link").description("link this project to a velastack.dev project").configureHelp(helpConfig).action(() => runCommand(linkProject, "Failed to link the project."));
|
|
9476
9536
|
async function linkProject() {
|
|
9477
9537
|
const { workspaceRootDir } = await getWorkspace();
|
|
9478
9538
|
const existing = readProjectConfig(workspaceRootDir);
|
|
@@ -9539,14 +9599,14 @@ function defaultProjectName2(workspaceRootDir) {
|
|
|
9539
9599
|
}
|
|
9540
9600
|
|
|
9541
9601
|
// src/commands/env.ts
|
|
9542
|
-
import { Command as
|
|
9602
|
+
import { Command as Command85 } from "commander";
|
|
9543
9603
|
|
|
9544
9604
|
// src/commands/env/list.ts
|
|
9545
|
-
import { Command as
|
|
9605
|
+
import { Command as Command81 } from "commander";
|
|
9546
9606
|
import * as p46 from "@clack/prompts";
|
|
9547
9607
|
import pc19 from "picocolors";
|
|
9548
9608
|
var envList = addTargetOptions(
|
|
9549
|
-
new
|
|
9609
|
+
new Command81("list").description("list environment variable names").configureHelp(helpConfig),
|
|
9550
9610
|
"local"
|
|
9551
9611
|
).action(
|
|
9552
9612
|
(raw) => runCommand(
|
|
@@ -9580,11 +9640,11 @@ function report(keys, where) {
|
|
|
9580
9640
|
|
|
9581
9641
|
// src/commands/env/set.ts
|
|
9582
9642
|
import process33 from "node:process";
|
|
9583
|
-
import { Command as
|
|
9643
|
+
import { Command as Command82 } from "commander";
|
|
9584
9644
|
import * as p47 from "@clack/prompts";
|
|
9585
9645
|
import pc20 from "picocolors";
|
|
9586
9646
|
var envSet = addTargetOptions(
|
|
9587
|
-
new
|
|
9647
|
+
new Command82("set").description("set an environment variable").argument("<key>", "variable name").argument("[value]", "value \u2014 prompted for, without echo, when omitted").configureHelp(helpConfig),
|
|
9588
9648
|
"local"
|
|
9589
9649
|
).action(
|
|
9590
9650
|
(key, value, raw) => runCommand(
|
|
@@ -9627,11 +9687,11 @@ async function promptValue(key) {
|
|
|
9627
9687
|
}
|
|
9628
9688
|
|
|
9629
9689
|
// src/commands/env/unset.ts
|
|
9630
|
-
import { Command as
|
|
9690
|
+
import { Command as Command83 } from "commander";
|
|
9631
9691
|
import * as p48 from "@clack/prompts";
|
|
9632
9692
|
import pc21 from "picocolors";
|
|
9633
9693
|
var envUnset = addTargetOptions(
|
|
9634
|
-
new
|
|
9694
|
+
new Command83("unset").description("remove an environment variable").argument("<key>", "variable name").configureHelp(helpConfig),
|
|
9635
9695
|
"local"
|
|
9636
9696
|
).action(
|
|
9637
9697
|
(key, raw) => runCommand(
|
|
@@ -9669,11 +9729,11 @@ var envUnset = addTargetOptions(
|
|
|
9669
9729
|
import fs38 from "node:fs";
|
|
9670
9730
|
import path40 from "node:path";
|
|
9671
9731
|
import process34 from "node:process";
|
|
9672
|
-
import { Command as
|
|
9732
|
+
import { Command as Command84 } from "commander";
|
|
9673
9733
|
import * as p49 from "@clack/prompts";
|
|
9674
9734
|
import pc22 from "picocolors";
|
|
9675
9735
|
var envImport = addTargetOptions(
|
|
9676
|
-
new
|
|
9736
|
+
new Command84("import").description("merge a dotenv file into the environment").argument("<file>", "dotenv file to read").configureHelp(helpConfig),
|
|
9677
9737
|
"local"
|
|
9678
9738
|
).action(
|
|
9679
9739
|
(file, raw) => runCommand(
|
|
@@ -9723,14 +9783,14 @@ function read(resolved, shown) {
|
|
|
9723
9783
|
}
|
|
9724
9784
|
|
|
9725
9785
|
// src/commands/env.ts
|
|
9726
|
-
var env = new
|
|
9786
|
+
var env = new Command85("env").description("manage environment variables, locally or on a target").configureHelp(helpConfig).addCommand(envList).addCommand(envSet).addCommand(envUnset).addCommand(envImport);
|
|
9727
9787
|
|
|
9728
9788
|
// src/commands/status.ts
|
|
9729
|
-
import { Command as
|
|
9789
|
+
import { Command as Command86 } from "commander";
|
|
9730
9790
|
import * as p50 from "@clack/prompts";
|
|
9731
9791
|
import pc23 from "picocolors";
|
|
9732
9792
|
var status = addTargetOptions(
|
|
9733
|
-
new
|
|
9793
|
+
new Command86("status").description("show what is deployed").configureHelp(helpConfig),
|
|
9734
9794
|
"production"
|
|
9735
9795
|
).option("--all", "show every app on the server, not just this project").option("--json", "print raw JSON").action(
|
|
9736
9796
|
(raw) => runCommand(async () => {
|
|
@@ -9789,12 +9849,12 @@ function describe2(state) {
|
|
|
9789
9849
|
}
|
|
9790
9850
|
|
|
9791
9851
|
// src/commands/rollback.ts
|
|
9792
|
-
import { Command as
|
|
9852
|
+
import { Command as Command87 } from "commander";
|
|
9793
9853
|
import * as p51 from "@clack/prompts";
|
|
9794
9854
|
import pc24 from "picocolors";
|
|
9795
9855
|
var rollback = addLockWaitOption(
|
|
9796
9856
|
addTargetOptions(
|
|
9797
|
-
new
|
|
9857
|
+
new Command87("rollback").description("put the previous release back").configureHelp(helpConfig),
|
|
9798
9858
|
"production"
|
|
9799
9859
|
)
|
|
9800
9860
|
).option("--to <release>", "roll back to a specific release instead of the previous one").action(
|
|
@@ -9833,9 +9893,9 @@ var rollback = addLockWaitOption(
|
|
|
9833
9893
|
);
|
|
9834
9894
|
|
|
9835
9895
|
// src/commands/logs.ts
|
|
9836
|
-
import { Command as
|
|
9896
|
+
import { Command as Command88 } from "commander";
|
|
9837
9897
|
var logs = addTargetOptions(
|
|
9838
|
-
new
|
|
9898
|
+
new Command88("logs").description("tail the logs of a deployed app").configureHelp(helpConfig),
|
|
9839
9899
|
"production"
|
|
9840
9900
|
).option("-f, --follow", "keep streaming new output").option("-n, --lines <count>", "how many lines of history to show", "100").option("--pocketbase", "show the PocketBase service instead of the app").action(
|
|
9841
9901
|
(raw) => runCommand(async () => {
|
|
@@ -9869,16 +9929,16 @@ var logs = addTargetOptions(
|
|
|
9869
9929
|
);
|
|
9870
9930
|
|
|
9871
9931
|
// src/commands/admin.ts
|
|
9872
|
-
import { Command as
|
|
9932
|
+
import { Command as Command90 } from "commander";
|
|
9873
9933
|
|
|
9874
9934
|
// src/commands/admin/create.ts
|
|
9875
9935
|
import process35 from "node:process";
|
|
9876
|
-
import { Command as
|
|
9936
|
+
import { Command as Command89 } from "commander";
|
|
9877
9937
|
import * as p52 from "@clack/prompts";
|
|
9878
9938
|
import pc25 from "picocolors";
|
|
9879
9939
|
var MIN_PASSWORD = 10;
|
|
9880
9940
|
var adminCreate = addTargetOptions(
|
|
9881
|
-
new
|
|
9941
|
+
new Command89("create").description("create a login for the admin panel").argument("[email]", "email to sign in with \u2014 prompted for when omitted").configureHelp(helpConfig),
|
|
9882
9942
|
"local"
|
|
9883
9943
|
).action(
|
|
9884
9944
|
(email3, raw) => runCommand(
|
|
@@ -9988,15 +10048,15 @@ async function promptPassword2() {
|
|
|
9988
10048
|
}
|
|
9989
10049
|
|
|
9990
10050
|
// src/commands/admin.ts
|
|
9991
|
-
var admin = new
|
|
10051
|
+
var admin = new Command90("admin").description("manage admin panel logins").configureHelp(helpConfig).addCommand(adminCreate);
|
|
9992
10052
|
|
|
9993
10053
|
// src/commands/backup.ts
|
|
9994
|
-
import { Command as
|
|
10054
|
+
import { Command as Command96 } from "commander";
|
|
9995
10055
|
|
|
9996
10056
|
// src/commands/backup/create.ts
|
|
9997
10057
|
import fs39 from "node:fs";
|
|
9998
10058
|
import path41 from "node:path";
|
|
9999
|
-
import { Command as
|
|
10059
|
+
import { Command as Command91 } from "commander";
|
|
10000
10060
|
import * as p53 from "@clack/prompts";
|
|
10001
10061
|
import pc26 from "picocolors";
|
|
10002
10062
|
|
|
@@ -10085,7 +10145,7 @@ async function writeSchedule(pb, cron, maxKeep) {
|
|
|
10085
10145
|
// src/commands/backup/create.ts
|
|
10086
10146
|
var DEFAULT_BACKUP_DIR = "backups";
|
|
10087
10147
|
var backupCreate = addTargetOptions(
|
|
10088
|
-
new
|
|
10148
|
+
new Command91("create").description("take a backup of the database and uploads").argument("[name]", "name for the archive \u2014 generated when omitted").option("-o, --output <dir>", "where to save the archive", DEFAULT_BACKUP_DIR).option("--no-download", "leave the archive on the server").configureHelp(helpConfig),
|
|
10089
10149
|
"production"
|
|
10090
10150
|
).action(
|
|
10091
10151
|
(name, raw) => runCommand(() => {
|
|
@@ -10109,16 +10169,16 @@ Your bucket's own versioning is what protects the uploaded files.`
|
|
|
10109
10169
|
);
|
|
10110
10170
|
}
|
|
10111
10171
|
if (ctx.session) await checkpointAppDatabases(ctx.session, ctx.instance);
|
|
10112
|
-
const
|
|
10113
|
-
|
|
10172
|
+
const spinner8 = p53.spinner();
|
|
10173
|
+
spinner8.start(`Backing up ${ctx.targetName}`);
|
|
10114
10174
|
try {
|
|
10115
10175
|
await createBackup(ctx.pb, key);
|
|
10116
10176
|
} catch (error) {
|
|
10117
|
-
|
|
10177
|
+
spinner8.stop(`Backup of ${ctx.targetName} failed.`);
|
|
10118
10178
|
throw error;
|
|
10119
10179
|
}
|
|
10120
10180
|
const size = (await listBackups(ctx.pb)).find((b) => b.key === key)?.size ?? 0;
|
|
10121
|
-
|
|
10181
|
+
spinner8.stop(`Backed up ${ctx.targetName} \u2014 ${key} (${formatBytes(size)})`);
|
|
10122
10182
|
if (storage.backupsS3Enabled) {
|
|
10123
10183
|
reportResult({
|
|
10124
10184
|
summary: `Backed up ${ctx.targetName} to your backups bucket.`,
|
|
@@ -10156,24 +10216,24 @@ async function download(ctx, key, outputDir) {
|
|
|
10156
10216
|
fs39.copyFileSync(path41.join(ctx.workspaceRootDir, "data", "backups", key), destination);
|
|
10157
10217
|
return path41.relative(ctx.workspaceRootDir, destination);
|
|
10158
10218
|
}
|
|
10159
|
-
const
|
|
10160
|
-
|
|
10219
|
+
const spinner8 = p53.spinner();
|
|
10220
|
+
spinner8.start(`Downloading ${key}`);
|
|
10161
10221
|
try {
|
|
10162
10222
|
await ctx.session.download(remotePaths.backup(ctx.instance, key), destination);
|
|
10163
10223
|
} catch (error) {
|
|
10164
|
-
|
|
10224
|
+
spinner8.stop(`Could not download ${key}.`);
|
|
10165
10225
|
throw error;
|
|
10166
10226
|
}
|
|
10167
|
-
|
|
10227
|
+
spinner8.stop(`Downloaded ${key}`);
|
|
10168
10228
|
return path41.relative(ctx.workspaceRootDir, destination);
|
|
10169
10229
|
}
|
|
10170
10230
|
|
|
10171
10231
|
// src/commands/backup/list.ts
|
|
10172
|
-
import { Command as
|
|
10232
|
+
import { Command as Command92 } from "commander";
|
|
10173
10233
|
import * as p54 from "@clack/prompts";
|
|
10174
10234
|
import pc27 from "picocolors";
|
|
10175
10235
|
var backupList = addTargetOptions(
|
|
10176
|
-
new
|
|
10236
|
+
new Command92("list").description("list the backups on a target").configureHelp(helpConfig),
|
|
10177
10237
|
"production"
|
|
10178
10238
|
).action(
|
|
10179
10239
|
(raw) => runCommand(
|
|
@@ -10201,11 +10261,11 @@ Take one with ${pc27.cyan("vela backup create")}.`
|
|
|
10201
10261
|
// src/commands/backup/download.ts
|
|
10202
10262
|
import fs40 from "node:fs";
|
|
10203
10263
|
import path42 from "node:path";
|
|
10204
|
-
import { Command as
|
|
10264
|
+
import { Command as Command93 } from "commander";
|
|
10205
10265
|
import * as p55 from "@clack/prompts";
|
|
10206
10266
|
import pc28 from "picocolors";
|
|
10207
10267
|
var backupDownload = addTargetOptions(
|
|
10208
|
-
new
|
|
10268
|
+
new Command93("download").description("save a backup off the server").argument("<key>", "archive to download, as shown by `vela backup list`").option("-o, --output <dir>", "where to save the archive", DEFAULT_BACKUP_DIR).configureHelp(helpConfig),
|
|
10209
10269
|
"production"
|
|
10210
10270
|
).action(
|
|
10211
10271
|
(key, raw) => runCommand(() => {
|
|
@@ -10233,15 +10293,15 @@ Fetch it from the bucket directly \u2014 vela does not hold its credentials.`
|
|
|
10233
10293
|
if (!ctx.session) {
|
|
10234
10294
|
fs40.copyFileSync(path42.join(ctx.workspaceRootDir, "data", "backups", key), destination);
|
|
10235
10295
|
} else {
|
|
10236
|
-
const
|
|
10237
|
-
|
|
10296
|
+
const spinner8 = p55.spinner();
|
|
10297
|
+
spinner8.start(`Downloading ${key} (${formatBytes(found.size)})`);
|
|
10238
10298
|
try {
|
|
10239
10299
|
await ctx.session.download(remotePaths.backup(ctx.instance, key), destination);
|
|
10240
10300
|
} catch (error) {
|
|
10241
|
-
|
|
10301
|
+
spinner8.stop(`Could not download ${key}.`);
|
|
10242
10302
|
throw error;
|
|
10243
10303
|
}
|
|
10244
|
-
|
|
10304
|
+
spinner8.stop(`Downloaded ${key}`);
|
|
10245
10305
|
}
|
|
10246
10306
|
reportResult({
|
|
10247
10307
|
summary: `Saved ${key} from ${ctx.targetName}.`,
|
|
@@ -10253,11 +10313,11 @@ Fetch it from the bucket directly \u2014 vela does not hold its credentials.`
|
|
|
10253
10313
|
|
|
10254
10314
|
// src/commands/backup/delete.ts
|
|
10255
10315
|
import process36 from "node:process";
|
|
10256
|
-
import { Command as
|
|
10316
|
+
import { Command as Command94 } from "commander";
|
|
10257
10317
|
import * as p56 from "@clack/prompts";
|
|
10258
10318
|
import pc29 from "picocolors";
|
|
10259
10319
|
var backupDelete = addTargetOptions(
|
|
10260
|
-
new
|
|
10320
|
+
new Command94("delete").description("remove a backup from a target").argument("<key>", "archive to delete, as shown by `vela backup list`").option("-y, --yes", "skip the confirmation").configureHelp(helpConfig),
|
|
10261
10321
|
"production"
|
|
10262
10322
|
).action(
|
|
10263
10323
|
(key, raw) => runCommand(() => {
|
|
@@ -10288,12 +10348,12 @@ Run ${pc29.cyan("vela backup list")} to see what it does have.`
|
|
|
10288
10348
|
);
|
|
10289
10349
|
|
|
10290
10350
|
// src/commands/backup/schedule.ts
|
|
10291
|
-
import { Command as
|
|
10351
|
+
import { Command as Command95 } from "commander";
|
|
10292
10352
|
import * as p57 from "@clack/prompts";
|
|
10293
10353
|
import pc30 from "picocolors";
|
|
10294
10354
|
var DEFAULT_KEEP = 7;
|
|
10295
10355
|
var backupSchedule = addTargetOptions(
|
|
10296
|
-
new
|
|
10356
|
+
new Command95("schedule").description("back up automatically on a schedule").argument("[cron]", "when to run, as a cron expression \u2014 shows the current one when omitted").option("--keep <n>", "how many scheduled archives to keep", String(DEFAULT_KEEP)).option("--off", "stop backing up automatically").configureHelp(helpConfig),
|
|
10297
10357
|
"production"
|
|
10298
10358
|
).action(
|
|
10299
10359
|
(cron, raw) => runCommand(() => {
|
|
@@ -10337,18 +10397,18 @@ Set one with ${pc30.cyan('vela backup schedule "0 3 * * *"')}.`
|
|
|
10337
10397
|
);
|
|
10338
10398
|
|
|
10339
10399
|
// src/commands/backup.ts
|
|
10340
|
-
var backup = new
|
|
10400
|
+
var backup = new Command96("backup").description("back up the database and uploads, locally or on a target").configureHelp(helpConfig).addCommand(backupCreate).addCommand(backupList).addCommand(backupDownload).addCommand(backupDelete).addCommand(backupSchedule);
|
|
10341
10401
|
|
|
10342
10402
|
// src/commands/restore.ts
|
|
10343
10403
|
import fs41 from "node:fs";
|
|
10344
10404
|
import path43 from "node:path";
|
|
10345
10405
|
import process37 from "node:process";
|
|
10346
|
-
import { Command as
|
|
10406
|
+
import { Command as Command97 } from "commander";
|
|
10347
10407
|
import * as p58 from "@clack/prompts";
|
|
10348
10408
|
import pc31 from "picocolors";
|
|
10349
10409
|
var restore = addLockWaitOption(
|
|
10350
10410
|
addTargetOptions(
|
|
10351
|
-
new
|
|
10411
|
+
new Command97("restore").description("replace a deployment\u2019s database and uploads from a backup").argument("[source]", "a backup key on the target, or a path to a local archive").configureHelp(helpConfig),
|
|
10352
10412
|
"production"
|
|
10353
10413
|
)
|
|
10354
10414
|
).option("-y, --yes", "skip the confirmation prompt").option("--no-migrate", "do not run migrations against the restored database").option("--keep-previous <n>", "how many replaced databases to keep", "1").action(
|
|
@@ -10454,16 +10514,16 @@ Take one with ${pc31.cyan("vela backup create")}, or pass the path to an archive
|
|
|
10454
10514
|
async function stage(ctx, file) {
|
|
10455
10515
|
const dir = remotePaths.restoreStage(ctx.instance);
|
|
10456
10516
|
const remote = `${dir}/${path43.basename(file)}`;
|
|
10457
|
-
const
|
|
10458
|
-
|
|
10517
|
+
const spinner8 = p58.spinner();
|
|
10518
|
+
spinner8.start(`Uploading ${path43.basename(file)}`);
|
|
10459
10519
|
try {
|
|
10460
10520
|
await ctx.session.script(`mkdir -p "$1"`, { args: [dir] });
|
|
10461
10521
|
await ctx.session.upload([file], dir);
|
|
10462
10522
|
} catch (error) {
|
|
10463
|
-
|
|
10523
|
+
spinner8.stop(`Could not upload ${path43.basename(file)}.`);
|
|
10464
10524
|
throw error;
|
|
10465
10525
|
}
|
|
10466
|
-
|
|
10526
|
+
spinner8.stop(`Uploaded ${path43.basename(file)}`);
|
|
10467
10527
|
return remote;
|
|
10468
10528
|
}
|
|
10469
10529
|
async function confirm13(appName, targetName, envTag, from) {
|
|
@@ -10490,7 +10550,7 @@ async function confirm13(appName, targetName, envTag, from) {
|
|
|
10490
10550
|
}
|
|
10491
10551
|
|
|
10492
10552
|
// src/commands/targets.ts
|
|
10493
|
-
import { Command as
|
|
10553
|
+
import { Command as Command98 } from "commander";
|
|
10494
10554
|
import * as p59 from "@clack/prompts";
|
|
10495
10555
|
import pc32 from "picocolors";
|
|
10496
10556
|
import * as v9 from "valibot";
|
|
@@ -10500,7 +10560,7 @@ var OptionsSchema4 = v9.object({
|
|
|
10500
10560
|
offline: v9.optional(v9.boolean())
|
|
10501
10561
|
});
|
|
10502
10562
|
var targets = addSshOptions(
|
|
10503
|
-
new
|
|
10563
|
+
new Command98("targets").description("list the targets this project can deploy to").configureHelp(helpConfig)
|
|
10504
10564
|
).option("--json", "print raw JSON").option("--offline", "skip connecting to servers").action(
|
|
10505
10565
|
(raw) => runCommand(async () => {
|
|
10506
10566
|
const options = parseOptions(OptionsSchema4, raw);
|
|
@@ -10580,14 +10640,14 @@ Release and domain are shown from what this project recorded.`
|
|
|
10580
10640
|
// src/commands/test.ts
|
|
10581
10641
|
import path44 from "node:path";
|
|
10582
10642
|
import process38 from "node:process";
|
|
10583
|
-
import { Command as
|
|
10643
|
+
import { Command as Command99 } from "commander";
|
|
10584
10644
|
import PocketBase6 from "pocketbase";
|
|
10585
10645
|
import pc33 from "picocolors";
|
|
10586
10646
|
import { x as x5 } from "tinyexec";
|
|
10587
10647
|
import { detect as detect8 } from "package-manager-detector";
|
|
10588
10648
|
import { resolveCommand as resolveCommand7 } from "package-manager-detector/commands";
|
|
10589
10649
|
import fs42 from "node:fs";
|
|
10590
|
-
var testServer = new
|
|
10650
|
+
var testServer = new Command99("test:server").description("run server tests").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(async (_opts, cmd) => {
|
|
10591
10651
|
const cwd = process38.cwd();
|
|
10592
10652
|
const email3 = `test-${Math.random().toString(36).slice(2)}@example.com`;
|
|
10593
10653
|
const password11 = "password";
|
|
@@ -10716,7 +10776,7 @@ function stubPagesPlugin() {
|
|
|
10716
10776
|
// src/commands/routes.ts
|
|
10717
10777
|
import fs43 from "node:fs";
|
|
10718
10778
|
import path45 from "node:path";
|
|
10719
|
-
import { Command as
|
|
10779
|
+
import { Command as Command100 } from "commander";
|
|
10720
10780
|
var HTTP_METHODS = /* @__PURE__ */ new Set([
|
|
10721
10781
|
"GET",
|
|
10722
10782
|
"POST",
|
|
@@ -10727,7 +10787,7 @@ var HTTP_METHODS = /* @__PURE__ */ new Set([
|
|
|
10727
10787
|
"HEAD",
|
|
10728
10788
|
"fallback"
|
|
10729
10789
|
]);
|
|
10730
|
-
var routes = new
|
|
10790
|
+
var routes = new Command100("routes").description("list routes").configureHelp(helpConfig).action(async () => {
|
|
10731
10791
|
const { workspaceRootDir, routesDir } = await getWorkspace();
|
|
10732
10792
|
const routesRoot = path45.join(workspaceRootDir, routesDir);
|
|
10733
10793
|
const found = walk(routesRoot, routesRoot).filter((r) => r.methods.length > 0);
|
|
@@ -10803,7 +10863,7 @@ function printTable(routes2) {
|
|
|
10803
10863
|
|
|
10804
10864
|
// src/commands/i18n.ts
|
|
10805
10865
|
import process39 from "node:process";
|
|
10806
|
-
import { Command as
|
|
10866
|
+
import { Command as Command101 } from "commander";
|
|
10807
10867
|
import { x as x6 } from "tinyexec";
|
|
10808
10868
|
import { detect as detect9 } from "package-manager-detector";
|
|
10809
10869
|
import { resolveCommand as resolveCommand8 } from "package-manager-detector/commands";
|
|
@@ -10818,11 +10878,11 @@ async function runWuchale(extraArgs) {
|
|
|
10818
10878
|
throwOnError: true
|
|
10819
10879
|
});
|
|
10820
10880
|
}
|
|
10821
|
-
var extract2 = new
|
|
10822
|
-
var watch = new
|
|
10823
|
-
var status2 = new
|
|
10824
|
-
var clean = new
|
|
10825
|
-
var i18n3 = new
|
|
10881
|
+
var extract2 = new Command101("extract").description("extract translatable strings").configureHelp(helpConfig).action(() => runWuchale([]));
|
|
10882
|
+
var watch = new Command101("watch").description("watch and extract translatable strings").configureHelp(helpConfig).action(() => runWuchale(["--watch"]));
|
|
10883
|
+
var status2 = new Command101("status").description("show i18n status").configureHelp(helpConfig).action(() => runWuchale(["status"]));
|
|
10884
|
+
var clean = new Command101("clean").description("clean unused translatable strings").configureHelp(helpConfig).action(() => runWuchale(["--clean"]));
|
|
10885
|
+
var i18n3 = new Command101("i18n").description("i18n utilities").configureHelp(helpConfig).addCommand(extract2, { isDefault: true }).addCommand(watch).addCommand(status2).addCommand(clean);
|
|
10826
10886
|
|
|
10827
10887
|
// src/commands/oauth.ts
|
|
10828
10888
|
var oauth = stubCommand("oauth", "configure OAuth providers");
|
|
@@ -10831,23 +10891,119 @@ var oauth = stubCommand("oauth", "configure OAuth providers");
|
|
|
10831
10891
|
var schemas = stubCommand("schemas", "manage database schemas");
|
|
10832
10892
|
|
|
10833
10893
|
// src/commands/cms.ts
|
|
10834
|
-
import { Command as
|
|
10894
|
+
import { Command as Command107 } from "commander";
|
|
10895
|
+
|
|
10896
|
+
// src/commands/cms/deploy.ts
|
|
10897
|
+
import process40 from "node:process";
|
|
10898
|
+
import { Command as Command102 } from "commander";
|
|
10899
|
+
import * as p60 from "@clack/prompts";
|
|
10900
|
+
import pc34 from "picocolors";
|
|
10901
|
+
var POLL_INTERVAL2 = 5e3;
|
|
10902
|
+
var POLL_TIMEOUT = 30 * 6e4;
|
|
10903
|
+
var inFlight = (run) => run?.status === "pending" || run?.status === "building";
|
|
10904
|
+
var deploy2 = new Command102("deploy").description("rebuild the hosted site with the latest published content").option(
|
|
10905
|
+
"--project <id>",
|
|
10906
|
+
"velastack.dev project whose site to rebuild, instead of the linked one"
|
|
10907
|
+
).option("--no-wait", "return once the build has started instead of waiting for it").configureHelp(helpConfig).action(
|
|
10908
|
+
(options) => runCommand(async () => {
|
|
10909
|
+
const projectId = resolveProjectId(options.project);
|
|
10910
|
+
const apiKey = requireApiKey();
|
|
10911
|
+
let state = await getSiteDeploy(apiKey, projectId).catch(rewordMissingRoute);
|
|
10912
|
+
if (!state.available) {
|
|
10913
|
+
throw new Error(
|
|
10914
|
+
`This project has no hosted site to rebuild.
|
|
10915
|
+
|
|
10916
|
+
A site deployed with ${pc34.cyan("vela deploy")} is updated by deploying again.`
|
|
10917
|
+
);
|
|
10918
|
+
}
|
|
10919
|
+
const url = state.site?.url ?? "";
|
|
10920
|
+
if (inFlight(state.latest)) {
|
|
10921
|
+
p60.log.info(`A deploy of ${pc34.cyan(url)} is already in progress.`);
|
|
10922
|
+
} else {
|
|
10923
|
+
state = await startSiteDeploy(apiKey, projectId);
|
|
10924
|
+
}
|
|
10925
|
+
if (!options.wait) {
|
|
10926
|
+
p60.log.success(
|
|
10927
|
+
`Build started for ${pc34.cyan(url)} (deployment ${pc34.dim(state.latest?.id ?? "")}).
|
|
10928
|
+
It goes live when the build finishes.`
|
|
10929
|
+
);
|
|
10930
|
+
return;
|
|
10931
|
+
}
|
|
10932
|
+
const spinner8 = p60.spinner();
|
|
10933
|
+
spinner8.start(`Building ${url}`);
|
|
10934
|
+
let latest;
|
|
10935
|
+
try {
|
|
10936
|
+
latest = await waitForRun(apiKey, projectId, state.latest?.id);
|
|
10937
|
+
} catch (error) {
|
|
10938
|
+
spinner8.stop(`Could not follow the build of ${url}.`);
|
|
10939
|
+
throw error;
|
|
10940
|
+
}
|
|
10941
|
+
if (!latest) {
|
|
10942
|
+
spinner8.stop(`Still building ${url}.`);
|
|
10943
|
+
p60.log.warn(
|
|
10944
|
+
`The build has not finished after ${Math.round(POLL_TIMEOUT / 6e4)} minutes.
|
|
10945
|
+
It goes live on its own if it does; the deployments page on velastack.dev shows how it ends.`
|
|
10946
|
+
);
|
|
10947
|
+
return;
|
|
10948
|
+
}
|
|
10949
|
+
if (latest.status === "failed") {
|
|
10950
|
+
spinner8.stop(`Deploy of ${url} failed.`);
|
|
10951
|
+
throw new Error(latest.error || "the build did not finish");
|
|
10952
|
+
}
|
|
10953
|
+
spinner8.stop(`Deployed ${pc34.cyan(url)}`);
|
|
10954
|
+
}, "Failed to deploy the site.")
|
|
10955
|
+
);
|
|
10956
|
+
function resolveProjectId(explicit) {
|
|
10957
|
+
if (explicit !== void 0) {
|
|
10958
|
+
if (!PROJECT_ID_RE.test(explicit)) {
|
|
10959
|
+
throw new Error(`${explicit} is not a velastack.dev project id.`);
|
|
10960
|
+
}
|
|
10961
|
+
return explicit;
|
|
10962
|
+
}
|
|
10963
|
+
const root = findWorkspaceRoot(process40.cwd());
|
|
10964
|
+
const link2 = root ? readProjectConfig(root) : null;
|
|
10965
|
+
if (!link2) {
|
|
10966
|
+
throw new Error(
|
|
10967
|
+
`This project is not linked to velastack.dev.
|
|
10968
|
+
|
|
10969
|
+
Run ${pc34.cyan("vela link")}, or pass ${pc34.cyan("--project <id>")}.`
|
|
10970
|
+
);
|
|
10971
|
+
}
|
|
10972
|
+
return link2.projectId;
|
|
10973
|
+
}
|
|
10974
|
+
function rewordMissingRoute(error) {
|
|
10975
|
+
if (error instanceof Error && /\(404\)/.test(error.message)) {
|
|
10976
|
+
throw new Error("velastack.dev does not support site deploys from the CLI yet.");
|
|
10977
|
+
}
|
|
10978
|
+
throw error;
|
|
10979
|
+
}
|
|
10980
|
+
async function waitForRun(apiKey, projectId, runId) {
|
|
10981
|
+
const deadline = Date.now() + POLL_TIMEOUT;
|
|
10982
|
+
while (Date.now() < deadline) {
|
|
10983
|
+
await new Promise((resolve2) => setTimeout(resolve2, POLL_INTERVAL2));
|
|
10984
|
+
const state = await getSiteDeploy(apiKey, projectId);
|
|
10985
|
+
const latest = state.latest;
|
|
10986
|
+
if (!latest || runId && latest.id !== runId) continue;
|
|
10987
|
+
if (!inFlight(latest)) return latest;
|
|
10988
|
+
}
|
|
10989
|
+
return null;
|
|
10990
|
+
}
|
|
10835
10991
|
|
|
10836
10992
|
// src/commands/cms/editor.ts
|
|
10837
|
-
import { Command as
|
|
10993
|
+
import { Command as Command106 } from "commander";
|
|
10838
10994
|
|
|
10839
10995
|
// src/commands/cms/editor/add.ts
|
|
10840
10996
|
import { randomBytes } from "node:crypto";
|
|
10841
|
-
import { Command as
|
|
10842
|
-
import * as
|
|
10843
|
-
import
|
|
10997
|
+
import { Command as Command103 } from "commander";
|
|
10998
|
+
import * as p61 from "@clack/prompts";
|
|
10999
|
+
import pc36 from "picocolors";
|
|
10844
11000
|
|
|
10845
11001
|
// src/lib/cms-backend.ts
|
|
10846
11002
|
import { createRequire as createRequire3 } from "node:module";
|
|
10847
11003
|
import path46 from "node:path";
|
|
10848
|
-
import
|
|
11004
|
+
import process41 from "node:process";
|
|
10849
11005
|
import { pathToFileURL as pathToFileURL3 } from "node:url";
|
|
10850
|
-
import
|
|
11006
|
+
import pc35 from "picocolors";
|
|
10851
11007
|
var DEFAULT_PROJECT = "default";
|
|
10852
11008
|
async function loadBackendModule(root) {
|
|
10853
11009
|
let entry;
|
|
@@ -10857,12 +11013,12 @@ async function loadBackendModule(root) {
|
|
|
10857
11013
|
throw new Error(
|
|
10858
11014
|
`@velastack/cms is not installed in this project.
|
|
10859
11015
|
|
|
10860
|
-
Run ${
|
|
11016
|
+
Run ${pc35.cyan("vela enable cms")} first.`
|
|
10861
11017
|
);
|
|
10862
11018
|
}
|
|
10863
11019
|
return await import(pathToFileURL3(entry).href);
|
|
10864
11020
|
}
|
|
10865
|
-
async function withCmsBackend(fn, cwd =
|
|
11021
|
+
async function withCmsBackend(fn, cwd = process41.cwd()) {
|
|
10866
11022
|
const root = findWorkspaceRoot(cwd);
|
|
10867
11023
|
if (!root) {
|
|
10868
11024
|
throw new Error("Could not find workspace root (no package.json found)");
|
|
@@ -10881,42 +11037,42 @@ async function withCmsBackend(fn, cwd = process40.cwd()) {
|
|
|
10881
11037
|
}
|
|
10882
11038
|
|
|
10883
11039
|
// src/commands/cms/editor/add.ts
|
|
10884
|
-
var editorAdd = new
|
|
11040
|
+
var editorAdd = new Command103("add").description("create an editor who can sign in to the admin bar").argument("<email>", "email the editor signs in with").option("--password <password>", "password to set \u2014 generated and shown once when omitted").option("--project <id>", "project the editor may edit", DEFAULT_PROJECT).configureHelp(helpConfig).action(
|
|
10885
11041
|
(email3, options) => runCommand(async () => {
|
|
10886
11042
|
const generated = options.password === void 0;
|
|
10887
11043
|
const password11 = options.password ?? randomBytes(12).toString("base64url");
|
|
10888
11044
|
const editor2 = await withCmsBackend(
|
|
10889
11045
|
(cms3) => cms3.editors.create({ email: email3, password: password11, projects: [options.project] })
|
|
10890
11046
|
);
|
|
10891
|
-
const lines = [`Added ${
|
|
11047
|
+
const lines = [`Added ${pc36.cyan(editor2.email)} as an editor of ${pc36.cyan(options.project)}.`];
|
|
10892
11048
|
if (generated) {
|
|
10893
|
-
lines.push("", `Password: ${
|
|
11049
|
+
lines.push("", `Password: ${pc36.bold(password11)}`, "", "It is shown once; copy it now.");
|
|
10894
11050
|
}
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
`Run ${
|
|
11051
|
+
p61.log.success(lines.join("\n"));
|
|
11052
|
+
p61.log.info(
|
|
11053
|
+
`Run ${pc36.cyan("vela dev")}, open any page with ${pc36.cyan("?edit")} on the URL (or press ${pc36.cyan("Ctrl+E")}), and sign in.`
|
|
10898
11054
|
);
|
|
10899
11055
|
}, "Failed to add the editor.")
|
|
10900
11056
|
);
|
|
10901
11057
|
|
|
10902
11058
|
// src/commands/cms/editor/password.ts
|
|
10903
|
-
import { Command as
|
|
10904
|
-
import * as
|
|
10905
|
-
import
|
|
10906
|
-
var editorPassword = new
|
|
11059
|
+
import { Command as Command104 } from "commander";
|
|
11060
|
+
import * as p62 from "@clack/prompts";
|
|
11061
|
+
import pc37 from "picocolors";
|
|
11062
|
+
var editorPassword = new Command104("password").description("set an editor's password").argument("<email>", "email of the editor").argument("<password>", "new password").configureHelp(helpConfig).action(
|
|
10907
11063
|
(email3, password11) => runCommand(async () => {
|
|
10908
11064
|
await withCmsBackend((cms3) => cms3.editors.setPassword(email3, password11));
|
|
10909
|
-
|
|
10910
|
-
`Updated the password for ${
|
|
11065
|
+
p62.log.success(
|
|
11066
|
+
`Updated the password for ${pc37.cyan(email3)}. Existing sessions were signed out.`
|
|
10911
11067
|
);
|
|
10912
11068
|
}, "Failed to set the password.")
|
|
10913
11069
|
);
|
|
10914
11070
|
|
|
10915
11071
|
// src/commands/cms/editor/list.ts
|
|
10916
|
-
import { Command as
|
|
10917
|
-
import * as
|
|
10918
|
-
import
|
|
10919
|
-
var editorList = new
|
|
11072
|
+
import { Command as Command105 } from "commander";
|
|
11073
|
+
import * as p63 from "@clack/prompts";
|
|
11074
|
+
import pc38 from "picocolors";
|
|
11075
|
+
var editorList = new Command105("list").description("list editors and the projects they may edit").configureHelp(helpConfig).action(
|
|
10920
11076
|
() => runCommand(async () => {
|
|
10921
11077
|
const rows = await withCmsBackend(
|
|
10922
11078
|
async (cms3) => cms3.editors.list().map((editor2) => ({
|
|
@@ -10925,25 +11081,25 @@ var editorList = new Command102("list").description("list editors and the projec
|
|
|
10925
11081
|
}))
|
|
10926
11082
|
);
|
|
10927
11083
|
if (rows.length === 0) {
|
|
10928
|
-
|
|
11084
|
+
p63.log.info(`No editors yet. Add one with ${pc38.cyan("vela cms editor add <email>")}.`);
|
|
10929
11085
|
return;
|
|
10930
11086
|
}
|
|
10931
11087
|
const width = Math.max(...rows.map((row) => row.email.length));
|
|
10932
|
-
|
|
11088
|
+
p63.log.info(
|
|
10933
11089
|
`Editors
|
|
10934
11090
|
|
|
10935
11091
|
` + rows.map(
|
|
10936
|
-
(row) => ` ${row.email.padEnd(width)} ${
|
|
11092
|
+
(row) => ` ${row.email.padEnd(width)} ${pc38.dim(row.projects.join(", ") || "no projects")}`
|
|
10937
11093
|
).join("\n")
|
|
10938
11094
|
);
|
|
10939
11095
|
}, "Failed to list editors.")
|
|
10940
11096
|
);
|
|
10941
11097
|
|
|
10942
11098
|
// src/commands/cms/editor.ts
|
|
10943
|
-
var editor = new
|
|
11099
|
+
var editor = new Command106("editor").description("manage who can sign in to the admin bar").configureHelp(helpConfig).addCommand(editorAdd).addCommand(editorPassword).addCommand(editorList);
|
|
10944
11100
|
|
|
10945
11101
|
// src/commands/cms.ts
|
|
10946
|
-
var cms2 = new
|
|
11102
|
+
var cms2 = new Command107("cms").description("manage the CMS").configureHelp(helpConfig).addCommand(editor).addCommand(deploy2);
|
|
10947
11103
|
|
|
10948
11104
|
// src/program.ts
|
|
10949
11105
|
var NO_BACKEND_COMMMANDS = /* @__PURE__ */ new Set([
|
|
@@ -10983,10 +11139,10 @@ var NO_BACKEND_COMMMANDS = /* @__PURE__ */ new Set([
|
|
|
10983
11139
|
]);
|
|
10984
11140
|
var BACKEND_OPTIONAL_COMMANDS = /* @__PURE__ */ new Set(["dev", "build", "preview", "deploy"]);
|
|
10985
11141
|
var SELF_CREDENTIALED_COMMANDS = /* @__PURE__ */ new Set(["test:server"]);
|
|
10986
|
-
var program = new
|
|
11142
|
+
var program = new Command108().name(package_default.name).description(package_default.description).version(package_default.version, "-v, --version").configureHelp(helpConfig);
|
|
10987
11143
|
program.hook("preAction", (_thisCommand, actionCommand) => {
|
|
10988
11144
|
if (isStub(actionCommand)) return;
|
|
10989
|
-
const envRoot = findWorkspaceRoot() ??
|
|
11145
|
+
const envRoot = findWorkspaceRoot() ?? process42.cwd();
|
|
10990
11146
|
dotenv2.config({ path: nodePath.join(envRoot, ".env"), quiet: true });
|
|
10991
11147
|
const path47 = getCommandPath(actionCommand);
|
|
10992
11148
|
if (NO_BACKEND_COMMMANDS.has(path47)) return;
|
|
@@ -10994,30 +11150,30 @@ program.hook("preAction", (_thisCommand, actionCommand) => {
|
|
|
10994
11150
|
if (NO_BACKEND_COMMMANDS.has(top)) return;
|
|
10995
11151
|
if (!hasBackend()) {
|
|
10996
11152
|
if (BACKEND_OPTIONAL_COMMANDS.has(top)) return;
|
|
10997
|
-
|
|
10998
|
-
`${
|
|
11153
|
+
p64.log.error(
|
|
11154
|
+
`${pc39.cyan(`vela ${path47}`)} needs a backend, and this project does not have one.
|
|
10999
11155
|
|
|
11000
11156
|
Static projects have no database to talk to.
|
|
11001
11157
|
|
|
11002
|
-
To add a backend to this project, run ${
|
|
11158
|
+
To add a backend to this project, run ${pc39.cyan("vela bless")}.`
|
|
11003
11159
|
);
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11160
|
+
p64.log.message();
|
|
11161
|
+
p64.cancel("Operation failed.");
|
|
11162
|
+
process42.exit(1);
|
|
11007
11163
|
}
|
|
11008
11164
|
if (SELF_CREDENTIALED_COMMANDS.has(path47)) return;
|
|
11009
|
-
if (!
|
|
11010
|
-
|
|
11165
|
+
if (!process42.env.POCKETBASE_SUPERUSER_EMAIL || !process42.env.POCKETBASE_SUPERUSER_PASSWORD) {
|
|
11166
|
+
p64.log.error(
|
|
11011
11167
|
`PocketBase superuser credentials are required.
|
|
11012
11168
|
|
|
11013
|
-
Set ${
|
|
11169
|
+
Set ${pc39.cyan("POCKETBASE_SUPERUSER_EMAIL")} and ${pc39.cyan("POCKETBASE_SUPERUSER_PASSWORD")} in your .env file.
|
|
11014
11170
|
|
|
11015
|
-
To set up a new project, run ${
|
|
11016
|
-
To set up an existing project, run ${
|
|
11171
|
+
To set up a new project, run ${pc39.cyan("vela create")}.
|
|
11172
|
+
To set up an existing project, run ${pc39.cyan("vela bless")}.`
|
|
11017
11173
|
);
|
|
11018
|
-
|
|
11019
|
-
|
|
11020
|
-
|
|
11174
|
+
p64.log.message();
|
|
11175
|
+
p64.cancel("Operation failed.");
|
|
11176
|
+
process42.exit(1);
|
|
11021
11177
|
}
|
|
11022
11178
|
});
|
|
11023
11179
|
function getCommandPath(cmd) {
|
|
@@ -11071,5 +11227,5 @@ for (const command of [
|
|
|
11071
11227
|
}
|
|
11072
11228
|
|
|
11073
11229
|
// src/bin.ts
|
|
11074
|
-
program.parse(normalizeArgv(
|
|
11230
|
+
program.parse(normalizeArgv(process43.argv.slice(2)), { from: "user" });
|
|
11075
11231
|
//# sourceMappingURL=bin.js.map
|