vela 0.12.2 → 0.13.0
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 +652 -296
- package/dist/bin.js.map +4 -4
- package/package.json +3 -3
- package/templates/minimal/package.template.json +3 -0
- package/templates/minimal/src/hooks.server.ts +5 -0
- package/templates/minimal/src/lib/server/workflows.ts +172 -0
- package/templates/minimal/src/lib/workflows/README.md +52 -0
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 process46 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 process45 from "node:process";
|
|
15
|
+
import * as p67 from "@clack/prompts";
|
|
16
|
+
import { Command as Command114 } from "commander";
|
|
17
17
|
import nodePath from "node:path";
|
|
18
18
|
import dotenv2 from "dotenv";
|
|
19
|
-
import
|
|
19
|
+
import pc42 from "picocolors";
|
|
20
20
|
|
|
21
21
|
// package.json
|
|
22
22
|
var package_default = {
|
|
23
23
|
name: "vela",
|
|
24
|
-
version: "0.
|
|
24
|
+
version: "0.13.0",
|
|
25
25
|
type: "module",
|
|
26
26
|
description: "A CLI for creating and updating SvelteKit projects",
|
|
27
27
|
license: "MIT",
|
|
@@ -57,7 +57,7 @@ var package_default = {
|
|
|
57
57
|
dependencies: {
|
|
58
58
|
"@clack/prompts": "^1.7.0",
|
|
59
59
|
"@faker-js/faker": "^10.6.0",
|
|
60
|
-
"@velastack/patterns": "^0.2.
|
|
60
|
+
"@velastack/patterns": "^0.2.8",
|
|
61
61
|
"@velastack/pocketbase-codegen": "^0.1.0",
|
|
62
62
|
"annotate-json-schema": "^0.1.0",
|
|
63
63
|
commander: "^13.1.0",
|
|
@@ -70,7 +70,7 @@ var package_default = {
|
|
|
70
70
|
"package-manager-detector": "^1.8.0",
|
|
71
71
|
picocolors: "^1.1.1",
|
|
72
72
|
pocketbase: "^0.28.0",
|
|
73
|
-
"pocketbase-server": "^0.
|
|
73
|
+
"pocketbase-server": "^0.40.4",
|
|
74
74
|
stripe: "^19.3.0",
|
|
75
75
|
svelte: "^5.56.10",
|
|
76
76
|
tar: "^7.5.22",
|
|
@@ -417,7 +417,8 @@ function detectFeatures(root, { isAppMode, isPaymentsMode }) {
|
|
|
417
417
|
payments: isPaymentsMode,
|
|
418
418
|
blog: hasDep("mdsvex"),
|
|
419
419
|
contentNegotiation: hasDep("sveltekit-negotiate"),
|
|
420
|
-
cms: hasDep("@velastack/cms")
|
|
420
|
+
cms: hasDep("@velastack/cms"),
|
|
421
|
+
workflows: has("src/lib/server/workflows.ts")
|
|
421
422
|
};
|
|
422
423
|
}
|
|
423
424
|
|
|
@@ -2171,6 +2172,14 @@ async function finishDeployment(apiKey, projectId, deploymentId, input) {
|
|
|
2171
2172
|
body: JSON.stringify(input)
|
|
2172
2173
|
});
|
|
2173
2174
|
}
|
|
2175
|
+
async function getSiteDeploy(apiKey, projectId) {
|
|
2176
|
+
return apiFetch(apiKey, `/v1/projects/${projectId}/site/deploy`);
|
|
2177
|
+
}
|
|
2178
|
+
async function startSiteDeploy(apiKey, projectId) {
|
|
2179
|
+
return apiFetch(apiKey, `/v1/projects/${projectId}/site/deploy`, {
|
|
2180
|
+
method: "POST"
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
2174
2183
|
async function destroyEnvironment(apiKey, projectId, envTag) {
|
|
2175
2184
|
return apiFetch(apiKey, `/v1/projects/${projectId}/environments/${encodeURIComponent(envTag)}`, {
|
|
2176
2185
|
method: "DELETE"
|
|
@@ -2658,7 +2667,7 @@ function promptCredentials(options, onCancel2) {
|
|
|
2658
2667
|
}
|
|
2659
2668
|
|
|
2660
2669
|
// src/commands/generate.ts
|
|
2661
|
-
import { Command as
|
|
2670
|
+
import { Command as Command11 } from "commander";
|
|
2662
2671
|
|
|
2663
2672
|
// src/commands/generate/form.ts
|
|
2664
2673
|
import { Command as Command5 } from "commander";
|
|
@@ -2679,7 +2688,7 @@ async function runPattern(slug2, argv, input, report4) {
|
|
|
2679
2688
|
}
|
|
2680
2689
|
checkProviderInput(pattern, argv, input);
|
|
2681
2690
|
const { workspaceRootDir, features } = await getWorkspace();
|
|
2682
|
-
const
|
|
2691
|
+
const log49 = p9.taskLog({ title: report4.task.title });
|
|
2683
2692
|
let result;
|
|
2684
2693
|
try {
|
|
2685
2694
|
result = await pattern.generate({
|
|
@@ -2699,11 +2708,11 @@ async function runPattern(slug2, argv, input, report4) {
|
|
|
2699
2708
|
});
|
|
2700
2709
|
return collections2;
|
|
2701
2710
|
},
|
|
2702
|
-
logger: { info: (message) =>
|
|
2711
|
+
logger: { info: (message) => log49.message(message) }
|
|
2703
2712
|
});
|
|
2704
|
-
|
|
2713
|
+
log49.success(report4.task.success);
|
|
2705
2714
|
} catch (e) {
|
|
2706
|
-
|
|
2715
|
+
log49.error(report4.task.error);
|
|
2707
2716
|
throw e;
|
|
2708
2717
|
}
|
|
2709
2718
|
const rel = (f) => toRelative(workspaceRootDir, f);
|
|
@@ -2783,17 +2792,17 @@ async function aiLoop(opts) {
|
|
|
2783
2792
|
let attempt = 0;
|
|
2784
2793
|
while (true) {
|
|
2785
2794
|
attempt++;
|
|
2786
|
-
const
|
|
2787
|
-
|
|
2795
|
+
const spinner8 = p10.spinner();
|
|
2796
|
+
spinner8.start(`${opts.stageLabel} (${attempt > 1 ? "iteration " + attempt : "first pass"})\u2026`);
|
|
2788
2797
|
let result;
|
|
2789
2798
|
let turn;
|
|
2790
2799
|
try {
|
|
2791
2800
|
const out = await opts.call({ prompt, history });
|
|
2792
2801
|
result = out.result;
|
|
2793
2802
|
turn = out.turn;
|
|
2794
|
-
|
|
2803
|
+
spinner8.stop(`${opts.stageLabel} ready.`);
|
|
2795
2804
|
} catch (e) {
|
|
2796
|
-
|
|
2805
|
+
spinner8.stop(`${opts.stageLabel} failed.`);
|
|
2797
2806
|
throw e;
|
|
2798
2807
|
}
|
|
2799
2808
|
opts.renderPreview(result);
|
|
@@ -3245,15 +3254,41 @@ var migration = new Command9("migration").description("generate a migration for
|
|
|
3245
3254
|
)
|
|
3246
3255
|
);
|
|
3247
3256
|
|
|
3257
|
+
// src/commands/generate/workflow.ts
|
|
3258
|
+
import { Command as Command10 } from "commander";
|
|
3259
|
+
var workflow = new Command10("workflow").description("generate a background workflow in src/lib/workflows").argument("<name>", "workflow name, e.g. send-welcome-email").option("--cron <schedule>", 'run on a schedule, e.g. "*/5 * * * *"').allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
3260
|
+
(name, options, cmd) => runCommand(
|
|
3261
|
+
() => runPattern(
|
|
3262
|
+
"generate-workflow",
|
|
3263
|
+
[name, ...options.cron ? ["--cron", options.cron] : [], ...cmd.args.slice(1)],
|
|
3264
|
+
{},
|
|
3265
|
+
{
|
|
3266
|
+
summary: `Generated the ${name} workflow.`,
|
|
3267
|
+
nextSteps: [
|
|
3268
|
+
"Fill in the steps in the new file under src/lib/workflows/.",
|
|
3269
|
+
options.cron ? "It starts on its schedule whenever the app is running; `.run()` starts an extra run." : "Start a run from server code with `.run(input)`; runs show up under Workflows in the PocketBase dashboard.",
|
|
3270
|
+
"Run `vela test:server` to run its test."
|
|
3271
|
+
],
|
|
3272
|
+
task: {
|
|
3273
|
+
title: "Generating workflow",
|
|
3274
|
+
success: "Generated workflow",
|
|
3275
|
+
error: "Failed to generate workflow"
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
),
|
|
3279
|
+
"Failed to generate workflow."
|
|
3280
|
+
)
|
|
3281
|
+
);
|
|
3282
|
+
|
|
3248
3283
|
// src/commands/generate.ts
|
|
3249
|
-
var generate = new
|
|
3284
|
+
var generate = new Command11("generate").description("generate scaffolding for database models and forms").configureHelp(helpConfig).addCommand(form).addCommand(schema).addCommand(resource).addCommand(scaffold).addCommand(migration).addCommand(workflow);
|
|
3250
3285
|
|
|
3251
3286
|
// src/commands/enable.ts
|
|
3252
|
-
import { Command as
|
|
3287
|
+
import { Command as Command28 } from "commander";
|
|
3253
3288
|
|
|
3254
3289
|
// src/commands/enable/analytics.ts
|
|
3255
|
-
import { Command as
|
|
3256
|
-
var analytics = new
|
|
3290
|
+
import { Command as Command12 } from "commander";
|
|
3291
|
+
var analytics = new Command12("analytics").description("enable web analytics (Plausible, Google Analytics or PostHog)").option("--provider <provider>", "analytics provider: plausible, google or posthog").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
3257
3292
|
(opts, cmd) => runCommand(async () => {
|
|
3258
3293
|
const provider = await resolveProvider("enable-analytics", opts.provider);
|
|
3259
3294
|
const providerEnv = await collectProviderEnv(provider);
|
|
@@ -3283,8 +3318,8 @@ var analytics = new Command11("analytics").description("enable web analytics (Pl
|
|
|
3283
3318
|
);
|
|
3284
3319
|
|
|
3285
3320
|
// src/commands/enable/auth.ts
|
|
3286
|
-
import { Command as
|
|
3287
|
-
var auth = new
|
|
3321
|
+
import { Command as Command13 } from "commander";
|
|
3322
|
+
var auth = new Command13("auth").description("enable authentication (email/password + OAuth scaffold)").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
3288
3323
|
(_opts, cmd) => runCommand(
|
|
3289
3324
|
() => runPattern(
|
|
3290
3325
|
"enable-auth",
|
|
@@ -3309,8 +3344,8 @@ var auth = new Command12("auth").description("enable authentication (email/passw
|
|
|
3309
3344
|
);
|
|
3310
3345
|
|
|
3311
3346
|
// src/commands/enable/api.ts
|
|
3312
|
-
import { Command as
|
|
3313
|
-
var api = new
|
|
3347
|
+
import { Command as Command14 } from "commander";
|
|
3348
|
+
var api = new Command14("api").description("enable the PocketBase REST API").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
3314
3349
|
(_opts, cmd) => runCommand(
|
|
3315
3350
|
() => runPattern(
|
|
3316
3351
|
"enable-api",
|
|
@@ -3335,8 +3370,8 @@ var api = new Command13("api").description("enable the PocketBase REST API").all
|
|
|
3335
3370
|
);
|
|
3336
3371
|
|
|
3337
3372
|
// src/commands/enable/api-keys.ts
|
|
3338
|
-
import { Command as
|
|
3339
|
-
var apiKeys = new
|
|
3373
|
+
import { Command as Command15 } from "commander";
|
|
3374
|
+
var apiKeys = new Command15("api-keys").description("enable API key management").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
3340
3375
|
(_opts, cmd) => runCommand(
|
|
3341
3376
|
() => runPattern(
|
|
3342
3377
|
"enable-api-keys",
|
|
@@ -3361,8 +3396,8 @@ var apiKeys = new Command14("api-keys").description("enable API key management")
|
|
|
3361
3396
|
);
|
|
3362
3397
|
|
|
3363
3398
|
// src/commands/enable/backend.ts
|
|
3364
|
-
import { Command as
|
|
3365
|
-
var backend = new
|
|
3399
|
+
import { Command as Command16 } from "commander";
|
|
3400
|
+
var backend = new Command16("backend").description("enable the PocketBase backend").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
3366
3401
|
(_opts, cmd) => runCommand(
|
|
3367
3402
|
() => runPattern(
|
|
3368
3403
|
"enable-backend",
|
|
@@ -3387,8 +3422,8 @@ var backend = new Command15("backend").description("enable the PocketBase backen
|
|
|
3387
3422
|
);
|
|
3388
3423
|
|
|
3389
3424
|
// src/commands/enable/i18n.ts
|
|
3390
|
-
import { Command as
|
|
3391
|
-
var i18n = new
|
|
3425
|
+
import { Command as Command17 } from "commander";
|
|
3426
|
+
var i18n = new Command17("i18n").description("enable internationalization").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
3392
3427
|
(_opts, cmd) => runCommand(
|
|
3393
3428
|
() => runPattern(
|
|
3394
3429
|
"enable-i18n",
|
|
@@ -3413,8 +3448,8 @@ var i18n = new Command16("i18n").description("enable internationalization").allo
|
|
|
3413
3448
|
);
|
|
3414
3449
|
|
|
3415
3450
|
// src/commands/enable/teams.ts
|
|
3416
|
-
import { Command as
|
|
3417
|
-
var teams = new
|
|
3451
|
+
import { Command as Command18 } from "commander";
|
|
3452
|
+
var teams = new Command18("teams").description("enable team / multi-tenant support").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
3418
3453
|
(_opts, cmd) => runCommand(
|
|
3419
3454
|
() => runPattern(
|
|
3420
3455
|
"enable-teams",
|
|
@@ -3440,10 +3475,10 @@ var teams = new Command17("teams").description("enable team / multi-tenant suppo
|
|
|
3440
3475
|
|
|
3441
3476
|
// src/commands/enable/payments.ts
|
|
3442
3477
|
import process12 from "node:process";
|
|
3443
|
-
import { Command as
|
|
3478
|
+
import { Command as Command19 } from "commander";
|
|
3444
3479
|
import * as p17 from "@clack/prompts";
|
|
3445
3480
|
var PROVIDERS = [{ value: "stripe", label: "Stripe" }];
|
|
3446
|
-
var payments = new
|
|
3481
|
+
var payments = new Command19("payments").description("enable payments").option("--provider <provider>", "payment provider", "stripe").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
3447
3482
|
(opts, cmd) => runCommand(async () => {
|
|
3448
3483
|
const provider = await resolveProvider2(opts.provider, cmd.getOptionValueSource("provider"));
|
|
3449
3484
|
const input = {
|
|
@@ -3540,8 +3575,8 @@ async function promptPassword(message) {
|
|
|
3540
3575
|
}
|
|
3541
3576
|
|
|
3542
3577
|
// src/commands/enable/subscriptions.ts
|
|
3543
|
-
import { Command as
|
|
3544
|
-
var subscriptions = new
|
|
3578
|
+
import { Command as Command20 } from "commander";
|
|
3579
|
+
var subscriptions = new Command20("subscriptions").description("enable Stripe subscriptions (requires auth and payments)").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
3545
3580
|
(_opts, cmd) => runCommand(
|
|
3546
3581
|
() => runPattern(
|
|
3547
3582
|
"enable-subscriptions",
|
|
@@ -3566,8 +3601,8 @@ var subscriptions = new Command19("subscriptions").description("enable Stripe su
|
|
|
3566
3601
|
);
|
|
3567
3602
|
|
|
3568
3603
|
// src/commands/enable/notifications.ts
|
|
3569
|
-
import { Command as
|
|
3570
|
-
var notifications = new
|
|
3604
|
+
import { Command as Command21 } from "commander";
|
|
3605
|
+
var notifications = new Command21("notifications").description("enable in-app notifications with a bell dropdown (requires auth)").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
3571
3606
|
(_opts, cmd) => runCommand(
|
|
3572
3607
|
() => runPattern(
|
|
3573
3608
|
"enable-notifications",
|
|
@@ -3593,7 +3628,7 @@ var notifications = new Command20("notifications").description("enable in-app no
|
|
|
3593
3628
|
|
|
3594
3629
|
// src/commands/enable/s3.ts
|
|
3595
3630
|
import process16 from "node:process";
|
|
3596
|
-
import { Command as
|
|
3631
|
+
import { Command as Command22 } from "commander";
|
|
3597
3632
|
import * as p20 from "@clack/prompts";
|
|
3598
3633
|
import pc8 from "picocolors";
|
|
3599
3634
|
|
|
@@ -4892,7 +4927,7 @@ function hasFile(dir) {
|
|
|
4892
4927
|
|
|
4893
4928
|
// src/commands/enable/s3.ts
|
|
4894
4929
|
var s3 = addTargetOptions(
|
|
4895
|
-
new
|
|
4930
|
+
new Command22("s3").description("enable S3 file storage").option("--backups", "configure where backups are kept, not where uploads go").option("--endpoint <url>", "S3 endpoint URL").option("--bucket <name>", "S3 bucket name").option("--region <region>", "S3 region").option("--access-key <key>", "S3 access key").option("--secret <secret>", "S3 secret key \u2014 prefer VELA_S3_SECRET").option("--force-path-style", "address the bucket in the path (MinIO, Ceph)").option("--no-force-path-style", "address the bucket as a subdomain (AWS, R2)").option("--force", "enable it even though uploads already exist on disk").configureHelp(helpConfig),
|
|
4896
4931
|
"local"
|
|
4897
4932
|
).action(
|
|
4898
4933
|
(raw) => runCommand(() => {
|
|
@@ -4999,9 +5034,9 @@ async function confirm4(message, initialValue) {
|
|
|
4999
5034
|
|
|
5000
5035
|
// src/commands/enable/smtp.ts
|
|
5001
5036
|
import process17 from "node:process";
|
|
5002
|
-
import { Command as
|
|
5037
|
+
import { Command as Command23 } from "commander";
|
|
5003
5038
|
import * as p21 from "@clack/prompts";
|
|
5004
|
-
var smtp = new
|
|
5039
|
+
var smtp = new Command23("smtp").description("configure SMTP for transactional email").configureHelp(helpConfig).action(
|
|
5005
5040
|
() => runCommand(async () => {
|
|
5006
5041
|
const { workspaceRootDir } = await getWorkspace();
|
|
5007
5042
|
const config = await p21.group(
|
|
@@ -5055,10 +5090,10 @@ var smtp = new Command22("smtp").description("configure SMTP for transactional e
|
|
|
5055
5090
|
|
|
5056
5091
|
// src/commands/enable/cms.ts
|
|
5057
5092
|
import process18 from "node:process";
|
|
5058
|
-
import { Command as
|
|
5093
|
+
import { Command as Command24 } from "commander";
|
|
5059
5094
|
import * as p22 from "@clack/prompts";
|
|
5060
5095
|
import pc9 from "picocolors";
|
|
5061
|
-
var cms = new
|
|
5096
|
+
var cms = new Command24("cms").description("enable an inline-editing CMS with an admin bar").option(
|
|
5062
5097
|
"--endpoint <url>",
|
|
5063
5098
|
"read from a hosted CMS at this URL instead of installing the backend in this app"
|
|
5064
5099
|
).allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
@@ -5091,8 +5126,8 @@ Run ${pc9.cyan("vela bless")} to add a backend, or point at a hosted CMS with ${
|
|
|
5091
5126
|
);
|
|
5092
5127
|
|
|
5093
5128
|
// src/commands/enable/blog.ts
|
|
5094
|
-
import { Command as
|
|
5095
|
-
var blog = new
|
|
5129
|
+
import { Command as Command25 } from "commander";
|
|
5130
|
+
var blog = new Command25("blog").description("enable an mdsvex blog with posts, tags, and RSS").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5096
5131
|
(_opts, cmd) => runCommand(
|
|
5097
5132
|
() => runPattern(
|
|
5098
5133
|
"enable-blog",
|
|
@@ -5117,8 +5152,8 @@ var blog = new Command24("blog").description("enable an mdsvex blog with posts,
|
|
|
5117
5152
|
);
|
|
5118
5153
|
|
|
5119
5154
|
// src/commands/enable/content-negotiation.ts
|
|
5120
|
-
import { Command as
|
|
5121
|
-
var contentNegotiation = new
|
|
5155
|
+
import { Command as Command26 } from "commander";
|
|
5156
|
+
var contentNegotiation = new Command26("content-negotiation").description("enable content negotiation (sveltekit-negotiate)").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5122
5157
|
(_opts, cmd) => runCommand(
|
|
5123
5158
|
() => runPattern(
|
|
5124
5159
|
"enable-content-negotiation",
|
|
@@ -5141,14 +5176,40 @@ var contentNegotiation = new Command25("content-negotiation").description("enabl
|
|
|
5141
5176
|
)
|
|
5142
5177
|
);
|
|
5143
5178
|
|
|
5179
|
+
// src/commands/enable/workflows.ts
|
|
5180
|
+
import { Command as Command27 } from "commander";
|
|
5181
|
+
var workflows = new Command27("workflows").description("add background workflows to a project created before they were built in").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5182
|
+
(_opts, cmd) => runCommand(
|
|
5183
|
+
() => runPattern(
|
|
5184
|
+
"enable-workflows",
|
|
5185
|
+
cmd.args,
|
|
5186
|
+
{},
|
|
5187
|
+
{
|
|
5188
|
+
summary: "Enabled workflows.",
|
|
5189
|
+
nextSteps: [
|
|
5190
|
+
"Run `vela generate workflow <name>` to add one to src/lib/workflows/.",
|
|
5191
|
+
"Start a run from server code with `<name>.run(input)`; runs show up under Workflows in the PocketBase dashboard.",
|
|
5192
|
+
"Read src/lib/workflows/README.md for recurring workflows, retries and the worker settings."
|
|
5193
|
+
],
|
|
5194
|
+
task: {
|
|
5195
|
+
title: "Enabling workflows",
|
|
5196
|
+
success: "Enabled workflows",
|
|
5197
|
+
error: "Failed to enable workflows"
|
|
5198
|
+
}
|
|
5199
|
+
}
|
|
5200
|
+
),
|
|
5201
|
+
"Failed to enable workflows."
|
|
5202
|
+
)
|
|
5203
|
+
);
|
|
5204
|
+
|
|
5144
5205
|
// src/commands/enable.ts
|
|
5145
|
-
var enable = new
|
|
5206
|
+
var enable = new Command28("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).addCommand(workflows);
|
|
5146
5207
|
|
|
5147
5208
|
// src/commands/disable.ts
|
|
5148
|
-
import { Command as
|
|
5209
|
+
import { Command as Command41 } from "commander";
|
|
5149
5210
|
|
|
5150
5211
|
// src/commands/disable/auth.ts
|
|
5151
|
-
import { Command as
|
|
5212
|
+
import { Command as Command29 } from "commander";
|
|
5152
5213
|
|
|
5153
5214
|
// src/commands/disable/_shared.ts
|
|
5154
5215
|
import process19 from "node:process";
|
|
@@ -5168,7 +5229,7 @@ async function runDisable(opts, flags, cmdArgs) {
|
|
|
5168
5229
|
}
|
|
5169
5230
|
|
|
5170
5231
|
// src/commands/disable/auth.ts
|
|
5171
|
-
var auth2 = new
|
|
5232
|
+
var auth2 = new Command29("auth").description("disable authentication").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5172
5233
|
(opts, cmd) => runCommand(
|
|
5173
5234
|
() => runDisable(
|
|
5174
5235
|
{
|
|
@@ -5194,8 +5255,8 @@ var auth2 = new Command27("auth").description("disable authentication").option("
|
|
|
5194
5255
|
);
|
|
5195
5256
|
|
|
5196
5257
|
// src/commands/disable/api.ts
|
|
5197
|
-
import { Command as
|
|
5198
|
-
var api2 = new
|
|
5258
|
+
import { Command as Command30 } from "commander";
|
|
5259
|
+
var api2 = new Command30("api").description("disable the REST API").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5199
5260
|
(opts, cmd) => runCommand(
|
|
5200
5261
|
() => runDisable(
|
|
5201
5262
|
{
|
|
@@ -5218,8 +5279,8 @@ var api2 = new Command28("api").description("disable the REST API").option("-y,
|
|
|
5218
5279
|
);
|
|
5219
5280
|
|
|
5220
5281
|
// src/commands/disable/api-keys.ts
|
|
5221
|
-
import { Command as
|
|
5222
|
-
var apiKeys2 = new
|
|
5282
|
+
import { Command as Command31 } from "commander";
|
|
5283
|
+
var apiKeys2 = new Command31("api-keys").description("disable API key management").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5223
5284
|
(opts, cmd) => runCommand(
|
|
5224
5285
|
() => runDisable(
|
|
5225
5286
|
{
|
|
@@ -5242,8 +5303,8 @@ var apiKeys2 = new Command29("api-keys").description("disable API key management
|
|
|
5242
5303
|
);
|
|
5243
5304
|
|
|
5244
5305
|
// src/commands/disable/backend.ts
|
|
5245
|
-
import { Command as
|
|
5246
|
-
var backend2 = new
|
|
5306
|
+
import { Command as Command32 } from "commander";
|
|
5307
|
+
var backend2 = new Command32("backend").description("disable the PocketBase backend").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5247
5308
|
(opts, cmd) => runCommand(
|
|
5248
5309
|
() => runDisable(
|
|
5249
5310
|
{
|
|
@@ -5266,8 +5327,8 @@ var backend2 = new Command30("backend").description("disable the PocketBase back
|
|
|
5266
5327
|
);
|
|
5267
5328
|
|
|
5268
5329
|
// src/commands/disable/content-negotiation.ts
|
|
5269
|
-
import { Command as
|
|
5270
|
-
var contentNegotiation2 = new
|
|
5330
|
+
import { Command as Command33 } from "commander";
|
|
5331
|
+
var contentNegotiation2 = new Command33("content-negotiation").description("disable content negotiation").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5271
5332
|
(opts, cmd) => runCommand(
|
|
5272
5333
|
() => runDisable(
|
|
5273
5334
|
{
|
|
@@ -5290,8 +5351,8 @@ var contentNegotiation2 = new Command31("content-negotiation").description("disa
|
|
|
5290
5351
|
);
|
|
5291
5352
|
|
|
5292
5353
|
// src/commands/disable/i18n.ts
|
|
5293
|
-
import { Command as
|
|
5294
|
-
var i18n2 = new
|
|
5354
|
+
import { Command as Command34 } from "commander";
|
|
5355
|
+
var i18n2 = new Command34("i18n").description("disable internationalization").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5295
5356
|
(opts, cmd) => runCommand(
|
|
5296
5357
|
() => runDisable(
|
|
5297
5358
|
{
|
|
@@ -5316,19 +5377,43 @@ var i18n2 = new Command32("i18n").description("disable internationalization").op
|
|
|
5316
5377
|
)
|
|
5317
5378
|
);
|
|
5318
5379
|
|
|
5380
|
+
// src/commands/disable/notifications.ts
|
|
5381
|
+
import { Command as Command35 } from "commander";
|
|
5382
|
+
var notifications2 = new Command35("notifications").description("disable in-app notifications").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5383
|
+
(opts, cmd) => runCommand(
|
|
5384
|
+
() => runDisable(
|
|
5385
|
+
{
|
|
5386
|
+
slug: "disable-notifications",
|
|
5387
|
+
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.",
|
|
5388
|
+
report: {
|
|
5389
|
+
summary: "Disabled notifications.",
|
|
5390
|
+
nextSteps: [
|
|
5391
|
+
"The timeAgo helper enable-notifications added to $lib/utils is kept in case other code uses it."
|
|
5392
|
+
],
|
|
5393
|
+
task: {
|
|
5394
|
+
title: "Disabling notifications",
|
|
5395
|
+
success: "Disabled notifications",
|
|
5396
|
+
error: "Failed to disable notifications"
|
|
5397
|
+
}
|
|
5398
|
+
}
|
|
5399
|
+
},
|
|
5400
|
+
opts,
|
|
5401
|
+
cmd.args
|
|
5402
|
+
),
|
|
5403
|
+
"Failed to disable notifications."
|
|
5404
|
+
)
|
|
5405
|
+
);
|
|
5406
|
+
|
|
5319
5407
|
// src/commands/disable/teams.ts
|
|
5320
|
-
import { Command as
|
|
5321
|
-
var teams2 = new
|
|
5408
|
+
import { Command as Command36 } from "commander";
|
|
5409
|
+
var teams2 = new Command36("teams").description("disable teams").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5322
5410
|
(opts, cmd) => runCommand(
|
|
5323
5411
|
() => runDisable(
|
|
5324
5412
|
{
|
|
5325
5413
|
slug: "disable-teams",
|
|
5326
|
-
confirmMessage: "Disable teams? Drops teams, team_memberships, team_invites, and team_invite_links collections
|
|
5414
|
+
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.",
|
|
5327
5415
|
report: {
|
|
5328
5416
|
summary: "Disabled teams.",
|
|
5329
|
-
nextSteps: [
|
|
5330
|
-
"Manually revert the Teams nav item in app-sidebar and any team context loading in +layout.server.ts."
|
|
5331
|
-
],
|
|
5332
5417
|
task: {
|
|
5333
5418
|
title: "Disabling teams",
|
|
5334
5419
|
success: "Disabled teams",
|
|
@@ -5344,8 +5429,8 @@ var teams2 = new Command33("teams").description("disable teams").option("-y, --y
|
|
|
5344
5429
|
);
|
|
5345
5430
|
|
|
5346
5431
|
// src/commands/disable/payments.ts
|
|
5347
|
-
import { Command as
|
|
5348
|
-
var payments2 = new
|
|
5432
|
+
import { Command as Command37 } from "commander";
|
|
5433
|
+
var payments2 = new Command37("payments").description("disable payments").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5349
5434
|
(opts, cmd) => runCommand(
|
|
5350
5435
|
() => runDisable(
|
|
5351
5436
|
{
|
|
@@ -5372,11 +5457,11 @@ var payments2 = new Command34("payments").description("disable payments").option
|
|
|
5372
5457
|
);
|
|
5373
5458
|
|
|
5374
5459
|
// src/commands/disable/s3.ts
|
|
5375
|
-
import { Command as
|
|
5460
|
+
import { Command as Command38 } from "commander";
|
|
5376
5461
|
import * as p24 from "@clack/prompts";
|
|
5377
5462
|
import pc10 from "picocolors";
|
|
5378
5463
|
var s32 = addTargetOptions(
|
|
5379
|
-
new
|
|
5464
|
+
new Command38("s3").description("disable S3 file storage").option("--backups", "keep backups on the server again, rather than uploads").configureHelp(helpConfig),
|
|
5380
5465
|
"local"
|
|
5381
5466
|
).action(
|
|
5382
5467
|
(raw) => runCommand(() => {
|
|
@@ -5404,9 +5489,37 @@ function label2(filesystem) {
|
|
|
5404
5489
|
return filesystem === "backups" ? "backup storage" : "file storage";
|
|
5405
5490
|
}
|
|
5406
5491
|
|
|
5492
|
+
// src/commands/disable/subscriptions.ts
|
|
5493
|
+
import { Command as Command39 } from "commander";
|
|
5494
|
+
var subscriptions2 = new Command39("subscriptions").description("disable Stripe subscriptions").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
5495
|
+
(opts, cmd) => runCommand(
|
|
5496
|
+
() => runDisable(
|
|
5497
|
+
{
|
|
5498
|
+
slug: "disable-subscriptions",
|
|
5499
|
+
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.",
|
|
5500
|
+
report: {
|
|
5501
|
+
summary: "Disabled subscriptions.",
|
|
5502
|
+
nextSteps: [
|
|
5503
|
+
"Recurring prices in the Stripe dashboard are not deleted \u2014 archive them there if you no longer need them.",
|
|
5504
|
+
"One-time payments are untouched; run `vela disable payments` to remove Stripe entirely."
|
|
5505
|
+
],
|
|
5506
|
+
task: {
|
|
5507
|
+
title: "Disabling subscriptions",
|
|
5508
|
+
success: "Disabled subscriptions",
|
|
5509
|
+
error: "Failed to disable subscriptions"
|
|
5510
|
+
}
|
|
5511
|
+
}
|
|
5512
|
+
},
|
|
5513
|
+
opts,
|
|
5514
|
+
cmd.args
|
|
5515
|
+
),
|
|
5516
|
+
"Failed to disable subscriptions."
|
|
5517
|
+
)
|
|
5518
|
+
);
|
|
5519
|
+
|
|
5407
5520
|
// src/commands/disable/smtp.ts
|
|
5408
|
-
import { Command as
|
|
5409
|
-
var smtp2 = new
|
|
5521
|
+
import { Command as Command40 } from "commander";
|
|
5522
|
+
var smtp2 = new Command40("smtp").description("disable SMTP configuration").configureHelp(helpConfig).action(
|
|
5410
5523
|
() => runCommand(async () => {
|
|
5411
5524
|
const { workspaceRootDir } = await getWorkspace();
|
|
5412
5525
|
await withPocketbase(workspaceRootDir, async (pb) => {
|
|
@@ -5423,13 +5536,13 @@ var smtp2 = new Command36("smtp").description("disable SMTP configuration").conf
|
|
|
5423
5536
|
);
|
|
5424
5537
|
|
|
5425
5538
|
// src/commands/disable.ts
|
|
5426
|
-
var disable = new
|
|
5539
|
+
var disable = new Command41("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
5540
|
|
|
5428
5541
|
// src/commands/destroy.ts
|
|
5429
|
-
import { Command as
|
|
5542
|
+
import { Command as Command47 } from "commander";
|
|
5430
5543
|
|
|
5431
5544
|
// src/commands/destroy/form.ts
|
|
5432
|
-
import { Command as
|
|
5545
|
+
import { Command as Command42 } from "commander";
|
|
5433
5546
|
|
|
5434
5547
|
// src/commands/destroy/_shared.ts
|
|
5435
5548
|
import process20 from "node:process";
|
|
@@ -5446,7 +5559,7 @@ async function runDestroy(slug2, model, confirmMessage, report4, flags) {
|
|
|
5446
5559
|
}
|
|
5447
5560
|
|
|
5448
5561
|
// src/commands/destroy/form.ts
|
|
5449
|
-
var form2 = new
|
|
5562
|
+
var form2 = new Command42("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
5563
|
"--route <route>",
|
|
5451
5564
|
"custom route the form was generated at (must match the --route used at generation)"
|
|
5452
5565
|
).allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
@@ -5470,8 +5583,8 @@ var form2 = new Command38("form").description("destroy a form generated by `vela
|
|
|
5470
5583
|
);
|
|
5471
5584
|
|
|
5472
5585
|
// src/commands/destroy/schema.ts
|
|
5473
|
-
import { Command as
|
|
5474
|
-
var schema2 = new
|
|
5586
|
+
import { Command as Command43 } from "commander";
|
|
5587
|
+
var schema2 = new Command43("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
5588
|
(model, opts) => runCommand(
|
|
5476
5589
|
() => runDestroy(
|
|
5477
5590
|
"destroy-schema",
|
|
@@ -5492,8 +5605,8 @@ var schema2 = new Command39("schema").description("destroy a zod schema generate
|
|
|
5492
5605
|
);
|
|
5493
5606
|
|
|
5494
5607
|
// src/commands/destroy/resource.ts
|
|
5495
|
-
import { Command as
|
|
5496
|
-
var resource2 = new
|
|
5608
|
+
import { Command as Command44 } from "commander";
|
|
5609
|
+
var resource2 = new Command44("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
5610
|
(model, opts) => runCommand(
|
|
5498
5611
|
() => runDestroy(
|
|
5499
5612
|
"destroy-resource",
|
|
@@ -5514,8 +5627,8 @@ var resource2 = new Command40("resource").description("destroy a resource genera
|
|
|
5514
5627
|
);
|
|
5515
5628
|
|
|
5516
5629
|
// src/commands/destroy/scaffold.ts
|
|
5517
|
-
import { Command as
|
|
5518
|
-
var scaffold2 = new
|
|
5630
|
+
import { Command as Command45 } from "commander";
|
|
5631
|
+
var scaffold2 = new Command45("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
5632
|
"--route <route>",
|
|
5520
5633
|
"custom route the scaffold was generated at (must match the --route used at generation)"
|
|
5521
5634
|
).allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
@@ -5543,7 +5656,7 @@ var scaffold2 = new Command41("scaffold").description("destroy a scaffold genera
|
|
|
5543
5656
|
|
|
5544
5657
|
// src/commands/destroy/deployment.ts
|
|
5545
5658
|
import process21 from "node:process";
|
|
5546
|
-
import { Command as
|
|
5659
|
+
import { Command as Command46 } from "commander";
|
|
5547
5660
|
import * as p28 from "@clack/prompts";
|
|
5548
5661
|
import pc13 from "picocolors";
|
|
5549
5662
|
|
|
@@ -5709,7 +5822,7 @@ ${pc12.dim(err instanceof Error ? err.message : String(err))}`
|
|
|
5709
5822
|
// src/commands/destroy/deployment.ts
|
|
5710
5823
|
var deployment = addLockWaitOption(
|
|
5711
5824
|
addTargetOptions(
|
|
5712
|
-
new
|
|
5825
|
+
new Command46("deployment").description("remove a deployed environment from its server").configureHelp(helpConfig),
|
|
5713
5826
|
"production"
|
|
5714
5827
|
)
|
|
5715
5828
|
).option("--purge", "also delete the database and uploaded files").option("-y, --yes", "skip the confirmation prompt").option(
|
|
@@ -5788,13 +5901,13 @@ async function confirm8(appName, targetName, byName) {
|
|
|
5788
5901
|
}
|
|
5789
5902
|
|
|
5790
5903
|
// src/commands/destroy.ts
|
|
5791
|
-
var destroy = new
|
|
5904
|
+
var destroy = new Command47("destroy").description("destroy scaffolding, or a deployment").configureHelp(helpConfig).addCommand(form2).addCommand(schema2).addCommand(resource2).addCommand(scaffold2).addCommand(deployment);
|
|
5792
5905
|
|
|
5793
5906
|
// src/commands/ui.ts
|
|
5794
|
-
import { Command as
|
|
5907
|
+
import { Command as Command53 } from "commander";
|
|
5795
5908
|
|
|
5796
5909
|
// src/commands/ui/add.ts
|
|
5797
|
-
import { Command as
|
|
5910
|
+
import { Command as Command48 } from "commander";
|
|
5798
5911
|
import * as p29 from "@clack/prompts";
|
|
5799
5912
|
import { installComponents } from "@velastack/patterns";
|
|
5800
5913
|
|
|
@@ -5844,21 +5957,21 @@ function uiAddReport(requested, outcome) {
|
|
|
5844
5957
|
}
|
|
5845
5958
|
|
|
5846
5959
|
// src/commands/ui/add.ts
|
|
5847
|
-
var add = new
|
|
5960
|
+
var add = new Command48("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
5961
|
(components, options) => runCommand(async () => {
|
|
5849
5962
|
const { workspaceRootDir } = await getWorkspace();
|
|
5850
|
-
const
|
|
5963
|
+
const log49 = p29.taskLog({ title: "Adding UI components..." });
|
|
5851
5964
|
let outcome;
|
|
5852
5965
|
try {
|
|
5853
5966
|
outcome = await installComponents({
|
|
5854
5967
|
root: workspaceRootDir,
|
|
5855
5968
|
components,
|
|
5856
5969
|
overwrite: options.overwrite,
|
|
5857
|
-
logger: { info: (message) =>
|
|
5970
|
+
logger: { info: (message) => log49.message(message) }
|
|
5858
5971
|
});
|
|
5859
|
-
|
|
5972
|
+
log49.success("UI components ready");
|
|
5860
5973
|
} catch (e) {
|
|
5861
|
-
|
|
5974
|
+
log49.error("Could not add UI components");
|
|
5862
5975
|
throw e;
|
|
5863
5976
|
}
|
|
5864
5977
|
reportResult(uiAddReport(components, outcome));
|
|
@@ -5866,19 +5979,19 @@ var add = new Command44("add").description("add ui components (shadcn-svelte ite
|
|
|
5866
5979
|
);
|
|
5867
5980
|
|
|
5868
5981
|
// src/commands/ui/base.ts
|
|
5869
|
-
import { Command as
|
|
5982
|
+
import { Command as Command49 } from "commander";
|
|
5870
5983
|
import * as p30 from "@clack/prompts";
|
|
5871
5984
|
import { applyBaseColor } from "@velastack/patterns";
|
|
5872
|
-
var base = new
|
|
5985
|
+
var base = new Command49("base").description("change the base (gray) palette").argument("<color>", `base color to use (${BASE_COLORS.join(", ")})`).configureHelp(helpConfig).action(
|
|
5873
5986
|
(color) => runCommand(async () => {
|
|
5874
5987
|
const { workspaceRootDir } = await getWorkspace();
|
|
5875
|
-
const
|
|
5988
|
+
const log49 = p30.taskLog({ title: `Applying the ${color} palette...` });
|
|
5876
5989
|
let outcome;
|
|
5877
5990
|
try {
|
|
5878
5991
|
outcome = await applyBaseColor({ root: workspaceRootDir, color });
|
|
5879
|
-
|
|
5992
|
+
log49.success("Palette applied");
|
|
5880
5993
|
} catch (e) {
|
|
5881
|
-
|
|
5994
|
+
log49.error("Could not change the base color");
|
|
5882
5995
|
throw e;
|
|
5883
5996
|
}
|
|
5884
5997
|
reportResult({
|
|
@@ -5894,7 +6007,7 @@ var base = new Command45("base").description("change the base (gray) palette").a
|
|
|
5894
6007
|
);
|
|
5895
6008
|
|
|
5896
6009
|
// src/commands/ui/list.ts
|
|
5897
|
-
import { Command as
|
|
6010
|
+
import { Command as Command50 } from "commander";
|
|
5898
6011
|
import * as p31 from "@clack/prompts";
|
|
5899
6012
|
import { listComponents } from "@velastack/patterns";
|
|
5900
6013
|
|
|
@@ -5926,7 +6039,7 @@ function uiListReport(result) {
|
|
|
5926
6039
|
}
|
|
5927
6040
|
|
|
5928
6041
|
// src/commands/ui/list.ts
|
|
5929
|
-
var list = new
|
|
6042
|
+
var list = new Command50("list").description("list installed ui components, vela components and the style registry").option("--json", "print the result as JSON", false).configureHelp(helpConfig).action(
|
|
5930
6043
|
(options) => runCommand(async () => {
|
|
5931
6044
|
const { workspaceRootDir } = await getWorkspace();
|
|
5932
6045
|
if (options.json) {
|
|
@@ -5934,16 +6047,16 @@ var list = new Command46("list").description("list installed ui components, vela
|
|
|
5934
6047
|
console.log(JSON.stringify(result2, null, 2));
|
|
5935
6048
|
return;
|
|
5936
6049
|
}
|
|
5937
|
-
const
|
|
5938
|
-
|
|
6050
|
+
const spinner8 = p31.spinner();
|
|
6051
|
+
spinner8.start("Reading the registry...");
|
|
5939
6052
|
let result;
|
|
5940
6053
|
try {
|
|
5941
6054
|
result = await listComponents({ root: workspaceRootDir });
|
|
5942
6055
|
} catch (e) {
|
|
5943
|
-
|
|
6056
|
+
spinner8.stop("Could not list UI components");
|
|
5944
6057
|
throw e;
|
|
5945
6058
|
}
|
|
5946
|
-
|
|
6059
|
+
spinner8.stop(`Read the ${result.style} registry`);
|
|
5947
6060
|
reportResult(uiListReport(result));
|
|
5948
6061
|
if (result.registryUnavailable) {
|
|
5949
6062
|
p31.log.warn(`${result.registryUnavailable}
|
|
@@ -5953,7 +6066,7 @@ Registry components are not listed.`);
|
|
|
5953
6066
|
);
|
|
5954
6067
|
|
|
5955
6068
|
// src/commands/ui/style.ts
|
|
5956
|
-
import { Command as
|
|
6069
|
+
import { Command as Command51 } from "commander";
|
|
5957
6070
|
import * as p32 from "@clack/prompts";
|
|
5958
6071
|
import { switchStyle } from "@velastack/patterns";
|
|
5959
6072
|
|
|
@@ -5980,21 +6093,21 @@ function uiStyleReport(result) {
|
|
|
5980
6093
|
}
|
|
5981
6094
|
|
|
5982
6095
|
// src/commands/ui/style.ts
|
|
5983
|
-
var style = new
|
|
6096
|
+
var style = new Command51("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
6097
|
(name, options) => runCommand(async () => {
|
|
5985
6098
|
const { workspaceRootDir } = await getWorkspace();
|
|
5986
|
-
const
|
|
5987
|
-
|
|
5988
|
-
let
|
|
6099
|
+
const spinner8 = p32.spinner();
|
|
6100
|
+
spinner8.start(`Reading the ${name} registry...`);
|
|
6101
|
+
let log49;
|
|
5989
6102
|
let outcome;
|
|
5990
6103
|
try {
|
|
5991
6104
|
outcome = await switchStyle({
|
|
5992
6105
|
root: workspaceRootDir,
|
|
5993
6106
|
style: name,
|
|
5994
6107
|
font: options.font,
|
|
5995
|
-
logger: { info: (message) =>
|
|
6108
|
+
logger: { info: (message) => log49?.message(message) },
|
|
5996
6109
|
confirm: async (components) => {
|
|
5997
|
-
|
|
6110
|
+
spinner8.stop(`Read the ${name} registry`);
|
|
5998
6111
|
if (components.length > 0) {
|
|
5999
6112
|
p32.log.info(
|
|
6000
6113
|
`Re-adds ${components.length} component(s) from the ${name} registry; local edits to their files are lost:
|
|
@@ -6009,16 +6122,16 @@ ${components.map((c) => `- ${c}`).join("\n")}`
|
|
|
6009
6122
|
const ok = await p32.confirm({ message: `Switch to ${name}?`, initialValue: false });
|
|
6010
6123
|
if (p32.isCancel(ok) || !ok) return false;
|
|
6011
6124
|
}
|
|
6012
|
-
|
|
6125
|
+
log49 = p32.taskLog({ title: `Switching to the ${name} style...` });
|
|
6013
6126
|
return true;
|
|
6014
6127
|
}
|
|
6015
6128
|
});
|
|
6016
6129
|
} catch (e) {
|
|
6017
|
-
|
|
6018
|
-
|
|
6130
|
+
spinner8.stop(`Could not switch to ${name}`);
|
|
6131
|
+
log49?.error("Could not switch style");
|
|
6019
6132
|
throw e;
|
|
6020
6133
|
}
|
|
6021
|
-
|
|
6134
|
+
spinner8.stop(`Read the ${name} registry`);
|
|
6022
6135
|
if (outcome.status === "unchanged") {
|
|
6023
6136
|
p32.log.info(`Already using the ${name} style.`);
|
|
6024
6137
|
return;
|
|
@@ -6027,25 +6140,25 @@ ${components.map((c) => `- ${c}`).join("\n")}`
|
|
|
6027
6140
|
p32.cancel("Operation cancelled.");
|
|
6028
6141
|
return;
|
|
6029
6142
|
}
|
|
6030
|
-
|
|
6143
|
+
log49?.success("Style switched");
|
|
6031
6144
|
reportResult(uiStyleReport(outcome));
|
|
6032
6145
|
}, "Failed to switch style.")
|
|
6033
6146
|
);
|
|
6034
6147
|
|
|
6035
6148
|
// src/commands/ui/theme.ts
|
|
6036
|
-
import { Command as
|
|
6149
|
+
import { Command as Command52 } from "commander";
|
|
6037
6150
|
import * as p33 from "@clack/prompts";
|
|
6038
6151
|
import { applyTheme } from "@velastack/patterns";
|
|
6039
|
-
var theme = new
|
|
6152
|
+
var theme = new Command52("theme").description("change the accent color, keeping the base palette").argument("<accent>", `accent to use (${THEMES.join(", ")})`).configureHelp(helpConfig).action(
|
|
6040
6153
|
(accent) => runCommand(async () => {
|
|
6041
6154
|
const { workspaceRootDir } = await getWorkspace();
|
|
6042
|
-
const
|
|
6155
|
+
const log49 = p33.taskLog({ title: `Applying the ${accent} accent...` });
|
|
6043
6156
|
let outcome;
|
|
6044
6157
|
try {
|
|
6045
6158
|
outcome = await applyTheme({ root: workspaceRootDir, theme: accent });
|
|
6046
|
-
|
|
6159
|
+
log49.success("Accent applied");
|
|
6047
6160
|
} catch (e) {
|
|
6048
|
-
|
|
6161
|
+
log49.error("Could not change the accent");
|
|
6049
6162
|
throw e;
|
|
6050
6163
|
}
|
|
6051
6164
|
reportResult({
|
|
@@ -6061,15 +6174,15 @@ var theme = new Command48("theme").description("change the accent color, keeping
|
|
|
6061
6174
|
);
|
|
6062
6175
|
|
|
6063
6176
|
// src/commands/ui.ts
|
|
6064
|
-
var ui = new
|
|
6177
|
+
var ui = new Command53("ui").description("generate ui components").configureHelp(helpConfig).addCommand(add).addCommand(list).addCommand(style).addCommand(base).addCommand(theme);
|
|
6065
6178
|
|
|
6066
6179
|
// src/commands/legal.ts
|
|
6067
|
-
import { Command as
|
|
6180
|
+
import { Command as Command56 } from "commander";
|
|
6068
6181
|
|
|
6069
6182
|
// src/commands/legal/terms.ts
|
|
6070
6183
|
import fs26 from "node:fs";
|
|
6071
6184
|
import path23 from "node:path";
|
|
6072
|
-
import { Command as
|
|
6185
|
+
import { Command as Command54 } from "commander";
|
|
6073
6186
|
import * as p35 from "@clack/prompts";
|
|
6074
6187
|
|
|
6075
6188
|
// src/commands/legal/shared.ts
|
|
@@ -6655,16 +6768,16 @@ async function termsAction() {
|
|
|
6655
6768
|
]
|
|
6656
6769
|
});
|
|
6657
6770
|
if (p35.isCancel(canBuyGoods)) onCancel();
|
|
6658
|
-
const
|
|
6771
|
+
const subscriptions3 = await p35.select({
|
|
6659
6772
|
message: "Do you offer subscription plans?",
|
|
6660
6773
|
options: [
|
|
6661
6774
|
{ value: "yes", label: "Yes, we offer subscription plans" },
|
|
6662
6775
|
{ value: "no", label: "No" }
|
|
6663
6776
|
]
|
|
6664
6777
|
});
|
|
6665
|
-
if (p35.isCancel(
|
|
6778
|
+
if (p35.isCancel(subscriptions3)) onCancel();
|
|
6666
6779
|
let freeTrial;
|
|
6667
|
-
if (
|
|
6780
|
+
if (subscriptions3 === "yes") {
|
|
6668
6781
|
const ft = await p35.select({
|
|
6669
6782
|
message: "Do you offer a free trial?",
|
|
6670
6783
|
options: [
|
|
@@ -6719,7 +6832,7 @@ async function termsAction() {
|
|
|
6719
6832
|
userContent,
|
|
6720
6833
|
infringementEmail,
|
|
6721
6834
|
canBuyGoods,
|
|
6722
|
-
subscriptions:
|
|
6835
|
+
subscriptions: subscriptions3,
|
|
6723
6836
|
freeTrial,
|
|
6724
6837
|
exclusiveContent,
|
|
6725
6838
|
feedbackReuse,
|
|
@@ -6753,12 +6866,12 @@ async function termsAction() {
|
|
|
6753
6866
|
]
|
|
6754
6867
|
});
|
|
6755
6868
|
}
|
|
6756
|
-
var terms = new
|
|
6869
|
+
var terms = new Command54("terms").description("generate placeholder terms and conditions").configureHelp(helpConfig).action(() => runCommand(termsAction, "Failed to generate terms and conditions."));
|
|
6757
6870
|
|
|
6758
6871
|
// src/commands/legal/privacy.ts
|
|
6759
6872
|
import fs27 from "node:fs";
|
|
6760
6873
|
import path24 from "node:path";
|
|
6761
|
-
import { Command as
|
|
6874
|
+
import { Command as Command55 } from "commander";
|
|
6762
6875
|
import * as p36 from "@clack/prompts";
|
|
6763
6876
|
var mapLabels = {
|
|
6764
6877
|
personalInfo: {
|
|
@@ -7502,16 +7615,16 @@ async function privacyAction() {
|
|
|
7502
7615
|
]
|
|
7503
7616
|
});
|
|
7504
7617
|
}
|
|
7505
|
-
var privacy = new
|
|
7618
|
+
var privacy = new Command55("privacy").description("generate placeholder privacy policy").configureHelp(helpConfig).action(() => runCommand(privacyAction, "Failed to generate privacy policy."));
|
|
7506
7619
|
|
|
7507
7620
|
// src/commands/legal.ts
|
|
7508
|
-
var legal = new
|
|
7621
|
+
var legal = new Command56("legal").description("generate placeholder legal documents").configureHelp(helpConfig).addCommand(terms).addCommand(privacy);
|
|
7509
7622
|
|
|
7510
7623
|
// src/commands/fixtures.ts
|
|
7511
|
-
import { Command as
|
|
7624
|
+
import { Command as Command62 } from "commander";
|
|
7512
7625
|
|
|
7513
7626
|
// src/commands/fixtures/load.ts
|
|
7514
|
-
import { Command as
|
|
7627
|
+
import { Command as Command57 } from "commander";
|
|
7515
7628
|
|
|
7516
7629
|
// src/lib/data.ts
|
|
7517
7630
|
import fs28 from "node:fs";
|
|
@@ -7701,7 +7814,7 @@ async function hasLoadedFixtures(pb) {
|
|
|
7701
7814
|
}
|
|
7702
7815
|
|
|
7703
7816
|
// src/commands/fixtures/load.ts
|
|
7704
|
-
var load = new
|
|
7817
|
+
var load = new Command57("load").description("load fixtures into the database").configureHelp(helpConfig).action(
|
|
7705
7818
|
() => runCommand(async () => {
|
|
7706
7819
|
const { workspaceRootDir } = await getWorkspace();
|
|
7707
7820
|
let loaded = [];
|
|
@@ -7727,8 +7840,8 @@ var load = new Command53("load").description("load fixtures into the database").
|
|
|
7727
7840
|
);
|
|
7728
7841
|
|
|
7729
7842
|
// src/commands/fixtures/clear.ts
|
|
7730
|
-
import { Command as
|
|
7731
|
-
var clear = new
|
|
7843
|
+
import { Command as Command58 } from "commander";
|
|
7844
|
+
var clear = new Command58("clear").description("clear loaded fixtures").configureHelp(helpConfig).action(
|
|
7732
7845
|
() => runCommand(async () => {
|
|
7733
7846
|
const { workspaceRootDir } = await getWorkspace();
|
|
7734
7847
|
let cleared = [];
|
|
@@ -7757,8 +7870,8 @@ var clear = new Command54("clear").description("clear loaded fixtures").configur
|
|
|
7757
7870
|
);
|
|
7758
7871
|
|
|
7759
7872
|
// src/commands/fixtures/reset.ts
|
|
7760
|
-
import { Command as
|
|
7761
|
-
var reset = new
|
|
7873
|
+
import { Command as Command59 } from "commander";
|
|
7874
|
+
var reset = new Command59("reset").description("clear and reload fixtures").configureHelp(helpConfig).action(
|
|
7762
7875
|
() => runCommand(async () => {
|
|
7763
7876
|
const { workspaceRootDir } = await getWorkspace();
|
|
7764
7877
|
let cleared = [];
|
|
@@ -7790,7 +7903,7 @@ var reset = new Command55("reset").description("clear and reload fixtures").conf
|
|
|
7790
7903
|
// src/commands/fixtures/generate.ts
|
|
7791
7904
|
import fs29 from "node:fs";
|
|
7792
7905
|
import path26 from "node:path";
|
|
7793
|
-
import { Command as
|
|
7906
|
+
import { Command as Command60, InvalidArgumentError } from "commander";
|
|
7794
7907
|
import * as p37 from "@clack/prompts";
|
|
7795
7908
|
import { annotate } from "annotate-json-schema";
|
|
7796
7909
|
import { createGenerator } from "json-schema-faker";
|
|
@@ -7901,7 +8014,7 @@ async function generateFixtureFiles(pb, workspaceRootDir, opts) {
|
|
|
7901
8014
|
}
|
|
7902
8015
|
return { writtenFiles, warnings };
|
|
7903
8016
|
}
|
|
7904
|
-
var generate2 = new
|
|
8017
|
+
var generate2 = new Command60("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
8018
|
(opts) => runCommand(async () => {
|
|
7906
8019
|
const { workspaceRootDir } = await getWorkspace();
|
|
7907
8020
|
const existing = getFixtureFiles(workspaceRootDir);
|
|
@@ -7954,7 +8067,7 @@ var generate2 = new Command56("generate").description("generate fixture data").o
|
|
|
7954
8067
|
);
|
|
7955
8068
|
|
|
7956
8069
|
// src/commands/fixtures/regen.ts
|
|
7957
|
-
import { Command as
|
|
8070
|
+
import { Command as Command61, InvalidArgumentError as InvalidArgumentError2 } from "commander";
|
|
7958
8071
|
import * as p38 from "@clack/prompts";
|
|
7959
8072
|
function parseCount2(value) {
|
|
7960
8073
|
const n = parseInt(value, 10);
|
|
@@ -7970,7 +8083,7 @@ function parseSeed2(value) {
|
|
|
7970
8083
|
}
|
|
7971
8084
|
return n;
|
|
7972
8085
|
}
|
|
7973
|
-
var regen = new
|
|
8086
|
+
var regen = new Command61("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
8087
|
(opts) => runCommand(async () => {
|
|
7975
8088
|
const { workspaceRootDir } = await getWorkspace();
|
|
7976
8089
|
let cleared = [];
|
|
@@ -7999,14 +8112,14 @@ var regen = new Command57("regen").description("clear the database, regenerate f
|
|
|
7999
8112
|
);
|
|
8000
8113
|
|
|
8001
8114
|
// src/commands/fixtures.ts
|
|
8002
|
-
var fixtures = new
|
|
8115
|
+
var fixtures = new Command62("fixtures").description("manage fixture data").configureHelp(helpConfig).addCommand(generate2).addCommand(load).addCommand(clear).addCommand(reset).addCommand(regen);
|
|
8003
8116
|
|
|
8004
8117
|
// src/commands/seeds.ts
|
|
8005
|
-
import { Command as
|
|
8118
|
+
import { Command as Command66 } from "commander";
|
|
8006
8119
|
|
|
8007
8120
|
// src/commands/seeds/load.ts
|
|
8008
|
-
import { Command as
|
|
8009
|
-
var load2 = new
|
|
8121
|
+
import { Command as Command63 } from "commander";
|
|
8122
|
+
var load2 = new Command63("load").description("load seeds into the database").option("-f, --force", "load even if target collections already have records").configureHelp(helpConfig).action(
|
|
8010
8123
|
(opts) => runCommand(async () => {
|
|
8011
8124
|
const { workspaceRootDir } = await getWorkspace();
|
|
8012
8125
|
const seedFiles = getSeedFiles(workspaceRootDir);
|
|
@@ -8045,7 +8158,7 @@ var load2 = new Command59("load").description("load seeds into the database").op
|
|
|
8045
8158
|
// src/commands/seeds/save.ts
|
|
8046
8159
|
import fs30 from "node:fs";
|
|
8047
8160
|
import path27 from "node:path";
|
|
8048
|
-
import { Command as
|
|
8161
|
+
import { Command as Command64 } from "commander";
|
|
8049
8162
|
var padZeros2 = (num, length) => num.toString().padStart(length, "0");
|
|
8050
8163
|
function filterSystemFields(record, systemFieldNames) {
|
|
8051
8164
|
const out = {};
|
|
@@ -8056,7 +8169,7 @@ function filterSystemFields(record, systemFieldNames) {
|
|
|
8056
8169
|
}
|
|
8057
8170
|
return out;
|
|
8058
8171
|
}
|
|
8059
|
-
var save = new
|
|
8172
|
+
var save = new Command64("save").description("save the current data as seeds").option("-f, --force", "overwrite existing seed files").configureHelp(helpConfig).action(
|
|
8060
8173
|
(opts) => runCommand(async () => {
|
|
8061
8174
|
const { workspaceRootDir } = await getWorkspace();
|
|
8062
8175
|
const seedsPath = dataDir(workspaceRootDir, "seeds");
|
|
@@ -8128,8 +8241,8 @@ var save = new Command60("save").description("save the current data as seeds").o
|
|
|
8128
8241
|
);
|
|
8129
8242
|
|
|
8130
8243
|
// src/commands/seeds/clear.ts
|
|
8131
|
-
import { Command as
|
|
8132
|
-
var clear2 = new
|
|
8244
|
+
import { Command as Command65 } from "commander";
|
|
8245
|
+
var clear2 = new Command65("clear").description("clear seeded records").configureHelp(helpConfig).action(
|
|
8133
8246
|
() => runCommand(async () => {
|
|
8134
8247
|
const { workspaceRootDir } = await getWorkspace();
|
|
8135
8248
|
const seedFiles = getSeedFiles(workspaceRootDir);
|
|
@@ -8160,13 +8273,13 @@ var clear2 = new Command61("clear").description("clear seeded records").configur
|
|
|
8160
8273
|
);
|
|
8161
8274
|
|
|
8162
8275
|
// src/commands/seeds.ts
|
|
8163
|
-
var seeds = new
|
|
8276
|
+
var seeds = new Command66("seeds").description("manage seed data").configureHelp(helpConfig).addCommand(load2).addCommand(save).addCommand(clear2);
|
|
8164
8277
|
|
|
8165
8278
|
// src/commands/signup.ts
|
|
8166
|
-
import { Command as
|
|
8279
|
+
import { Command as Command67 } from "commander";
|
|
8167
8280
|
import * as p39 from "@clack/prompts";
|
|
8168
8281
|
import makeFetchCookie2 from "fetch-cookie";
|
|
8169
|
-
var signup = new
|
|
8282
|
+
var signup = new Command67("signup").description("signup to velastack.dev").configureHelp(helpConfig).action(
|
|
8170
8283
|
() => runCommand(async () => {
|
|
8171
8284
|
const { email: email3, password: password11, passwordConfirm } = await p39.group({
|
|
8172
8285
|
email: () => p39.text({ message: "Email" }),
|
|
@@ -8201,9 +8314,9 @@ var signup = new Command63("signup").description("signup to velastack.dev").conf
|
|
|
8201
8314
|
);
|
|
8202
8315
|
|
|
8203
8316
|
// src/commands/logout.ts
|
|
8204
|
-
import { Command as
|
|
8317
|
+
import { Command as Command68 } from "commander";
|
|
8205
8318
|
import * as p40 from "@clack/prompts";
|
|
8206
|
-
var logout = new
|
|
8319
|
+
var logout = new Command68("logout").alias("signout").description("logout from velastack.dev").configureHelp(helpConfig).action(
|
|
8207
8320
|
() => runCommand(() => {
|
|
8208
8321
|
if (!readConfig()) {
|
|
8209
8322
|
p40.log.info("Not logged in");
|
|
@@ -8215,9 +8328,9 @@ var logout = new Command64("logout").alias("signout").description("logout from v
|
|
|
8215
8328
|
);
|
|
8216
8329
|
|
|
8217
8330
|
// src/commands/whoami.ts
|
|
8218
|
-
import { Command as
|
|
8331
|
+
import { Command as Command69 } from "commander";
|
|
8219
8332
|
import * as p41 from "@clack/prompts";
|
|
8220
|
-
var whoami = new
|
|
8333
|
+
var whoami = new Command69("whoami").description("show the current user").configureHelp(helpConfig).action(
|
|
8221
8334
|
() => runCommand(async () => {
|
|
8222
8335
|
const apiKey = readConfig()?.apiKey;
|
|
8223
8336
|
if (!apiKey) {
|
|
@@ -8234,10 +8347,10 @@ var whoami = new Command65("whoami").description("show the current user").config
|
|
|
8234
8347
|
);
|
|
8235
8348
|
|
|
8236
8349
|
// src/commands/migrate.ts
|
|
8237
|
-
import { Command as
|
|
8350
|
+
import { Command as Command75 } from "commander";
|
|
8238
8351
|
|
|
8239
8352
|
// src/commands/migrate/up.ts
|
|
8240
|
-
import { Command as
|
|
8353
|
+
import { Command as Command70 } from "commander";
|
|
8241
8354
|
|
|
8242
8355
|
// src/lib/migrate.ts
|
|
8243
8356
|
import path28 from "node:path";
|
|
@@ -8276,10 +8389,10 @@ async function runMigrateUp() {
|
|
|
8276
8389
|
]
|
|
8277
8390
|
});
|
|
8278
8391
|
}
|
|
8279
|
-
var up = new
|
|
8392
|
+
var up = new Command70("up").description("apply all pending migrations").configureHelp(helpConfig).action(() => runCommand(runMigrateUp, "Failed to run migrations."));
|
|
8280
8393
|
|
|
8281
8394
|
// src/commands/migrate/down.ts
|
|
8282
|
-
import { Command as
|
|
8395
|
+
import { Command as Command71, InvalidArgumentError as InvalidArgumentError3 } from "commander";
|
|
8283
8396
|
function parseSteps(value) {
|
|
8284
8397
|
const n = parseInt(value, 10);
|
|
8285
8398
|
if (!Number.isFinite(n) || n <= 0) {
|
|
@@ -8287,7 +8400,7 @@ function parseSteps(value) {
|
|
|
8287
8400
|
}
|
|
8288
8401
|
return n;
|
|
8289
8402
|
}
|
|
8290
|
-
var down = new
|
|
8403
|
+
var down = new Command71("down").alias("rollback").description("revert the last N applied migrations").argument("[number]", "how many migrations to revert", parseSteps, 1).configureHelp(helpConfig).action(
|
|
8291
8404
|
(n) => runCommand(async () => {
|
|
8292
8405
|
await runPocketbaseMigrate(["down", String(n)]);
|
|
8293
8406
|
reportResult({
|
|
@@ -8304,8 +8417,8 @@ var down = new Command67("down").alias("rollback").description("revert the last
|
|
|
8304
8417
|
import fs31 from "node:fs";
|
|
8305
8418
|
import path29 from "node:path";
|
|
8306
8419
|
import process24 from "node:process";
|
|
8307
|
-
import { Command as
|
|
8308
|
-
var create2 = new
|
|
8420
|
+
import { Command as Command72 } from "commander";
|
|
8421
|
+
var create2 = new Command72("create").alias("new").description("create a new blank migration").argument("<name>", "migration name (snake_case)").configureHelp(helpConfig).action(
|
|
8309
8422
|
(name) => runCommand(async () => {
|
|
8310
8423
|
const cwd = process24.cwd();
|
|
8311
8424
|
const before = listMigrationFiles(cwd);
|
|
@@ -8332,8 +8445,8 @@ function listMigrationFiles(cwd) {
|
|
|
8332
8445
|
import fs32 from "node:fs";
|
|
8333
8446
|
import path30 from "node:path";
|
|
8334
8447
|
import process25 from "node:process";
|
|
8335
|
-
import { Command as
|
|
8336
|
-
var collections = new
|
|
8448
|
+
import { Command as Command73 } from "commander";
|
|
8449
|
+
var collections = new Command73("collections").alias("snapshot").description("snapshot local collections into a new migration").configureHelp(helpConfig).action(
|
|
8337
8450
|
() => runCommand(async () => {
|
|
8338
8451
|
const cwd = process25.cwd();
|
|
8339
8452
|
const before = listMigrationFiles2(cwd);
|
|
@@ -8364,8 +8477,8 @@ function listMigrationFiles2(cwd) {
|
|
|
8364
8477
|
}
|
|
8365
8478
|
|
|
8366
8479
|
// src/commands/migrate/history-sync.ts
|
|
8367
|
-
import { Command as
|
|
8368
|
-
var historySync = new
|
|
8480
|
+
import { Command as Command74 } from "commander";
|
|
8481
|
+
var historySync = new Command74("history-sync").description("drop _migrations rows whose files no longer exist").configureHelp(helpConfig).action(
|
|
8369
8482
|
() => runCommand(async () => {
|
|
8370
8483
|
await runPocketbaseMigrate(["history-sync"]);
|
|
8371
8484
|
reportResult({
|
|
@@ -8376,14 +8489,14 @@ var historySync = new Command70("history-sync").description("drop _migrations ro
|
|
|
8376
8489
|
);
|
|
8377
8490
|
|
|
8378
8491
|
// src/commands/migrate.ts
|
|
8379
|
-
var migrate = new
|
|
8492
|
+
var migrate = new Command75("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
8493
|
|
|
8381
8494
|
// src/commands/dev.ts
|
|
8382
8495
|
import fs33 from "node:fs";
|
|
8383
8496
|
import path32 from "node:path";
|
|
8384
8497
|
import process27 from "node:process";
|
|
8385
8498
|
import { performance } from "node:perf_hooks";
|
|
8386
|
-
import { Command as
|
|
8499
|
+
import { Command as Command76, InvalidArgumentError as InvalidArgumentError4 } from "commander";
|
|
8387
8500
|
import pc15 from "picocolors";
|
|
8388
8501
|
import PocketBase4 from "pocketbase";
|
|
8389
8502
|
|
|
@@ -8432,7 +8545,7 @@ function parsePort(value) {
|
|
|
8432
8545
|
}
|
|
8433
8546
|
return port;
|
|
8434
8547
|
}
|
|
8435
|
-
var dev = new
|
|
8548
|
+
var dev = new Command76("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
8549
|
const cwd = process27.cwd();
|
|
8437
8550
|
process27.env.VELA_DATA_DIR ??= localDataDir(cwd);
|
|
8438
8551
|
const startTime = performance.now();
|
|
@@ -8541,7 +8654,7 @@ async function startWatchingTypes(cwd, pb) {
|
|
|
8541
8654
|
import fs34 from "node:fs";
|
|
8542
8655
|
import path33 from "node:path";
|
|
8543
8656
|
import process29 from "node:process";
|
|
8544
|
-
import { Command as
|
|
8657
|
+
import { Command as Command77 } from "commander";
|
|
8545
8658
|
import * as p42 from "@clack/prompts";
|
|
8546
8659
|
import pc16 from "picocolors";
|
|
8547
8660
|
import { x as x3 } from "tinyexec";
|
|
@@ -8578,7 +8691,7 @@ function splitHosts(value) {
|
|
|
8578
8691
|
|
|
8579
8692
|
// src/commands/build.ts
|
|
8580
8693
|
var PRERENDERED_DIR = path33.join(".svelte-kit", "output", "prerendered");
|
|
8581
|
-
var build = new
|
|
8694
|
+
var build = new Command77("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
8695
|
const cwd = process29.cwd();
|
|
8583
8696
|
applyBuildEnv(cwd);
|
|
8584
8697
|
const origin = await originForBuild(cwd, options.target);
|
|
@@ -8646,11 +8759,11 @@ Set one with ${pc16.cyan("vela deploy --domain example.com")}, or pass ${pc16.cy
|
|
|
8646
8759
|
// src/commands/preview.ts
|
|
8647
8760
|
import path34 from "node:path";
|
|
8648
8761
|
import process30 from "node:process";
|
|
8649
|
-
import { Command as
|
|
8762
|
+
import { Command as Command78 } from "commander";
|
|
8650
8763
|
import { x as x4 } from "tinyexec";
|
|
8651
8764
|
import { detect as detect6 } from "package-manager-detector";
|
|
8652
8765
|
import { resolveCommand as resolveCommand6 } from "package-manager-detector/commands";
|
|
8653
|
-
var preview = new
|
|
8766
|
+
var preview = new Command78("preview").description("preview the built app").configureHelp(helpConfig).action(async () => {
|
|
8654
8767
|
const cwd = process30.cwd();
|
|
8655
8768
|
process30.env.VELA_DATA_DIR ??= localDataDir(cwd);
|
|
8656
8769
|
let pbProc;
|
|
@@ -8690,8 +8803,8 @@ var preview = new Command74("preview").description("preview the built app").conf
|
|
|
8690
8803
|
|
|
8691
8804
|
// src/commands/sync.ts
|
|
8692
8805
|
import path35 from "node:path";
|
|
8693
|
-
import { Command as
|
|
8694
|
-
var sync = new
|
|
8806
|
+
import { Command as Command79 } from "commander";
|
|
8807
|
+
var sync = new Command79("sync").description("sync types from the database").configureHelp(helpConfig).action(
|
|
8695
8808
|
() => runCommand(async () => {
|
|
8696
8809
|
const { workspaceRootDir } = await getWorkspace();
|
|
8697
8810
|
const typesDir = path35.join(workspaceRootDir, ".svelte-kit", "types");
|
|
@@ -8704,7 +8817,7 @@ var sync = new Command75("sync").description("sync types from the database").con
|
|
|
8704
8817
|
);
|
|
8705
8818
|
|
|
8706
8819
|
// src/commands/provision.ts
|
|
8707
|
-
import { Command as
|
|
8820
|
+
import { Command as Command80 } from "commander";
|
|
8708
8821
|
import * as p43 from "@clack/prompts";
|
|
8709
8822
|
import pc17 from "picocolors";
|
|
8710
8823
|
import * as v7 from "valibot";
|
|
@@ -8714,7 +8827,7 @@ var OptionsSchema2 = v7.object({
|
|
|
8714
8827
|
nodeMajor: v7.optional(v7.string())
|
|
8715
8828
|
});
|
|
8716
8829
|
var provision = addSshOptions(
|
|
8717
|
-
new
|
|
8830
|
+
new Command80("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
8831
|
).option("--pb-version <version>", "PocketBase version to install").option("--node-major <version>", "Node.js major version to install", "22").action(
|
|
8719
8832
|
(target, raw) => runCommand(async () => {
|
|
8720
8833
|
const options = parseOptions(OptionsSchema2, raw);
|
|
@@ -8758,7 +8871,7 @@ var provision = addSshOptions(
|
|
|
8758
8871
|
// src/commands/deploy.ts
|
|
8759
8872
|
import path38 from "node:path";
|
|
8760
8873
|
import fs37 from "node:fs";
|
|
8761
|
-
import { Command as
|
|
8874
|
+
import { Command as Command81, Option as Option2 } from "commander";
|
|
8762
8875
|
import * as p44 from "@clack/prompts";
|
|
8763
8876
|
import pc18 from "picocolors";
|
|
8764
8877
|
import * as v8 from "valibot";
|
|
@@ -9102,7 +9215,7 @@ var OptionsSchema3 = v8.object({
|
|
|
9102
9215
|
});
|
|
9103
9216
|
var deploy = addLockWaitOption(
|
|
9104
9217
|
addTargetOptions(
|
|
9105
|
-
new
|
|
9218
|
+
new Command81("deploy").description("deploy the app").configureHelp(helpConfig),
|
|
9106
9219
|
"production"
|
|
9107
9220
|
)
|
|
9108
9221
|
).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 +9582,10 @@ async function serverTimeOrLocal(session) {
|
|
|
9469
9582
|
// src/commands/link.ts
|
|
9470
9583
|
import path39 from "node:path";
|
|
9471
9584
|
import process32 from "node:process";
|
|
9472
|
-
import { Command as
|
|
9585
|
+
import { Command as Command82 } from "commander";
|
|
9473
9586
|
import * as p45 from "@clack/prompts";
|
|
9474
9587
|
var CREATE_NEW = "__new__";
|
|
9475
|
-
var link = new
|
|
9588
|
+
var link = new Command82("link").description("link this project to a velastack.dev project").configureHelp(helpConfig).action(() => runCommand(linkProject, "Failed to link the project."));
|
|
9476
9589
|
async function linkProject() {
|
|
9477
9590
|
const { workspaceRootDir } = await getWorkspace();
|
|
9478
9591
|
const existing = readProjectConfig(workspaceRootDir);
|
|
@@ -9539,14 +9652,14 @@ function defaultProjectName2(workspaceRootDir) {
|
|
|
9539
9652
|
}
|
|
9540
9653
|
|
|
9541
9654
|
// src/commands/env.ts
|
|
9542
|
-
import { Command as
|
|
9655
|
+
import { Command as Command87 } from "commander";
|
|
9543
9656
|
|
|
9544
9657
|
// src/commands/env/list.ts
|
|
9545
|
-
import { Command as
|
|
9658
|
+
import { Command as Command83 } from "commander";
|
|
9546
9659
|
import * as p46 from "@clack/prompts";
|
|
9547
9660
|
import pc19 from "picocolors";
|
|
9548
9661
|
var envList = addTargetOptions(
|
|
9549
|
-
new
|
|
9662
|
+
new Command83("list").description("list environment variable names").configureHelp(helpConfig),
|
|
9550
9663
|
"local"
|
|
9551
9664
|
).action(
|
|
9552
9665
|
(raw) => runCommand(
|
|
@@ -9580,11 +9693,11 @@ function report(keys, where) {
|
|
|
9580
9693
|
|
|
9581
9694
|
// src/commands/env/set.ts
|
|
9582
9695
|
import process33 from "node:process";
|
|
9583
|
-
import { Command as
|
|
9696
|
+
import { Command as Command84 } from "commander";
|
|
9584
9697
|
import * as p47 from "@clack/prompts";
|
|
9585
9698
|
import pc20 from "picocolors";
|
|
9586
9699
|
var envSet = addTargetOptions(
|
|
9587
|
-
new
|
|
9700
|
+
new Command84("set").description("set an environment variable").argument("<key>", "variable name").argument("[value]", "value \u2014 prompted for, without echo, when omitted").configureHelp(helpConfig),
|
|
9588
9701
|
"local"
|
|
9589
9702
|
).action(
|
|
9590
9703
|
(key, value, raw) => runCommand(
|
|
@@ -9627,11 +9740,11 @@ async function promptValue(key) {
|
|
|
9627
9740
|
}
|
|
9628
9741
|
|
|
9629
9742
|
// src/commands/env/unset.ts
|
|
9630
|
-
import { Command as
|
|
9743
|
+
import { Command as Command85 } from "commander";
|
|
9631
9744
|
import * as p48 from "@clack/prompts";
|
|
9632
9745
|
import pc21 from "picocolors";
|
|
9633
9746
|
var envUnset = addTargetOptions(
|
|
9634
|
-
new
|
|
9747
|
+
new Command85("unset").description("remove an environment variable").argument("<key>", "variable name").configureHelp(helpConfig),
|
|
9635
9748
|
"local"
|
|
9636
9749
|
).action(
|
|
9637
9750
|
(key, raw) => runCommand(
|
|
@@ -9669,11 +9782,11 @@ var envUnset = addTargetOptions(
|
|
|
9669
9782
|
import fs38 from "node:fs";
|
|
9670
9783
|
import path40 from "node:path";
|
|
9671
9784
|
import process34 from "node:process";
|
|
9672
|
-
import { Command as
|
|
9785
|
+
import { Command as Command86 } from "commander";
|
|
9673
9786
|
import * as p49 from "@clack/prompts";
|
|
9674
9787
|
import pc22 from "picocolors";
|
|
9675
9788
|
var envImport = addTargetOptions(
|
|
9676
|
-
new
|
|
9789
|
+
new Command86("import").description("merge a dotenv file into the environment").argument("<file>", "dotenv file to read").configureHelp(helpConfig),
|
|
9677
9790
|
"local"
|
|
9678
9791
|
).action(
|
|
9679
9792
|
(file, raw) => runCommand(
|
|
@@ -9723,14 +9836,14 @@ function read(resolved, shown) {
|
|
|
9723
9836
|
}
|
|
9724
9837
|
|
|
9725
9838
|
// src/commands/env.ts
|
|
9726
|
-
var env = new
|
|
9839
|
+
var env = new Command87("env").description("manage environment variables, locally or on a target").configureHelp(helpConfig).addCommand(envList).addCommand(envSet).addCommand(envUnset).addCommand(envImport);
|
|
9727
9840
|
|
|
9728
9841
|
// src/commands/status.ts
|
|
9729
|
-
import { Command as
|
|
9842
|
+
import { Command as Command88 } from "commander";
|
|
9730
9843
|
import * as p50 from "@clack/prompts";
|
|
9731
9844
|
import pc23 from "picocolors";
|
|
9732
9845
|
var status = addTargetOptions(
|
|
9733
|
-
new
|
|
9846
|
+
new Command88("status").description("show what is deployed").configureHelp(helpConfig),
|
|
9734
9847
|
"production"
|
|
9735
9848
|
).option("--all", "show every app on the server, not just this project").option("--json", "print raw JSON").action(
|
|
9736
9849
|
(raw) => runCommand(async () => {
|
|
@@ -9789,12 +9902,12 @@ function describe2(state) {
|
|
|
9789
9902
|
}
|
|
9790
9903
|
|
|
9791
9904
|
// src/commands/rollback.ts
|
|
9792
|
-
import { Command as
|
|
9905
|
+
import { Command as Command89 } from "commander";
|
|
9793
9906
|
import * as p51 from "@clack/prompts";
|
|
9794
9907
|
import pc24 from "picocolors";
|
|
9795
9908
|
var rollback = addLockWaitOption(
|
|
9796
9909
|
addTargetOptions(
|
|
9797
|
-
new
|
|
9910
|
+
new Command89("rollback").description("put the previous release back").configureHelp(helpConfig),
|
|
9798
9911
|
"production"
|
|
9799
9912
|
)
|
|
9800
9913
|
).option("--to <release>", "roll back to a specific release instead of the previous one").action(
|
|
@@ -9833,9 +9946,9 @@ var rollback = addLockWaitOption(
|
|
|
9833
9946
|
);
|
|
9834
9947
|
|
|
9835
9948
|
// src/commands/logs.ts
|
|
9836
|
-
import { Command as
|
|
9949
|
+
import { Command as Command90 } from "commander";
|
|
9837
9950
|
var logs = addTargetOptions(
|
|
9838
|
-
new
|
|
9951
|
+
new Command90("logs").description("tail the logs of a deployed app").configureHelp(helpConfig),
|
|
9839
9952
|
"production"
|
|
9840
9953
|
).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
9954
|
(raw) => runCommand(async () => {
|
|
@@ -9869,16 +9982,16 @@ var logs = addTargetOptions(
|
|
|
9869
9982
|
);
|
|
9870
9983
|
|
|
9871
9984
|
// src/commands/admin.ts
|
|
9872
|
-
import { Command as
|
|
9985
|
+
import { Command as Command92 } from "commander";
|
|
9873
9986
|
|
|
9874
9987
|
// src/commands/admin/create.ts
|
|
9875
9988
|
import process35 from "node:process";
|
|
9876
|
-
import { Command as
|
|
9989
|
+
import { Command as Command91 } from "commander";
|
|
9877
9990
|
import * as p52 from "@clack/prompts";
|
|
9878
9991
|
import pc25 from "picocolors";
|
|
9879
9992
|
var MIN_PASSWORD = 10;
|
|
9880
9993
|
var adminCreate = addTargetOptions(
|
|
9881
|
-
new
|
|
9994
|
+
new Command91("create").description("create a login for the admin panel").argument("[email]", "email to sign in with \u2014 prompted for when omitted").configureHelp(helpConfig),
|
|
9882
9995
|
"local"
|
|
9883
9996
|
).action(
|
|
9884
9997
|
(email3, raw) => runCommand(
|
|
@@ -9988,15 +10101,15 @@ async function promptPassword2() {
|
|
|
9988
10101
|
}
|
|
9989
10102
|
|
|
9990
10103
|
// src/commands/admin.ts
|
|
9991
|
-
var admin = new
|
|
10104
|
+
var admin = new Command92("admin").description("manage admin panel logins").configureHelp(helpConfig).addCommand(adminCreate);
|
|
9992
10105
|
|
|
9993
10106
|
// src/commands/backup.ts
|
|
9994
|
-
import { Command as
|
|
10107
|
+
import { Command as Command98 } from "commander";
|
|
9995
10108
|
|
|
9996
10109
|
// src/commands/backup/create.ts
|
|
9997
10110
|
import fs39 from "node:fs";
|
|
9998
10111
|
import path41 from "node:path";
|
|
9999
|
-
import { Command as
|
|
10112
|
+
import { Command as Command93 } from "commander";
|
|
10000
10113
|
import * as p53 from "@clack/prompts";
|
|
10001
10114
|
import pc26 from "picocolors";
|
|
10002
10115
|
|
|
@@ -10085,7 +10198,7 @@ async function writeSchedule(pb, cron, maxKeep) {
|
|
|
10085
10198
|
// src/commands/backup/create.ts
|
|
10086
10199
|
var DEFAULT_BACKUP_DIR = "backups";
|
|
10087
10200
|
var backupCreate = addTargetOptions(
|
|
10088
|
-
new
|
|
10201
|
+
new Command93("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
10202
|
"production"
|
|
10090
10203
|
).action(
|
|
10091
10204
|
(name, raw) => runCommand(() => {
|
|
@@ -10109,16 +10222,16 @@ Your bucket's own versioning is what protects the uploaded files.`
|
|
|
10109
10222
|
);
|
|
10110
10223
|
}
|
|
10111
10224
|
if (ctx.session) await checkpointAppDatabases(ctx.session, ctx.instance);
|
|
10112
|
-
const
|
|
10113
|
-
|
|
10225
|
+
const spinner8 = p53.spinner();
|
|
10226
|
+
spinner8.start(`Backing up ${ctx.targetName}`);
|
|
10114
10227
|
try {
|
|
10115
10228
|
await createBackup(ctx.pb, key);
|
|
10116
10229
|
} catch (error) {
|
|
10117
|
-
|
|
10230
|
+
spinner8.stop(`Backup of ${ctx.targetName} failed.`);
|
|
10118
10231
|
throw error;
|
|
10119
10232
|
}
|
|
10120
10233
|
const size = (await listBackups(ctx.pb)).find((b) => b.key === key)?.size ?? 0;
|
|
10121
|
-
|
|
10234
|
+
spinner8.stop(`Backed up ${ctx.targetName} \u2014 ${key} (${formatBytes(size)})`);
|
|
10122
10235
|
if (storage.backupsS3Enabled) {
|
|
10123
10236
|
reportResult({
|
|
10124
10237
|
summary: `Backed up ${ctx.targetName} to your backups bucket.`,
|
|
@@ -10156,24 +10269,24 @@ async function download(ctx, key, outputDir) {
|
|
|
10156
10269
|
fs39.copyFileSync(path41.join(ctx.workspaceRootDir, "data", "backups", key), destination);
|
|
10157
10270
|
return path41.relative(ctx.workspaceRootDir, destination);
|
|
10158
10271
|
}
|
|
10159
|
-
const
|
|
10160
|
-
|
|
10272
|
+
const spinner8 = p53.spinner();
|
|
10273
|
+
spinner8.start(`Downloading ${key}`);
|
|
10161
10274
|
try {
|
|
10162
10275
|
await ctx.session.download(remotePaths.backup(ctx.instance, key), destination);
|
|
10163
10276
|
} catch (error) {
|
|
10164
|
-
|
|
10277
|
+
spinner8.stop(`Could not download ${key}.`);
|
|
10165
10278
|
throw error;
|
|
10166
10279
|
}
|
|
10167
|
-
|
|
10280
|
+
spinner8.stop(`Downloaded ${key}`);
|
|
10168
10281
|
return path41.relative(ctx.workspaceRootDir, destination);
|
|
10169
10282
|
}
|
|
10170
10283
|
|
|
10171
10284
|
// src/commands/backup/list.ts
|
|
10172
|
-
import { Command as
|
|
10285
|
+
import { Command as Command94 } from "commander";
|
|
10173
10286
|
import * as p54 from "@clack/prompts";
|
|
10174
10287
|
import pc27 from "picocolors";
|
|
10175
10288
|
var backupList = addTargetOptions(
|
|
10176
|
-
new
|
|
10289
|
+
new Command94("list").description("list the backups on a target").configureHelp(helpConfig),
|
|
10177
10290
|
"production"
|
|
10178
10291
|
).action(
|
|
10179
10292
|
(raw) => runCommand(
|
|
@@ -10201,11 +10314,11 @@ Take one with ${pc27.cyan("vela backup create")}.`
|
|
|
10201
10314
|
// src/commands/backup/download.ts
|
|
10202
10315
|
import fs40 from "node:fs";
|
|
10203
10316
|
import path42 from "node:path";
|
|
10204
|
-
import { Command as
|
|
10317
|
+
import { Command as Command95 } from "commander";
|
|
10205
10318
|
import * as p55 from "@clack/prompts";
|
|
10206
10319
|
import pc28 from "picocolors";
|
|
10207
10320
|
var backupDownload = addTargetOptions(
|
|
10208
|
-
new
|
|
10321
|
+
new Command95("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
10322
|
"production"
|
|
10210
10323
|
).action(
|
|
10211
10324
|
(key, raw) => runCommand(() => {
|
|
@@ -10233,15 +10346,15 @@ Fetch it from the bucket directly \u2014 vela does not hold its credentials.`
|
|
|
10233
10346
|
if (!ctx.session) {
|
|
10234
10347
|
fs40.copyFileSync(path42.join(ctx.workspaceRootDir, "data", "backups", key), destination);
|
|
10235
10348
|
} else {
|
|
10236
|
-
const
|
|
10237
|
-
|
|
10349
|
+
const spinner8 = p55.spinner();
|
|
10350
|
+
spinner8.start(`Downloading ${key} (${formatBytes(found.size)})`);
|
|
10238
10351
|
try {
|
|
10239
10352
|
await ctx.session.download(remotePaths.backup(ctx.instance, key), destination);
|
|
10240
10353
|
} catch (error) {
|
|
10241
|
-
|
|
10354
|
+
spinner8.stop(`Could not download ${key}.`);
|
|
10242
10355
|
throw error;
|
|
10243
10356
|
}
|
|
10244
|
-
|
|
10357
|
+
spinner8.stop(`Downloaded ${key}`);
|
|
10245
10358
|
}
|
|
10246
10359
|
reportResult({
|
|
10247
10360
|
summary: `Saved ${key} from ${ctx.targetName}.`,
|
|
@@ -10253,11 +10366,11 @@ Fetch it from the bucket directly \u2014 vela does not hold its credentials.`
|
|
|
10253
10366
|
|
|
10254
10367
|
// src/commands/backup/delete.ts
|
|
10255
10368
|
import process36 from "node:process";
|
|
10256
|
-
import { Command as
|
|
10369
|
+
import { Command as Command96 } from "commander";
|
|
10257
10370
|
import * as p56 from "@clack/prompts";
|
|
10258
10371
|
import pc29 from "picocolors";
|
|
10259
10372
|
var backupDelete = addTargetOptions(
|
|
10260
|
-
new
|
|
10373
|
+
new Command96("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
10374
|
"production"
|
|
10262
10375
|
).action(
|
|
10263
10376
|
(key, raw) => runCommand(() => {
|
|
@@ -10288,12 +10401,12 @@ Run ${pc29.cyan("vela backup list")} to see what it does have.`
|
|
|
10288
10401
|
);
|
|
10289
10402
|
|
|
10290
10403
|
// src/commands/backup/schedule.ts
|
|
10291
|
-
import { Command as
|
|
10404
|
+
import { Command as Command97 } from "commander";
|
|
10292
10405
|
import * as p57 from "@clack/prompts";
|
|
10293
10406
|
import pc30 from "picocolors";
|
|
10294
10407
|
var DEFAULT_KEEP = 7;
|
|
10295
10408
|
var backupSchedule = addTargetOptions(
|
|
10296
|
-
new
|
|
10409
|
+
new Command97("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
10410
|
"production"
|
|
10298
10411
|
).action(
|
|
10299
10412
|
(cron, raw) => runCommand(() => {
|
|
@@ -10337,18 +10450,18 @@ Set one with ${pc30.cyan('vela backup schedule "0 3 * * *"')}.`
|
|
|
10337
10450
|
);
|
|
10338
10451
|
|
|
10339
10452
|
// src/commands/backup.ts
|
|
10340
|
-
var backup = new
|
|
10453
|
+
var backup = new Command98("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
10454
|
|
|
10342
10455
|
// src/commands/restore.ts
|
|
10343
10456
|
import fs41 from "node:fs";
|
|
10344
10457
|
import path43 from "node:path";
|
|
10345
10458
|
import process37 from "node:process";
|
|
10346
|
-
import { Command as
|
|
10459
|
+
import { Command as Command99 } from "commander";
|
|
10347
10460
|
import * as p58 from "@clack/prompts";
|
|
10348
10461
|
import pc31 from "picocolors";
|
|
10349
10462
|
var restore = addLockWaitOption(
|
|
10350
10463
|
addTargetOptions(
|
|
10351
|
-
new
|
|
10464
|
+
new Command99("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
10465
|
"production"
|
|
10353
10466
|
)
|
|
10354
10467
|
).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 +10567,16 @@ Take one with ${pc31.cyan("vela backup create")}, or pass the path to an archive
|
|
|
10454
10567
|
async function stage(ctx, file) {
|
|
10455
10568
|
const dir = remotePaths.restoreStage(ctx.instance);
|
|
10456
10569
|
const remote = `${dir}/${path43.basename(file)}`;
|
|
10457
|
-
const
|
|
10458
|
-
|
|
10570
|
+
const spinner8 = p58.spinner();
|
|
10571
|
+
spinner8.start(`Uploading ${path43.basename(file)}`);
|
|
10459
10572
|
try {
|
|
10460
10573
|
await ctx.session.script(`mkdir -p "$1"`, { args: [dir] });
|
|
10461
10574
|
await ctx.session.upload([file], dir);
|
|
10462
10575
|
} catch (error) {
|
|
10463
|
-
|
|
10576
|
+
spinner8.stop(`Could not upload ${path43.basename(file)}.`);
|
|
10464
10577
|
throw error;
|
|
10465
10578
|
}
|
|
10466
|
-
|
|
10579
|
+
spinner8.stop(`Uploaded ${path43.basename(file)}`);
|
|
10467
10580
|
return remote;
|
|
10468
10581
|
}
|
|
10469
10582
|
async function confirm13(appName, targetName, envTag, from) {
|
|
@@ -10490,7 +10603,7 @@ async function confirm13(appName, targetName, envTag, from) {
|
|
|
10490
10603
|
}
|
|
10491
10604
|
|
|
10492
10605
|
// src/commands/targets.ts
|
|
10493
|
-
import { Command as
|
|
10606
|
+
import { Command as Command100 } from "commander";
|
|
10494
10607
|
import * as p59 from "@clack/prompts";
|
|
10495
10608
|
import pc32 from "picocolors";
|
|
10496
10609
|
import * as v9 from "valibot";
|
|
@@ -10500,7 +10613,7 @@ var OptionsSchema4 = v9.object({
|
|
|
10500
10613
|
offline: v9.optional(v9.boolean())
|
|
10501
10614
|
});
|
|
10502
10615
|
var targets = addSshOptions(
|
|
10503
|
-
new
|
|
10616
|
+
new Command100("targets").description("list the targets this project can deploy to").configureHelp(helpConfig)
|
|
10504
10617
|
).option("--json", "print raw JSON").option("--offline", "skip connecting to servers").action(
|
|
10505
10618
|
(raw) => runCommand(async () => {
|
|
10506
10619
|
const options = parseOptions(OptionsSchema4, raw);
|
|
@@ -10580,14 +10693,14 @@ Release and domain are shown from what this project recorded.`
|
|
|
10580
10693
|
// src/commands/test.ts
|
|
10581
10694
|
import path44 from "node:path";
|
|
10582
10695
|
import process38 from "node:process";
|
|
10583
|
-
import { Command as
|
|
10696
|
+
import { Command as Command101 } from "commander";
|
|
10584
10697
|
import PocketBase6 from "pocketbase";
|
|
10585
10698
|
import pc33 from "picocolors";
|
|
10586
10699
|
import { x as x5 } from "tinyexec";
|
|
10587
10700
|
import { detect as detect8 } from "package-manager-detector";
|
|
10588
10701
|
import { resolveCommand as resolveCommand7 } from "package-manager-detector/commands";
|
|
10589
10702
|
import fs42 from "node:fs";
|
|
10590
|
-
var testServer = new
|
|
10703
|
+
var testServer = new Command101("test:server").description("run server tests").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(async (_opts, cmd) => {
|
|
10591
10704
|
const cwd = process38.cwd();
|
|
10592
10705
|
const email3 = `test-${Math.random().toString(36).slice(2)}@example.com`;
|
|
10593
10706
|
const password11 = "password";
|
|
@@ -10619,6 +10732,7 @@ var testServer = new Command97("test:server").description("run server tests").al
|
|
|
10619
10732
|
};
|
|
10620
10733
|
const cleanup = async () => {
|
|
10621
10734
|
if (cleanedUp) return;
|
|
10735
|
+
process38.emit("sveltekit:shutdown", 0);
|
|
10622
10736
|
await vite?.close().catch(() => {
|
|
10623
10737
|
});
|
|
10624
10738
|
cleanupSync();
|
|
@@ -10686,6 +10800,7 @@ var testServer = new Command97("test:server").description("run server tests").al
|
|
|
10686
10800
|
process38.exitCode = 1;
|
|
10687
10801
|
} finally {
|
|
10688
10802
|
await cleanup();
|
|
10803
|
+
process38.exit(process38.exitCode ?? 0);
|
|
10689
10804
|
}
|
|
10690
10805
|
});
|
|
10691
10806
|
function describeLoadFailure(e) {
|
|
@@ -10716,7 +10831,7 @@ function stubPagesPlugin() {
|
|
|
10716
10831
|
// src/commands/routes.ts
|
|
10717
10832
|
import fs43 from "node:fs";
|
|
10718
10833
|
import path45 from "node:path";
|
|
10719
|
-
import { Command as
|
|
10834
|
+
import { Command as Command102 } from "commander";
|
|
10720
10835
|
var HTTP_METHODS = /* @__PURE__ */ new Set([
|
|
10721
10836
|
"GET",
|
|
10722
10837
|
"POST",
|
|
@@ -10727,7 +10842,7 @@ var HTTP_METHODS = /* @__PURE__ */ new Set([
|
|
|
10727
10842
|
"HEAD",
|
|
10728
10843
|
"fallback"
|
|
10729
10844
|
]);
|
|
10730
|
-
var routes = new
|
|
10845
|
+
var routes = new Command102("routes").description("list routes").configureHelp(helpConfig).action(async () => {
|
|
10731
10846
|
const { workspaceRootDir, routesDir } = await getWorkspace();
|
|
10732
10847
|
const routesRoot = path45.join(workspaceRootDir, routesDir);
|
|
10733
10848
|
const found = walk(routesRoot, routesRoot).filter((r) => r.methods.length > 0);
|
|
@@ -10803,7 +10918,7 @@ function printTable(routes2) {
|
|
|
10803
10918
|
|
|
10804
10919
|
// src/commands/i18n.ts
|
|
10805
10920
|
import process39 from "node:process";
|
|
10806
|
-
import { Command as
|
|
10921
|
+
import { Command as Command103 } from "commander";
|
|
10807
10922
|
import { x as x6 } from "tinyexec";
|
|
10808
10923
|
import { detect as detect9 } from "package-manager-detector";
|
|
10809
10924
|
import { resolveCommand as resolveCommand8 } from "package-manager-detector/commands";
|
|
@@ -10818,11 +10933,11 @@ async function runWuchale(extraArgs) {
|
|
|
10818
10933
|
throwOnError: true
|
|
10819
10934
|
});
|
|
10820
10935
|
}
|
|
10821
|
-
var extract2 = new
|
|
10822
|
-
var watch = new
|
|
10823
|
-
var status2 = new
|
|
10824
|
-
var clean = new
|
|
10825
|
-
var i18n3 = new
|
|
10936
|
+
var extract2 = new Command103("extract").description("extract translatable strings").configureHelp(helpConfig).action(() => runWuchale([]));
|
|
10937
|
+
var watch = new Command103("watch").description("watch and extract translatable strings").configureHelp(helpConfig).action(() => runWuchale(["--watch"]));
|
|
10938
|
+
var status2 = new Command103("status").description("show i18n status").configureHelp(helpConfig).action(() => runWuchale(["status"]));
|
|
10939
|
+
var clean = new Command103("clean").description("clean unused translatable strings").configureHelp(helpConfig).action(() => runWuchale(["--clean"]));
|
|
10940
|
+
var i18n3 = new Command103("i18n").description("i18n utilities").configureHelp(helpConfig).addCommand(extract2, { isDefault: true }).addCommand(watch).addCommand(status2).addCommand(clean);
|
|
10826
10941
|
|
|
10827
10942
|
// src/commands/oauth.ts
|
|
10828
10943
|
var oauth = stubCommand("oauth", "configure OAuth providers");
|
|
@@ -10831,23 +10946,119 @@ var oauth = stubCommand("oauth", "configure OAuth providers");
|
|
|
10831
10946
|
var schemas = stubCommand("schemas", "manage database schemas");
|
|
10832
10947
|
|
|
10833
10948
|
// src/commands/cms.ts
|
|
10949
|
+
import { Command as Command109 } from "commander";
|
|
10950
|
+
|
|
10951
|
+
// src/commands/cms/deploy.ts
|
|
10952
|
+
import process40 from "node:process";
|
|
10834
10953
|
import { Command as Command104 } from "commander";
|
|
10954
|
+
import * as p60 from "@clack/prompts";
|
|
10955
|
+
import pc34 from "picocolors";
|
|
10956
|
+
var POLL_INTERVAL2 = 5e3;
|
|
10957
|
+
var POLL_TIMEOUT = 30 * 6e4;
|
|
10958
|
+
var inFlight = (run) => run?.status === "pending" || run?.status === "building";
|
|
10959
|
+
var deploy2 = new Command104("deploy").description("rebuild the hosted site with the latest published content").option(
|
|
10960
|
+
"--project <id>",
|
|
10961
|
+
"velastack.dev project whose site to rebuild, instead of the linked one"
|
|
10962
|
+
).option("--no-wait", "return once the build has started instead of waiting for it").configureHelp(helpConfig).action(
|
|
10963
|
+
(options) => runCommand(async () => {
|
|
10964
|
+
const projectId = resolveProjectId(options.project);
|
|
10965
|
+
const apiKey = requireApiKey();
|
|
10966
|
+
let state = await getSiteDeploy(apiKey, projectId).catch(rewordMissingRoute);
|
|
10967
|
+
if (!state.available) {
|
|
10968
|
+
throw new Error(
|
|
10969
|
+
`This project has no hosted site to rebuild.
|
|
10970
|
+
|
|
10971
|
+
A site deployed with ${pc34.cyan("vela deploy")} is updated by deploying again.`
|
|
10972
|
+
);
|
|
10973
|
+
}
|
|
10974
|
+
const url = state.site?.url ?? "";
|
|
10975
|
+
if (inFlight(state.latest)) {
|
|
10976
|
+
p60.log.info(`A deploy of ${pc34.cyan(url)} is already in progress.`);
|
|
10977
|
+
} else {
|
|
10978
|
+
state = await startSiteDeploy(apiKey, projectId);
|
|
10979
|
+
}
|
|
10980
|
+
if (!options.wait) {
|
|
10981
|
+
p60.log.success(
|
|
10982
|
+
`Build started for ${pc34.cyan(url)} (deployment ${pc34.dim(state.latest?.id ?? "")}).
|
|
10983
|
+
It goes live when the build finishes.`
|
|
10984
|
+
);
|
|
10985
|
+
return;
|
|
10986
|
+
}
|
|
10987
|
+
const spinner8 = p60.spinner();
|
|
10988
|
+
spinner8.start(`Building ${url}`);
|
|
10989
|
+
let latest;
|
|
10990
|
+
try {
|
|
10991
|
+
latest = await waitForRun(apiKey, projectId, state.latest?.id);
|
|
10992
|
+
} catch (error) {
|
|
10993
|
+
spinner8.stop(`Could not follow the build of ${url}.`);
|
|
10994
|
+
throw error;
|
|
10995
|
+
}
|
|
10996
|
+
if (!latest) {
|
|
10997
|
+
spinner8.stop(`Still building ${url}.`);
|
|
10998
|
+
p60.log.warn(
|
|
10999
|
+
`The build has not finished after ${Math.round(POLL_TIMEOUT / 6e4)} minutes.
|
|
11000
|
+
It goes live on its own if it does; the deployments page on velastack.dev shows how it ends.`
|
|
11001
|
+
);
|
|
11002
|
+
return;
|
|
11003
|
+
}
|
|
11004
|
+
if (latest.status === "failed") {
|
|
11005
|
+
spinner8.stop(`Deploy of ${url} failed.`);
|
|
11006
|
+
throw new Error(latest.error || "the build did not finish");
|
|
11007
|
+
}
|
|
11008
|
+
spinner8.stop(`Deployed ${pc34.cyan(url)}`);
|
|
11009
|
+
}, "Failed to deploy the site.")
|
|
11010
|
+
);
|
|
11011
|
+
function resolveProjectId(explicit) {
|
|
11012
|
+
if (explicit !== void 0) {
|
|
11013
|
+
if (!PROJECT_ID_RE.test(explicit)) {
|
|
11014
|
+
throw new Error(`${explicit} is not a velastack.dev project id.`);
|
|
11015
|
+
}
|
|
11016
|
+
return explicit;
|
|
11017
|
+
}
|
|
11018
|
+
const root = findWorkspaceRoot(process40.cwd());
|
|
11019
|
+
const link2 = root ? readProjectConfig(root) : null;
|
|
11020
|
+
if (!link2) {
|
|
11021
|
+
throw new Error(
|
|
11022
|
+
`This project is not linked to velastack.dev.
|
|
11023
|
+
|
|
11024
|
+
Run ${pc34.cyan("vela link")}, or pass ${pc34.cyan("--project <id>")}.`
|
|
11025
|
+
);
|
|
11026
|
+
}
|
|
11027
|
+
return link2.projectId;
|
|
11028
|
+
}
|
|
11029
|
+
function rewordMissingRoute(error) {
|
|
11030
|
+
if (error instanceof Error && /\(404\)/.test(error.message)) {
|
|
11031
|
+
throw new Error("velastack.dev does not support site deploys from the CLI yet.");
|
|
11032
|
+
}
|
|
11033
|
+
throw error;
|
|
11034
|
+
}
|
|
11035
|
+
async function waitForRun(apiKey, projectId, runId) {
|
|
11036
|
+
const deadline = Date.now() + POLL_TIMEOUT;
|
|
11037
|
+
while (Date.now() < deadline) {
|
|
11038
|
+
await new Promise((resolve2) => setTimeout(resolve2, POLL_INTERVAL2));
|
|
11039
|
+
const state = await getSiteDeploy(apiKey, projectId);
|
|
11040
|
+
const latest = state.latest;
|
|
11041
|
+
if (!latest || runId && latest.id !== runId) continue;
|
|
11042
|
+
if (!inFlight(latest)) return latest;
|
|
11043
|
+
}
|
|
11044
|
+
return null;
|
|
11045
|
+
}
|
|
10835
11046
|
|
|
10836
11047
|
// src/commands/cms/editor.ts
|
|
10837
|
-
import { Command as
|
|
11048
|
+
import { Command as Command108 } from "commander";
|
|
10838
11049
|
|
|
10839
11050
|
// src/commands/cms/editor/add.ts
|
|
10840
11051
|
import { randomBytes } from "node:crypto";
|
|
10841
|
-
import { Command as
|
|
10842
|
-
import * as
|
|
10843
|
-
import
|
|
11052
|
+
import { Command as Command105 } from "commander";
|
|
11053
|
+
import * as p61 from "@clack/prompts";
|
|
11054
|
+
import pc36 from "picocolors";
|
|
10844
11055
|
|
|
10845
11056
|
// src/lib/cms-backend.ts
|
|
10846
11057
|
import { createRequire as createRequire3 } from "node:module";
|
|
10847
11058
|
import path46 from "node:path";
|
|
10848
|
-
import
|
|
11059
|
+
import process41 from "node:process";
|
|
10849
11060
|
import { pathToFileURL as pathToFileURL3 } from "node:url";
|
|
10850
|
-
import
|
|
11061
|
+
import pc35 from "picocolors";
|
|
10851
11062
|
var DEFAULT_PROJECT = "default";
|
|
10852
11063
|
async function loadBackendModule(root) {
|
|
10853
11064
|
let entry;
|
|
@@ -10857,12 +11068,12 @@ async function loadBackendModule(root) {
|
|
|
10857
11068
|
throw new Error(
|
|
10858
11069
|
`@velastack/cms is not installed in this project.
|
|
10859
11070
|
|
|
10860
|
-
Run ${
|
|
11071
|
+
Run ${pc35.cyan("vela enable cms")} first.`
|
|
10861
11072
|
);
|
|
10862
11073
|
}
|
|
10863
11074
|
return await import(pathToFileURL3(entry).href);
|
|
10864
11075
|
}
|
|
10865
|
-
async function withCmsBackend(fn, cwd =
|
|
11076
|
+
async function withCmsBackend(fn, cwd = process41.cwd()) {
|
|
10866
11077
|
const root = findWorkspaceRoot(cwd);
|
|
10867
11078
|
if (!root) {
|
|
10868
11079
|
throw new Error("Could not find workspace root (no package.json found)");
|
|
@@ -10881,42 +11092,42 @@ async function withCmsBackend(fn, cwd = process40.cwd()) {
|
|
|
10881
11092
|
}
|
|
10882
11093
|
|
|
10883
11094
|
// src/commands/cms/editor/add.ts
|
|
10884
|
-
var editorAdd = new
|
|
11095
|
+
var editorAdd = new Command105("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
11096
|
(email3, options) => runCommand(async () => {
|
|
10886
11097
|
const generated = options.password === void 0;
|
|
10887
11098
|
const password11 = options.password ?? randomBytes(12).toString("base64url");
|
|
10888
11099
|
const editor2 = await withCmsBackend(
|
|
10889
11100
|
(cms3) => cms3.editors.create({ email: email3, password: password11, projects: [options.project] })
|
|
10890
11101
|
);
|
|
10891
|
-
const lines = [`Added ${
|
|
11102
|
+
const lines = [`Added ${pc36.cyan(editor2.email)} as an editor of ${pc36.cyan(options.project)}.`];
|
|
10892
11103
|
if (generated) {
|
|
10893
|
-
lines.push("", `Password: ${
|
|
11104
|
+
lines.push("", `Password: ${pc36.bold(password11)}`, "", "It is shown once; copy it now.");
|
|
10894
11105
|
}
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
`Run ${
|
|
11106
|
+
p61.log.success(lines.join("\n"));
|
|
11107
|
+
p61.log.info(
|
|
11108
|
+
`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
11109
|
);
|
|
10899
11110
|
}, "Failed to add the editor.")
|
|
10900
11111
|
);
|
|
10901
11112
|
|
|
10902
11113
|
// src/commands/cms/editor/password.ts
|
|
10903
|
-
import { Command as
|
|
10904
|
-
import * as
|
|
10905
|
-
import
|
|
10906
|
-
var editorPassword = new
|
|
11114
|
+
import { Command as Command106 } from "commander";
|
|
11115
|
+
import * as p62 from "@clack/prompts";
|
|
11116
|
+
import pc37 from "picocolors";
|
|
11117
|
+
var editorPassword = new Command106("password").description("set an editor's password").argument("<email>", "email of the editor").argument("<password>", "new password").configureHelp(helpConfig).action(
|
|
10907
11118
|
(email3, password11) => runCommand(async () => {
|
|
10908
11119
|
await withCmsBackend((cms3) => cms3.editors.setPassword(email3, password11));
|
|
10909
|
-
|
|
10910
|
-
`Updated the password for ${
|
|
11120
|
+
p62.log.success(
|
|
11121
|
+
`Updated the password for ${pc37.cyan(email3)}. Existing sessions were signed out.`
|
|
10911
11122
|
);
|
|
10912
11123
|
}, "Failed to set the password.")
|
|
10913
11124
|
);
|
|
10914
11125
|
|
|
10915
11126
|
// src/commands/cms/editor/list.ts
|
|
10916
|
-
import { Command as
|
|
10917
|
-
import * as
|
|
10918
|
-
import
|
|
10919
|
-
var editorList = new
|
|
11127
|
+
import { Command as Command107 } from "commander";
|
|
11128
|
+
import * as p63 from "@clack/prompts";
|
|
11129
|
+
import pc38 from "picocolors";
|
|
11130
|
+
var editorList = new Command107("list").description("list editors and the projects they may edit").configureHelp(helpConfig).action(
|
|
10920
11131
|
() => runCommand(async () => {
|
|
10921
11132
|
const rows = await withCmsBackend(
|
|
10922
11133
|
async (cms3) => cms3.editors.list().map((editor2) => ({
|
|
@@ -10925,25 +11136,169 @@ var editorList = new Command102("list").description("list editors and the projec
|
|
|
10925
11136
|
}))
|
|
10926
11137
|
);
|
|
10927
11138
|
if (rows.length === 0) {
|
|
10928
|
-
|
|
11139
|
+
p63.log.info(`No editors yet. Add one with ${pc38.cyan("vela cms editor add <email>")}.`);
|
|
10929
11140
|
return;
|
|
10930
11141
|
}
|
|
10931
11142
|
const width = Math.max(...rows.map((row) => row.email.length));
|
|
10932
|
-
|
|
11143
|
+
p63.log.info(
|
|
10933
11144
|
`Editors
|
|
10934
11145
|
|
|
10935
11146
|
` + rows.map(
|
|
10936
|
-
(row) => ` ${row.email.padEnd(width)} ${
|
|
11147
|
+
(row) => ` ${row.email.padEnd(width)} ${pc38.dim(row.projects.join(", ") || "no projects")}`
|
|
10937
11148
|
).join("\n")
|
|
10938
11149
|
);
|
|
10939
11150
|
}, "Failed to list editors.")
|
|
10940
11151
|
);
|
|
10941
11152
|
|
|
10942
11153
|
// src/commands/cms/editor.ts
|
|
10943
|
-
var editor = new
|
|
11154
|
+
var editor = new Command108("editor").description("manage who can sign in to the admin bar").configureHelp(helpConfig).addCommand(editorAdd).addCommand(editorPassword).addCommand(editorList);
|
|
10944
11155
|
|
|
10945
11156
|
// src/commands/cms.ts
|
|
10946
|
-
var cms2 = new
|
|
11157
|
+
var cms2 = new Command109("cms").description("manage the CMS").configureHelp(helpConfig).addCommand(editor).addCommand(deploy2);
|
|
11158
|
+
|
|
11159
|
+
// src/commands/workflows.ts
|
|
11160
|
+
import { Command as Command113 } from "commander";
|
|
11161
|
+
|
|
11162
|
+
// src/commands/workflows/list.ts
|
|
11163
|
+
import process42 from "node:process";
|
|
11164
|
+
import { Command as Command110, InvalidArgumentError as InvalidArgumentError5 } from "commander";
|
|
11165
|
+
import * as p64 from "@clack/prompts";
|
|
11166
|
+
import pc39 from "picocolors";
|
|
11167
|
+
|
|
11168
|
+
// src/lib/workflows-api.ts
|
|
11169
|
+
var NAMESPACE = "default";
|
|
11170
|
+
var PREFIX = `/api/ow/v1/${NAMESPACE}`;
|
|
11171
|
+
async function listRuns(pb, options = {}) {
|
|
11172
|
+
const query = { limit: options.limit ?? 50 };
|
|
11173
|
+
if (options.status) query.status = options.status;
|
|
11174
|
+
if (options.workflowName) query.workflowName = options.workflowName;
|
|
11175
|
+
const res = await pb.send(`${PREFIX}/runs`, {
|
|
11176
|
+
method: "GET",
|
|
11177
|
+
query,
|
|
11178
|
+
requestKey: null
|
|
11179
|
+
});
|
|
11180
|
+
return res.data;
|
|
11181
|
+
}
|
|
11182
|
+
async function createRun(pb, workflowName, input) {
|
|
11183
|
+
const res = await pb.send(`${PREFIX}/runs`, {
|
|
11184
|
+
method: "POST",
|
|
11185
|
+
body: {
|
|
11186
|
+
workflowName,
|
|
11187
|
+
version: null,
|
|
11188
|
+
idempotencyKey: null,
|
|
11189
|
+
config: {},
|
|
11190
|
+
context: {},
|
|
11191
|
+
input: input ?? null,
|
|
11192
|
+
parentStepAttemptNamespaceId: null,
|
|
11193
|
+
parentStepAttemptId: null,
|
|
11194
|
+
availableAt: null,
|
|
11195
|
+
deadlineAt: null
|
|
11196
|
+
},
|
|
11197
|
+
requestKey: null
|
|
11198
|
+
});
|
|
11199
|
+
return res.run;
|
|
11200
|
+
}
|
|
11201
|
+
async function cancelRun(pb, id) {
|
|
11202
|
+
const res = await pb.send(`${PREFIX}/runs/${id}/cancel`, {
|
|
11203
|
+
method: "POST",
|
|
11204
|
+
body: {},
|
|
11205
|
+
requestKey: null
|
|
11206
|
+
});
|
|
11207
|
+
return res.run;
|
|
11208
|
+
}
|
|
11209
|
+
|
|
11210
|
+
// src/commands/workflows/list.ts
|
|
11211
|
+
var STATUSES = ["pending", "running", "completed", "failed", "canceled"];
|
|
11212
|
+
function parseStatus(value) {
|
|
11213
|
+
if (!STATUSES.includes(value)) {
|
|
11214
|
+
throw new InvalidArgumentError5(`must be one of: ${STATUSES.join(", ")}`);
|
|
11215
|
+
}
|
|
11216
|
+
return value;
|
|
11217
|
+
}
|
|
11218
|
+
function parseLimit(value) {
|
|
11219
|
+
const n = Number(value);
|
|
11220
|
+
if (!Number.isInteger(n) || n < 1 || n > 500) {
|
|
11221
|
+
throw new InvalidArgumentError5("must be a whole number between 1 and 500.");
|
|
11222
|
+
}
|
|
11223
|
+
return n;
|
|
11224
|
+
}
|
|
11225
|
+
var STATUS_COLOR = {
|
|
11226
|
+
pending: pc39.yellow,
|
|
11227
|
+
running: pc39.cyan,
|
|
11228
|
+
completed: pc39.green,
|
|
11229
|
+
failed: pc39.red,
|
|
11230
|
+
canceled: pc39.dim
|
|
11231
|
+
};
|
|
11232
|
+
function formatRun(run, nameWidth) {
|
|
11233
|
+
const status3 = STATUS_COLOR[run.status](run.status.padEnd(9));
|
|
11234
|
+
const when = pc39.dim((run.finishedAt ?? run.updatedAt).replace("T", " ").slice(0, 19));
|
|
11235
|
+
const attempts = run.attempts > 1 ? pc39.dim(` \xD7${run.attempts}`) : "";
|
|
11236
|
+
const error = run.status === "failed" && run.error?.message ? pc39.red(` ${run.error.message}`) : "";
|
|
11237
|
+
return `${run.id} ${run.workflowName.padEnd(nameWidth)} ${status3}${attempts} ${when}${error}`;
|
|
11238
|
+
}
|
|
11239
|
+
var workflowsList = new Command110("list").description("list recent workflow runs").option("--status <status>", `only runs in this state (${STATUSES.join(", ")})`, parseStatus).option("--name <workflow>", "only runs of this workflow").option("--limit <n>", "how many to show", parseLimit, 50).configureHelp(helpConfig).action(
|
|
11240
|
+
(options) => runCommand(async () => {
|
|
11241
|
+
await withPocketbase(process42.cwd(), async (pb) => {
|
|
11242
|
+
const runs = await listRuns(pb, {
|
|
11243
|
+
status: options.status,
|
|
11244
|
+
workflowName: options.name,
|
|
11245
|
+
limit: options.limit
|
|
11246
|
+
});
|
|
11247
|
+
if (runs.length === 0) {
|
|
11248
|
+
p64.log.info(
|
|
11249
|
+
`No workflow runs yet.
|
|
11250
|
+
|
|
11251
|
+
Start one from server code with ${pc39.cyan("<workflow>.run(input)")}, or with ${pc39.cyan("vela workflows run <name>")}.`
|
|
11252
|
+
);
|
|
11253
|
+
return;
|
|
11254
|
+
}
|
|
11255
|
+
const width = Math.max(...runs.map((r) => r.workflowName.length));
|
|
11256
|
+
p64.log.message(runs.map((r) => formatRun(r, width)).join("\n"));
|
|
11257
|
+
});
|
|
11258
|
+
}, "Failed to list workflow runs.")
|
|
11259
|
+
);
|
|
11260
|
+
|
|
11261
|
+
// src/commands/workflows/run.ts
|
|
11262
|
+
import process43 from "node:process";
|
|
11263
|
+
import { Command as Command111, InvalidArgumentError as InvalidArgumentError6 } from "commander";
|
|
11264
|
+
import * as p65 from "@clack/prompts";
|
|
11265
|
+
import pc40 from "picocolors";
|
|
11266
|
+
function parseInput(value) {
|
|
11267
|
+
try {
|
|
11268
|
+
return JSON.parse(value);
|
|
11269
|
+
} catch {
|
|
11270
|
+
throw new InvalidArgumentError6(`must be JSON, e.g. '{"userId":"abc"}'.`);
|
|
11271
|
+
}
|
|
11272
|
+
}
|
|
11273
|
+
var workflowsRun = new Command111("run").description("start a run of a workflow; the running app picks it up").argument("<name>", "the workflow name, as in its defineWorkflow spec").argument("[input]", "the run input as JSON", parseInput).configureHelp(helpConfig).action(
|
|
11274
|
+
(name, input) => runCommand(async () => {
|
|
11275
|
+
await withPocketbase(process43.cwd(), async (pb) => {
|
|
11276
|
+
const run = await createRun(pb, name, input);
|
|
11277
|
+
p65.log.success(
|
|
11278
|
+
`Queued ${pc40.cyan(name)} as run ${pc40.bold(run.id)}.
|
|
11279
|
+
|
|
11280
|
+
It runs once the app is up (${pc40.cyan("vela dev")}); ${pc40.cyan("vela workflows list")} shows its state.`
|
|
11281
|
+
);
|
|
11282
|
+
});
|
|
11283
|
+
}, "Failed to start the workflow run.")
|
|
11284
|
+
);
|
|
11285
|
+
|
|
11286
|
+
// src/commands/workflows/cancel.ts
|
|
11287
|
+
import process44 from "node:process";
|
|
11288
|
+
import { Command as Command112 } from "commander";
|
|
11289
|
+
import * as p66 from "@clack/prompts";
|
|
11290
|
+
import pc41 from "picocolors";
|
|
11291
|
+
var workflowsCancel = new Command112("cancel").description("cancel a pending or running workflow run").argument("<run-id>", "the run id from `vela workflows list`").configureHelp(helpConfig).action(
|
|
11292
|
+
(id) => runCommand(async () => {
|
|
11293
|
+
await withPocketbase(process44.cwd(), async (pb) => {
|
|
11294
|
+
const run = await cancelRun(pb, id);
|
|
11295
|
+
p66.log.success(`Canceled run ${pc41.bold(run.id)} of ${pc41.cyan(run.workflowName)}.`);
|
|
11296
|
+
});
|
|
11297
|
+
}, "Failed to cancel the workflow run.")
|
|
11298
|
+
);
|
|
11299
|
+
|
|
11300
|
+
// src/commands/workflows.ts
|
|
11301
|
+
var workflows2 = new Command113("workflows").description("list, start and cancel background workflow runs").configureHelp(helpConfig).addCommand(workflowsList).addCommand(workflowsRun).addCommand(workflowsCancel);
|
|
10947
11302
|
|
|
10948
11303
|
// src/program.ts
|
|
10949
11304
|
var NO_BACKEND_COMMMANDS = /* @__PURE__ */ new Set([
|
|
@@ -10983,10 +11338,10 @@ var NO_BACKEND_COMMMANDS = /* @__PURE__ */ new Set([
|
|
|
10983
11338
|
]);
|
|
10984
11339
|
var BACKEND_OPTIONAL_COMMANDS = /* @__PURE__ */ new Set(["dev", "build", "preview", "deploy"]);
|
|
10985
11340
|
var SELF_CREDENTIALED_COMMANDS = /* @__PURE__ */ new Set(["test:server"]);
|
|
10986
|
-
var program = new
|
|
11341
|
+
var program = new Command114().name(package_default.name).description(package_default.description).version(package_default.version, "-v, --version").configureHelp(helpConfig);
|
|
10987
11342
|
program.hook("preAction", (_thisCommand, actionCommand) => {
|
|
10988
11343
|
if (isStub(actionCommand)) return;
|
|
10989
|
-
const envRoot = findWorkspaceRoot() ??
|
|
11344
|
+
const envRoot = findWorkspaceRoot() ?? process45.cwd();
|
|
10990
11345
|
dotenv2.config({ path: nodePath.join(envRoot, ".env"), quiet: true });
|
|
10991
11346
|
const path47 = getCommandPath(actionCommand);
|
|
10992
11347
|
if (NO_BACKEND_COMMMANDS.has(path47)) return;
|
|
@@ -10994,30 +11349,30 @@ program.hook("preAction", (_thisCommand, actionCommand) => {
|
|
|
10994
11349
|
if (NO_BACKEND_COMMMANDS.has(top)) return;
|
|
10995
11350
|
if (!hasBackend()) {
|
|
10996
11351
|
if (BACKEND_OPTIONAL_COMMANDS.has(top)) return;
|
|
10997
|
-
|
|
10998
|
-
`${
|
|
11352
|
+
p67.log.error(
|
|
11353
|
+
`${pc42.cyan(`vela ${path47}`)} needs a backend, and this project does not have one.
|
|
10999
11354
|
|
|
11000
11355
|
Static projects have no database to talk to.
|
|
11001
11356
|
|
|
11002
|
-
To add a backend to this project, run ${
|
|
11357
|
+
To add a backend to this project, run ${pc42.cyan("vela bless")}.`
|
|
11003
11358
|
);
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11359
|
+
p67.log.message();
|
|
11360
|
+
p67.cancel("Operation failed.");
|
|
11361
|
+
process45.exit(1);
|
|
11007
11362
|
}
|
|
11008
11363
|
if (SELF_CREDENTIALED_COMMANDS.has(path47)) return;
|
|
11009
|
-
if (!
|
|
11010
|
-
|
|
11364
|
+
if (!process45.env.POCKETBASE_SUPERUSER_EMAIL || !process45.env.POCKETBASE_SUPERUSER_PASSWORD) {
|
|
11365
|
+
p67.log.error(
|
|
11011
11366
|
`PocketBase superuser credentials are required.
|
|
11012
11367
|
|
|
11013
|
-
Set ${
|
|
11368
|
+
Set ${pc42.cyan("POCKETBASE_SUPERUSER_EMAIL")} and ${pc42.cyan("POCKETBASE_SUPERUSER_PASSWORD")} in your .env file.
|
|
11014
11369
|
|
|
11015
|
-
To set up a new project, run ${
|
|
11016
|
-
To set up an existing project, run ${
|
|
11370
|
+
To set up a new project, run ${pc42.cyan("vela create")}.
|
|
11371
|
+
To set up an existing project, run ${pc42.cyan("vela bless")}.`
|
|
11017
11372
|
);
|
|
11018
|
-
|
|
11019
|
-
|
|
11020
|
-
|
|
11373
|
+
p67.log.message();
|
|
11374
|
+
p67.cancel("Operation failed.");
|
|
11375
|
+
process45.exit(1);
|
|
11021
11376
|
}
|
|
11022
11377
|
});
|
|
11023
11378
|
function getCommandPath(cmd) {
|
|
@@ -11065,11 +11420,12 @@ for (const command of [
|
|
|
11065
11420
|
i18n3,
|
|
11066
11421
|
oauth,
|
|
11067
11422
|
schemas,
|
|
11068
|
-
cms2
|
|
11423
|
+
cms2,
|
|
11424
|
+
workflows2
|
|
11069
11425
|
]) {
|
|
11070
11426
|
program.addCommand(command);
|
|
11071
11427
|
}
|
|
11072
11428
|
|
|
11073
11429
|
// src/bin.ts
|
|
11074
|
-
program.parse(normalizeArgv(
|
|
11430
|
+
program.parse(normalizeArgv(process46.argv.slice(2)), { from: "user" });
|
|
11075
11431
|
//# sourceMappingURL=bin.js.map
|