vela 0.11.5 → 0.11.6
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 +835 -690
- package/dist/bin.js.map +4 -4
- package/package.json +3 -3
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 process40 from "node:process";
|
|
5
5
|
|
|
6
6
|
// src/lib/argv.ts
|
|
7
7
|
function normalizeArgv(argv) {
|
|
@@ -11,9 +11,9 @@ function normalizeArgv(argv) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
// src/program.ts
|
|
14
|
-
import
|
|
15
|
-
import * as
|
|
16
|
-
import { Command as
|
|
14
|
+
import process39 from "node:process";
|
|
15
|
+
import * as p62 from "@clack/prompts";
|
|
16
|
+
import { Command as Command105 } from "commander";
|
|
17
17
|
import nodePath from "node:path";
|
|
18
18
|
import dotenv2 from "dotenv";
|
|
19
19
|
import pc38 from "picocolors";
|
|
@@ -21,7 +21,7 @@ import pc38 from "picocolors";
|
|
|
21
21
|
// package.json
|
|
22
22
|
var package_default = {
|
|
23
23
|
name: "vela",
|
|
24
|
-
version: "0.11.
|
|
24
|
+
version: "0.11.6",
|
|
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.5",
|
|
61
61
|
"@velastack/pocketbase-codegen": "^0.1.0",
|
|
62
62
|
"annotate-json-schema": "^0.1.0",
|
|
63
63
|
commander: "^13.1.0",
|
|
@@ -66,7 +66,7 @@ var package_default = {
|
|
|
66
66
|
dotenv: "^17.4.2",
|
|
67
67
|
"fetch-cookie": "^3.2.0",
|
|
68
68
|
"json-schema-faker": "^0.6.3",
|
|
69
|
-
"magic-string": "^
|
|
69
|
+
"magic-string": "^1.2.3",
|
|
70
70
|
"package-manager-detector": "^1.8.0",
|
|
71
71
|
picocolors: "^1.1.1",
|
|
72
72
|
pocketbase: "^0.28.0",
|
|
@@ -593,10 +593,10 @@ function writeCachedIndex(cached2) {
|
|
|
593
593
|
fs5.mkdirSync(cacheRoot(), { recursive: true });
|
|
594
594
|
fs5.writeFileSync(indexCachePath(), JSON.stringify(cached2, null, 2));
|
|
595
595
|
}
|
|
596
|
-
function parseTemplateIndex(
|
|
596
|
+
function parseTemplateIndex(text19, url) {
|
|
597
597
|
let parsed;
|
|
598
598
|
try {
|
|
599
|
-
parsed = JSON.parse(
|
|
599
|
+
parsed = JSON.parse(text19);
|
|
600
600
|
} catch (e) {
|
|
601
601
|
throw new Error(`Template index at ${url} is not valid JSON: ${e.message}`);
|
|
602
602
|
}
|
|
@@ -1921,13 +1921,13 @@ import * as p5 from "@clack/prompts";
|
|
|
1921
1921
|
import { detect as detect3, resolveCommand as resolveCommand3 } from "package-manager-detector";
|
|
1922
1922
|
function optionsSchema2(listing) {
|
|
1923
1923
|
const names = listing.templates.map((template) => template.name);
|
|
1924
|
-
let
|
|
1924
|
+
let choices2 = `must be one of: ${templateChoicesMessage(listing.templates)}`;
|
|
1925
1925
|
if (listing.registryError) {
|
|
1926
|
-
|
|
1926
|
+
choices2 += ` (could not reach the template registry: ${listing.registryError})`;
|
|
1927
1927
|
}
|
|
1928
1928
|
return v4.strictObject({
|
|
1929
1929
|
install: v4.union([v4.boolean(), v4.picklist(AGENT_NAMES)], "must be a package manager"),
|
|
1930
|
-
template: v4.optional(v4.picklist(names,
|
|
1930
|
+
template: v4.optional(v4.picklist(names, choices2)),
|
|
1931
1931
|
name: v4.optional(v4.pipe(v4.string(), v4.trim(), v4.minLength(1, "must not be empty"))),
|
|
1932
1932
|
email: v4.optional(v4.pipe(v4.string(), v4.email("must be a valid email address"))),
|
|
1933
1933
|
password: v4.optional(v4.pipe(v4.string(), v4.minLength(8, "must be at least 8 characters long")))
|
|
@@ -2101,23 +2101,135 @@ import { Command as Command9 } from "commander";
|
|
|
2101
2101
|
|
|
2102
2102
|
// src/commands/generate/form.ts
|
|
2103
2103
|
import { Command as Command4 } from "commander";
|
|
2104
|
-
import * as
|
|
2104
|
+
import * as p12 from "@clack/prompts";
|
|
2105
2105
|
|
|
2106
2106
|
// src/lib/pattern-runner.ts
|
|
2107
2107
|
import path15 from "node:path";
|
|
2108
|
+
import * as p7 from "@clack/prompts";
|
|
2109
|
+
import { bySlug as bySlug2 } from "@velastack/patterns";
|
|
2110
|
+
|
|
2111
|
+
// src/lib/providers.ts
|
|
2112
|
+
import process9 from "node:process";
|
|
2108
2113
|
import * as p6 from "@clack/prompts";
|
|
2109
2114
|
import { bySlug } from "@velastack/patterns";
|
|
2115
|
+
function capabilityName(slug2) {
|
|
2116
|
+
return slug2.replace(/^enable-/, "");
|
|
2117
|
+
}
|
|
2118
|
+
function choices(providers) {
|
|
2119
|
+
return `--provider <${providers.map((provider) => provider.id).join("|")}>`;
|
|
2120
|
+
}
|
|
2121
|
+
function unknownProviderMessage(name, raw, providers) {
|
|
2122
|
+
return [
|
|
2123
|
+
`Unknown provider "${raw}" for ${name}.`,
|
|
2124
|
+
"",
|
|
2125
|
+
"Available providers:",
|
|
2126
|
+
...providers.map((provider) => ` ${provider.id}`)
|
|
2127
|
+
].join("\n");
|
|
2128
|
+
}
|
|
2129
|
+
function decideProvider(request) {
|
|
2130
|
+
const { patternName, providers, flagValue, interactive } = request;
|
|
2131
|
+
if (flagValue !== void 0) {
|
|
2132
|
+
const provider = providers.find((candidate) => candidate.id === flagValue);
|
|
2133
|
+
if (!provider) {
|
|
2134
|
+
return { kind: "error", message: unknownProviderMessage(patternName, flagValue, providers) };
|
|
2135
|
+
}
|
|
2136
|
+
return { kind: "use", provider };
|
|
2137
|
+
}
|
|
2138
|
+
if (interactive) return { kind: "prompt" };
|
|
2139
|
+
return {
|
|
2140
|
+
kind: "error",
|
|
2141
|
+
message: `Choose ${article(patternName)} ${patternName} provider: pass ${choices(providers)}. There is no terminal to ask on.`
|
|
2142
|
+
};
|
|
2143
|
+
}
|
|
2144
|
+
function article(word) {
|
|
2145
|
+
return /^[aeiou]/i.test(word) ? "an" : "a";
|
|
2146
|
+
}
|
|
2147
|
+
function isInteractive() {
|
|
2148
|
+
return Boolean(process9.stdout.isTTY) && !process9.env.CI;
|
|
2149
|
+
}
|
|
2150
|
+
function providerFlagInArgv(argv) {
|
|
2151
|
+
return argv.some((arg) => arg === "--provider" || arg.startsWith("--provider="));
|
|
2152
|
+
}
|
|
2153
|
+
function checkProviderInput(pattern, argv, input) {
|
|
2154
|
+
const providers = pattern.providers ?? [];
|
|
2155
|
+
if (providers.length > 0) {
|
|
2156
|
+
if (typeof input.provider !== "string" || input.provider.length === 0) {
|
|
2157
|
+
throw new Error(`${pattern.title} needs a provider. Pass ${choices(providers)}.`);
|
|
2158
|
+
}
|
|
2159
|
+
return;
|
|
2160
|
+
}
|
|
2161
|
+
if (providerFlagInArgv(argv)) {
|
|
2162
|
+
throw new Error(`${pattern.title} does not support --provider.`);
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
async function resolveProvider(slug2, flagValue) {
|
|
2166
|
+
const pattern = bySlug[slug2];
|
|
2167
|
+
const providers = pattern.providers ?? [];
|
|
2168
|
+
if (providers.length === 0) {
|
|
2169
|
+
throw new Error(`${pattern.title} does not support --provider.`);
|
|
2170
|
+
}
|
|
2171
|
+
const patternName = capabilityName(slug2);
|
|
2172
|
+
const decision = decideProvider({
|
|
2173
|
+
patternName,
|
|
2174
|
+
providers,
|
|
2175
|
+
flagValue,
|
|
2176
|
+
interactive: isInteractive()
|
|
2177
|
+
});
|
|
2178
|
+
if (decision.kind === "error") throw new Error(decision.message);
|
|
2179
|
+
if (decision.kind === "use") return decision.provider;
|
|
2180
|
+
const selected = await p6.select({
|
|
2181
|
+
message: `Select ${patternName} provider`,
|
|
2182
|
+
options: providers.map((provider) => ({ value: provider.id, label: provider.label }))
|
|
2183
|
+
});
|
|
2184
|
+
if (p6.isCancel(selected)) {
|
|
2185
|
+
p6.cancel("Operation cancelled.");
|
|
2186
|
+
process9.exit(0);
|
|
2187
|
+
}
|
|
2188
|
+
return providers.find((provider) => provider.id === selected);
|
|
2189
|
+
}
|
|
2190
|
+
async function collectProviderEnv(provider) {
|
|
2191
|
+
const values = {};
|
|
2192
|
+
const interactive = isInteractive();
|
|
2193
|
+
for (const variable of provider.env ?? []) {
|
|
2194
|
+
const existing = process9.env[variable.key];
|
|
2195
|
+
if (existing) {
|
|
2196
|
+
values[variable.key] = existing;
|
|
2197
|
+
continue;
|
|
2198
|
+
}
|
|
2199
|
+
if (!interactive) {
|
|
2200
|
+
values[variable.key] = variable.default ?? "";
|
|
2201
|
+
continue;
|
|
2202
|
+
}
|
|
2203
|
+
const value = await p6.text({
|
|
2204
|
+
message: variable.label,
|
|
2205
|
+
placeholder: variable.placeholder,
|
|
2206
|
+
initialValue: variable.default
|
|
2207
|
+
});
|
|
2208
|
+
if (p6.isCancel(value)) {
|
|
2209
|
+
p6.cancel("Operation cancelled.");
|
|
2210
|
+
process9.exit(0);
|
|
2211
|
+
}
|
|
2212
|
+
values[variable.key] = (value ?? "").trim();
|
|
2213
|
+
}
|
|
2214
|
+
return values;
|
|
2215
|
+
}
|
|
2216
|
+
function missingEnvKeys(provider, values) {
|
|
2217
|
+
return (provider.env ?? []).filter((variable) => !(values[variable.key] ?? "").trim() && !variable.default).map((variable) => variable.key);
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
// src/lib/pattern-runner.ts
|
|
2110
2221
|
function toRelative(root, filePath) {
|
|
2111
2222
|
return path15.isAbsolute(filePath) ? path15.relative(root, filePath) : filePath;
|
|
2112
2223
|
}
|
|
2113
2224
|
var isSuccess = (f) => (f.status ?? "success") === "success";
|
|
2114
2225
|
async function runPattern(slug2, argv, input, report4) {
|
|
2115
|
-
const pattern =
|
|
2226
|
+
const pattern = bySlug2[slug2];
|
|
2116
2227
|
if (!pattern) {
|
|
2117
2228
|
throw new Error(`Unknown pattern: ${slug2}`);
|
|
2118
2229
|
}
|
|
2230
|
+
checkProviderInput(pattern, argv, input);
|
|
2119
2231
|
const { workspaceRootDir, features } = await getWorkspace();
|
|
2120
|
-
const log45 =
|
|
2232
|
+
const log45 = p7.taskLog({ title: report4.task.title });
|
|
2121
2233
|
let result;
|
|
2122
2234
|
try {
|
|
2123
2235
|
result = await pattern.generate({
|
|
@@ -2156,7 +2268,7 @@ async function runPattern(slug2, argv, input, report4) {
|
|
|
2156
2268
|
const deleted = result.deletes.filter(isSuccess);
|
|
2157
2269
|
const totalChanges = created.length + modified.length + deleted.length + result.components.length + result.packages.length + result.collections.length;
|
|
2158
2270
|
if (totalChanges === 0 && failures.length === 0) {
|
|
2159
|
-
|
|
2271
|
+
p7.log.info(`${pattern.title ?? slug2} produced no changes.`);
|
|
2160
2272
|
return;
|
|
2161
2273
|
}
|
|
2162
2274
|
reportResult({
|
|
@@ -2177,7 +2289,7 @@ async function runPattern(slug2, argv, input, report4) {
|
|
|
2177
2289
|
// src/lib/ai-flow.ts
|
|
2178
2290
|
import fs18 from "node:fs";
|
|
2179
2291
|
import path17 from "node:path";
|
|
2180
|
-
import * as
|
|
2292
|
+
import * as p11 from "@clack/prompts";
|
|
2181
2293
|
import pc4 from "picocolors";
|
|
2182
2294
|
|
|
2183
2295
|
// src/lib/project-config.ts
|
|
@@ -2250,14 +2362,14 @@ var aiSchema = (workspaceRootDir, body) => aiPost(workspaceRootDir, "schema", bo
|
|
|
2250
2362
|
var aiForm = (workspaceRootDir, body) => aiPost(workspaceRootDir, "form", body);
|
|
2251
2363
|
|
|
2252
2364
|
// src/lib/ai-loop.ts
|
|
2253
|
-
import * as
|
|
2365
|
+
import * as p8 from "@clack/prompts";
|
|
2254
2366
|
async function aiLoop(opts) {
|
|
2255
2367
|
let prompt = opts.initialPrompt;
|
|
2256
2368
|
let history = [];
|
|
2257
2369
|
let attempt = 0;
|
|
2258
2370
|
while (true) {
|
|
2259
2371
|
attempt++;
|
|
2260
|
-
const spinner7 =
|
|
2372
|
+
const spinner7 = p8.spinner();
|
|
2261
2373
|
spinner7.start(`${opts.stageLabel} (${attempt > 1 ? "iteration " + attempt : "first pass"})\u2026`);
|
|
2262
2374
|
let result;
|
|
2263
2375
|
let turn;
|
|
@@ -2271,12 +2383,12 @@ async function aiLoop(opts) {
|
|
|
2271
2383
|
throw e;
|
|
2272
2384
|
}
|
|
2273
2385
|
opts.renderPreview(result);
|
|
2274
|
-
const next = await
|
|
2386
|
+
const next = await p8.text({
|
|
2275
2387
|
message: "Refine the result, or press Enter to apply.",
|
|
2276
2388
|
placeholder: opts.refinePlaceholder,
|
|
2277
2389
|
defaultValue: ""
|
|
2278
2390
|
});
|
|
2279
|
-
if (
|
|
2391
|
+
if (p8.isCancel(next)) return null;
|
|
2280
2392
|
const trimmed = (typeof next === "string" ? next : "").trim();
|
|
2281
2393
|
if (trimmed === "") return result;
|
|
2282
2394
|
history = turn;
|
|
@@ -2285,7 +2397,7 @@ async function aiLoop(opts) {
|
|
|
2285
2397
|
}
|
|
2286
2398
|
|
|
2287
2399
|
// src/lib/ai-existing-models.ts
|
|
2288
|
-
import * as
|
|
2400
|
+
import * as p9 from "@clack/prompts";
|
|
2289
2401
|
async function loadExistingModels(workspaceRootDir) {
|
|
2290
2402
|
let result = [];
|
|
2291
2403
|
try {
|
|
@@ -2310,7 +2422,7 @@ async function loadExistingModels(workspaceRootDir) {
|
|
|
2310
2422
|
});
|
|
2311
2423
|
} catch (e) {
|
|
2312
2424
|
const msg = e instanceof Error ? e.message : String(e);
|
|
2313
|
-
|
|
2425
|
+
p9.log.warn(
|
|
2314
2426
|
`Could not load existing schema from PocketBase (${msg}). The AI agent will design without that context.`
|
|
2315
2427
|
);
|
|
2316
2428
|
return [];
|
|
@@ -2319,7 +2431,7 @@ async function loadExistingModels(workspaceRootDir) {
|
|
|
2319
2431
|
}
|
|
2320
2432
|
|
|
2321
2433
|
// src/lib/ai-to-argv.ts
|
|
2322
|
-
import * as
|
|
2434
|
+
import * as p10 from "@clack/prompts";
|
|
2323
2435
|
var PRIMITIVE_TYPES = /* @__PURE__ */ new Set(["text", "number", "bool", "email", "date", "url", "file"]);
|
|
2324
2436
|
function singularize(name) {
|
|
2325
2437
|
if (name.endsWith("ies") && name.length > 3) return `${name.slice(0, -3)}y`;
|
|
@@ -2342,7 +2454,7 @@ function collectionSpecToArgv(spec) {
|
|
|
2342
2454
|
for (const field of spec.fields) {
|
|
2343
2455
|
const type = typeArg(field);
|
|
2344
2456
|
if (type === null) {
|
|
2345
|
-
|
|
2457
|
+
p10.log.warn(
|
|
2346
2458
|
`Skipping field "${field.name}" (type "${field.type}" cannot be represented as a pattern argument)`
|
|
2347
2459
|
);
|
|
2348
2460
|
continue;
|
|
@@ -2445,10 +2557,10 @@ function renderModel(spec) {
|
|
|
2445
2557
|
const tail = extra.length > 0 ? " " + pc4.dim(extra.join(" ")) : "";
|
|
2446
2558
|
lines.push(` ${f.name.padEnd(nameWidth)} ${f.type.padEnd(typeWidth)} ${required}${tail}`);
|
|
2447
2559
|
}
|
|
2448
|
-
|
|
2560
|
+
p11.log.message(lines.join("\n"));
|
|
2449
2561
|
}
|
|
2450
2562
|
function renderLayout(layout) {
|
|
2451
|
-
|
|
2563
|
+
p11.log.message(renderGrid(layout));
|
|
2452
2564
|
}
|
|
2453
2565
|
async function runSchemaStage(opts) {
|
|
2454
2566
|
const { workspaceRootDir } = await getWorkspace();
|
|
@@ -2512,12 +2624,12 @@ var form = new Command4("form").description("generate a form from a model").argu
|
|
|
2512
2624
|
}
|
|
2513
2625
|
const stage2 = await runSchemaStage({ prompt: options.ai, useCase: "form" });
|
|
2514
2626
|
if (!stage2) {
|
|
2515
|
-
|
|
2627
|
+
p12.cancel("Aborted before any files were written.");
|
|
2516
2628
|
return;
|
|
2517
2629
|
}
|
|
2518
2630
|
const layout = await runLayoutStage(stage2.workspaceRootDir, stage2.model);
|
|
2519
2631
|
if (!layout) {
|
|
2520
|
-
|
|
2632
|
+
p12.cancel("Aborted before any files were written.");
|
|
2521
2633
|
return;
|
|
2522
2634
|
}
|
|
2523
2635
|
argv = specToArgv(stage2.model);
|
|
@@ -2559,7 +2671,7 @@ var form = new Command4("form").description("generate a form from a model").argu
|
|
|
2559
2671
|
|
|
2560
2672
|
// src/commands/generate/schema.ts
|
|
2561
2673
|
import { Command as Command5 } from "commander";
|
|
2562
|
-
import * as
|
|
2674
|
+
import * as p13 from "@clack/prompts";
|
|
2563
2675
|
var schema = new Command5("schema").description("generate a schema from a model").argument("[model]", "model name").argument("[fields...]", "field definitions").option("--ai <description>", "design the schema with AI from a natural-language description").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
2564
2676
|
(model, fields, options) => runCommand(async () => {
|
|
2565
2677
|
let argv;
|
|
@@ -2570,7 +2682,7 @@ var schema = new Command5("schema").description("generate a schema from a model"
|
|
|
2570
2682
|
}
|
|
2571
2683
|
const stage2 = await runSchemaStage({ prompt: options.ai, useCase: "schema" });
|
|
2572
2684
|
if (!stage2) {
|
|
2573
|
-
|
|
2685
|
+
p13.cancel("Aborted before any files were written.");
|
|
2574
2686
|
return;
|
|
2575
2687
|
}
|
|
2576
2688
|
argv = specToArgv(stage2.model);
|
|
@@ -2630,7 +2742,7 @@ var resource = new Command6("resource").description("generate a resource (model
|
|
|
2630
2742
|
|
|
2631
2743
|
// src/commands/generate/scaffold.ts
|
|
2632
2744
|
import { Command as Command7 } from "commander";
|
|
2633
|
-
import * as
|
|
2745
|
+
import * as p14 from "@clack/prompts";
|
|
2634
2746
|
var scaffold = new Command7("scaffold").description("generate a full CRUD scaffold (model, forms, list, detail)").argument("[model]", "model name").argument("[fields...]", "field definitions").option("--remote", "generate a scaffold backed by a remote PocketBase collection").option(
|
|
2635
2747
|
"--route <route>",
|
|
2636
2748
|
'place the scaffold at a custom route (e.g. "(app)/[team_id]/projects"). Defaults to the pluralized model name under (app)/(public).'
|
|
@@ -2648,12 +2760,12 @@ var scaffold = new Command7("scaffold").description("generate a full CRUD scaffo
|
|
|
2648
2760
|
}
|
|
2649
2761
|
const stage2 = await runSchemaStage({ prompt: options.ai, useCase: "scaffold" });
|
|
2650
2762
|
if (!stage2) {
|
|
2651
|
-
|
|
2763
|
+
p14.cancel("Aborted before any files were written.");
|
|
2652
2764
|
return;
|
|
2653
2765
|
}
|
|
2654
2766
|
const layout = await runLayoutStage(stage2.workspaceRootDir, stage2.model);
|
|
2655
2767
|
if (!layout) {
|
|
2656
|
-
|
|
2768
|
+
p14.cancel("Aborted before any files were written.");
|
|
2657
2769
|
return;
|
|
2658
2770
|
}
|
|
2659
2771
|
argv = specToArgv(stage2.model);
|
|
@@ -2723,11 +2835,42 @@ var migration = new Command8("migration").description("generate a migration for
|
|
|
2723
2835
|
var generate = new Command9("generate").description("generate scaffolding for database models and forms").configureHelp(helpConfig).addCommand(form).addCommand(schema).addCommand(resource).addCommand(scaffold).addCommand(migration);
|
|
2724
2836
|
|
|
2725
2837
|
// src/commands/enable.ts
|
|
2726
|
-
import { Command as
|
|
2838
|
+
import { Command as Command25 } from "commander";
|
|
2727
2839
|
|
|
2728
|
-
// src/commands/enable/
|
|
2840
|
+
// src/commands/enable/analytics.ts
|
|
2729
2841
|
import { Command as Command10 } from "commander";
|
|
2730
|
-
var
|
|
2842
|
+
var analytics = new Command10("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(
|
|
2843
|
+
(opts, cmd) => runCommand(async () => {
|
|
2844
|
+
const provider = await resolveProvider("enable-analytics", opts.provider);
|
|
2845
|
+
const providerEnv = await collectProviderEnv(provider);
|
|
2846
|
+
const blank = missingEnvKeys(provider, providerEnv);
|
|
2847
|
+
await runPattern(
|
|
2848
|
+
"enable-analytics",
|
|
2849
|
+
cmd.args,
|
|
2850
|
+
{ provider: provider.id, providerEnv },
|
|
2851
|
+
{
|
|
2852
|
+
summary: `Enabled analytics with ${provider.label}.`,
|
|
2853
|
+
nextSteps: [
|
|
2854
|
+
...blank.map(
|
|
2855
|
+
(key) => `Set ${key} in .env; the analytics component renders nothing until it is set.`
|
|
2856
|
+
),
|
|
2857
|
+
`Run \`vela dev\` and look for a page view in ${provider.label}.`,
|
|
2858
|
+
"Set the same PUBLIC_* variables on each deploy target with `vela env set`.",
|
|
2859
|
+
"The component lives in src/lib/components/analytics/analytics.svelte; edit it freely."
|
|
2860
|
+
],
|
|
2861
|
+
task: {
|
|
2862
|
+
title: "Enabling analytics",
|
|
2863
|
+
success: `Enabled analytics with ${provider.label}`,
|
|
2864
|
+
error: "Failed to enable analytics"
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
);
|
|
2868
|
+
}, "Failed to enable analytics.")
|
|
2869
|
+
);
|
|
2870
|
+
|
|
2871
|
+
// src/commands/enable/auth.ts
|
|
2872
|
+
import { Command as Command11 } from "commander";
|
|
2873
|
+
var auth = new Command11("auth").description("enable authentication (email/password + OAuth scaffold)").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
2731
2874
|
(_opts, cmd) => runCommand(
|
|
2732
2875
|
() => runPattern(
|
|
2733
2876
|
"enable-auth",
|
|
@@ -2752,8 +2895,8 @@ var auth = new Command10("auth").description("enable authentication (email/passw
|
|
|
2752
2895
|
);
|
|
2753
2896
|
|
|
2754
2897
|
// src/commands/enable/api.ts
|
|
2755
|
-
import { Command as
|
|
2756
|
-
var api = new
|
|
2898
|
+
import { Command as Command12 } from "commander";
|
|
2899
|
+
var api = new Command12("api").description("enable the PocketBase REST API").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
2757
2900
|
(_opts, cmd) => runCommand(
|
|
2758
2901
|
() => runPattern(
|
|
2759
2902
|
"enable-api",
|
|
@@ -2778,8 +2921,8 @@ var api = new Command11("api").description("enable the PocketBase REST API").all
|
|
|
2778
2921
|
);
|
|
2779
2922
|
|
|
2780
2923
|
// src/commands/enable/api-keys.ts
|
|
2781
|
-
import { Command as
|
|
2782
|
-
var apiKeys = new
|
|
2924
|
+
import { Command as Command13 } from "commander";
|
|
2925
|
+
var apiKeys = new Command13("api-keys").description("enable API key management").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
2783
2926
|
(_opts, cmd) => runCommand(
|
|
2784
2927
|
() => runPattern(
|
|
2785
2928
|
"enable-api-keys",
|
|
@@ -2804,8 +2947,8 @@ var apiKeys = new Command12("api-keys").description("enable API key management")
|
|
|
2804
2947
|
);
|
|
2805
2948
|
|
|
2806
2949
|
// src/commands/enable/backend.ts
|
|
2807
|
-
import { Command as
|
|
2808
|
-
var backend = new
|
|
2950
|
+
import { Command as Command14 } from "commander";
|
|
2951
|
+
var backend = new Command14("backend").description("enable the PocketBase backend").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
2809
2952
|
(_opts, cmd) => runCommand(
|
|
2810
2953
|
() => runPattern(
|
|
2811
2954
|
"enable-backend",
|
|
@@ -2830,8 +2973,8 @@ var backend = new Command13("backend").description("enable the PocketBase backen
|
|
|
2830
2973
|
);
|
|
2831
2974
|
|
|
2832
2975
|
// src/commands/enable/i18n.ts
|
|
2833
|
-
import { Command as
|
|
2834
|
-
var i18n = new
|
|
2976
|
+
import { Command as Command15 } from "commander";
|
|
2977
|
+
var i18n = new Command15("i18n").description("enable internationalization").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
2835
2978
|
(_opts, cmd) => runCommand(
|
|
2836
2979
|
() => runPattern(
|
|
2837
2980
|
"enable-i18n",
|
|
@@ -2856,8 +2999,8 @@ var i18n = new Command14("i18n").description("enable internationalization").allo
|
|
|
2856
2999
|
);
|
|
2857
3000
|
|
|
2858
3001
|
// src/commands/enable/teams.ts
|
|
2859
|
-
import { Command as
|
|
2860
|
-
var teams = new
|
|
3002
|
+
import { Command as Command16 } from "commander";
|
|
3003
|
+
var teams = new Command16("teams").description("enable team / multi-tenant support").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
2861
3004
|
(_opts, cmd) => runCommand(
|
|
2862
3005
|
() => runPattern(
|
|
2863
3006
|
"enable-teams",
|
|
@@ -2882,13 +3025,13 @@ var teams = new Command15("teams").description("enable team / multi-tenant suppo
|
|
|
2882
3025
|
);
|
|
2883
3026
|
|
|
2884
3027
|
// src/commands/enable/payments.ts
|
|
2885
|
-
import
|
|
2886
|
-
import { Command as
|
|
2887
|
-
import * as
|
|
3028
|
+
import process10 from "node:process";
|
|
3029
|
+
import { Command as Command17 } from "commander";
|
|
3030
|
+
import * as p15 from "@clack/prompts";
|
|
2888
3031
|
var PROVIDERS = [{ value: "stripe", label: "Stripe" }];
|
|
2889
|
-
var payments = new
|
|
3032
|
+
var payments = new Command17("payments").description("enable payments").option("--provider <provider>", "payment provider", "stripe").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
2890
3033
|
(opts, cmd) => runCommand(async () => {
|
|
2891
|
-
const provider = await
|
|
3034
|
+
const provider = await resolveProvider2(opts.provider, cmd.getOptionValueSource("provider"));
|
|
2892
3035
|
const input = {
|
|
2893
3036
|
provider,
|
|
2894
3037
|
stripeSecretKey: await ensureKey("STRIPE_SECRET_KEY", "Stripe secret key (sk_...)"),
|
|
@@ -2914,28 +3057,28 @@ var payments = new Command16("payments").description("enable payments").option("
|
|
|
2914
3057
|
});
|
|
2915
3058
|
}, "Failed to enable payments.")
|
|
2916
3059
|
);
|
|
2917
|
-
async function
|
|
3060
|
+
async function resolveProvider2(value, source) {
|
|
2918
3061
|
if (source && source !== "default") {
|
|
2919
3062
|
if (!PROVIDERS.some((o) => o.value === value)) {
|
|
2920
3063
|
throw new Error(`Unknown payment provider: ${value}`);
|
|
2921
3064
|
}
|
|
2922
3065
|
return value;
|
|
2923
3066
|
}
|
|
2924
|
-
const selected = await
|
|
3067
|
+
const selected = await p15.select({
|
|
2925
3068
|
message: "Which payment provider?",
|
|
2926
3069
|
options: PROVIDERS,
|
|
2927
3070
|
initialValue: "stripe"
|
|
2928
3071
|
});
|
|
2929
|
-
if (
|
|
2930
|
-
|
|
2931
|
-
|
|
3072
|
+
if (p15.isCancel(selected)) {
|
|
3073
|
+
p15.cancel("Operation cancelled.");
|
|
3074
|
+
process10.exit(0);
|
|
2932
3075
|
}
|
|
2933
3076
|
return selected;
|
|
2934
3077
|
}
|
|
2935
3078
|
async function ensureWebhookSecret() {
|
|
2936
|
-
const existing =
|
|
3079
|
+
const existing = process10.env.STRIPE_WEBHOOK_SECRET;
|
|
2937
3080
|
if (existing) return existing;
|
|
2938
|
-
|
|
3081
|
+
p15.note(
|
|
2939
3082
|
[
|
|
2940
3083
|
"Download the Stripe CLI (https://stripe.com/docs/stripe-cli), then run:",
|
|
2941
3084
|
" stripe listen --forward-to localhost:5173/webhooks/stripe",
|
|
@@ -2947,7 +3090,7 @@ async function ensureWebhookSecret() {
|
|
|
2947
3090
|
return promptPassword("Stripe webhook signing secret (whsec_...)");
|
|
2948
3091
|
}
|
|
2949
3092
|
async function ensurePriceId() {
|
|
2950
|
-
|
|
3093
|
+
p15.note(
|
|
2951
3094
|
[
|
|
2952
3095
|
"Stripe checkout requires a product and price_id.",
|
|
2953
3096
|
"If you have a demo product price_id, enter it below, or leave blank to create a demo one for you."
|
|
@@ -2955,36 +3098,36 @@ async function ensurePriceId() {
|
|
|
2955
3098
|
"Stripe demo product",
|
|
2956
3099
|
{ format: (line) => line }
|
|
2957
3100
|
);
|
|
2958
|
-
const value = await
|
|
3101
|
+
const value = await p15.text({
|
|
2959
3102
|
message: "Stripe price_id (price_...)",
|
|
2960
3103
|
placeholder: "leave blank to create a demo product"
|
|
2961
3104
|
});
|
|
2962
|
-
if (
|
|
2963
|
-
|
|
2964
|
-
|
|
3105
|
+
if (p15.isCancel(value)) {
|
|
3106
|
+
p15.cancel("Operation cancelled.");
|
|
3107
|
+
process10.exit(0);
|
|
2965
3108
|
}
|
|
2966
3109
|
return (value ?? "").trim();
|
|
2967
3110
|
}
|
|
2968
3111
|
async function ensureKey(envVar, message) {
|
|
2969
|
-
const existing =
|
|
3112
|
+
const existing = process10.env[envVar];
|
|
2970
3113
|
if (existing) return existing;
|
|
2971
3114
|
return promptPassword(message);
|
|
2972
3115
|
}
|
|
2973
3116
|
async function promptPassword(message) {
|
|
2974
|
-
const value = await
|
|
3117
|
+
const value = await p15.password({
|
|
2975
3118
|
message,
|
|
2976
3119
|
validate: (v10) => v10 && v10.length ? void 0 : "Required"
|
|
2977
3120
|
});
|
|
2978
|
-
if (
|
|
2979
|
-
|
|
2980
|
-
|
|
3121
|
+
if (p15.isCancel(value)) {
|
|
3122
|
+
p15.cancel("Operation cancelled.");
|
|
3123
|
+
process10.exit(0);
|
|
2981
3124
|
}
|
|
2982
3125
|
return value;
|
|
2983
3126
|
}
|
|
2984
3127
|
|
|
2985
3128
|
// src/commands/enable/subscriptions.ts
|
|
2986
|
-
import { Command as
|
|
2987
|
-
var subscriptions = new
|
|
3129
|
+
import { Command as Command18 } from "commander";
|
|
3130
|
+
var subscriptions = new Command18("subscriptions").description("enable Stripe subscriptions (requires auth and payments)").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
2988
3131
|
(_opts, cmd) => runCommand(
|
|
2989
3132
|
() => runPattern(
|
|
2990
3133
|
"enable-subscriptions",
|
|
@@ -3009,8 +3152,8 @@ var subscriptions = new Command17("subscriptions").description("enable Stripe su
|
|
|
3009
3152
|
);
|
|
3010
3153
|
|
|
3011
3154
|
// src/commands/enable/notifications.ts
|
|
3012
|
-
import { Command as
|
|
3013
|
-
var notifications = new
|
|
3155
|
+
import { Command as Command19 } from "commander";
|
|
3156
|
+
var notifications = new Command19("notifications").description("enable in-app notifications with a bell dropdown (requires auth)").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
3014
3157
|
(_opts, cmd) => runCommand(
|
|
3015
3158
|
() => runPattern(
|
|
3016
3159
|
"enable-notifications",
|
|
@@ -3035,15 +3178,15 @@ var notifications = new Command18("notifications").description("enable in-app no
|
|
|
3035
3178
|
);
|
|
3036
3179
|
|
|
3037
3180
|
// src/commands/enable/s3.ts
|
|
3038
|
-
import
|
|
3039
|
-
import { Command as
|
|
3040
|
-
import * as
|
|
3181
|
+
import process14 from "node:process";
|
|
3182
|
+
import { Command as Command20 } from "commander";
|
|
3183
|
+
import * as p18 from "@clack/prompts";
|
|
3041
3184
|
import pc8 from "picocolors";
|
|
3042
3185
|
|
|
3043
3186
|
// src/lib/server-command.ts
|
|
3044
|
-
import
|
|
3187
|
+
import process13 from "node:process";
|
|
3045
3188
|
import * as v6 from "valibot";
|
|
3046
|
-
import * as
|
|
3189
|
+
import * as p16 from "@clack/prompts";
|
|
3047
3190
|
import pc5 from "picocolors";
|
|
3048
3191
|
|
|
3049
3192
|
// src/lib/deploy-config.ts
|
|
@@ -3220,7 +3363,7 @@ import fs20 from "node:fs";
|
|
|
3220
3363
|
import os3 from "node:os";
|
|
3221
3364
|
import path19 from "node:path";
|
|
3222
3365
|
import crypto3 from "node:crypto";
|
|
3223
|
-
import
|
|
3366
|
+
import process11 from "node:process";
|
|
3224
3367
|
import { spawn as spawn2 } from "node:child_process";
|
|
3225
3368
|
var RemoteCommandError = class extends Error {
|
|
3226
3369
|
exitCode;
|
|
@@ -3498,17 +3641,17 @@ function spawnCapture(command, args, opts = {}) {
|
|
|
3498
3641
|
const child = spawn2(command, args, {
|
|
3499
3642
|
stdio,
|
|
3500
3643
|
cwd: opts.cwd,
|
|
3501
|
-
env: opts.env ? { ...
|
|
3644
|
+
env: opts.env ? { ...process11.env, ...opts.env } : void 0
|
|
3502
3645
|
});
|
|
3503
3646
|
let stdout = "";
|
|
3504
3647
|
let stderr = "";
|
|
3505
3648
|
child.stdout?.on("data", (chunk) => {
|
|
3506
3649
|
stdout += chunk;
|
|
3507
|
-
if (opts.streamStdout)
|
|
3650
|
+
if (opts.streamStdout) process11.stdout.write(chunk);
|
|
3508
3651
|
});
|
|
3509
3652
|
child.stderr?.on("data", (chunk) => {
|
|
3510
3653
|
stderr += chunk;
|
|
3511
|
-
if (opts.stream)
|
|
3654
|
+
if (opts.stream) process11.stderr.write(chunk);
|
|
3512
3655
|
});
|
|
3513
3656
|
child.on("error", reject);
|
|
3514
3657
|
child.on("close", (code) => resolve2({ stdout, stderr, exitCode: code ?? 1 }));
|
|
@@ -3615,7 +3758,7 @@ function sshOptionsFrom(options) {
|
|
|
3615
3758
|
import crypto4 from "node:crypto";
|
|
3616
3759
|
import fs22 from "node:fs";
|
|
3617
3760
|
import path21 from "node:path";
|
|
3618
|
-
import
|
|
3761
|
+
import process12 from "node:process";
|
|
3619
3762
|
var VELA_ROOT = "/var/lib/vela";
|
|
3620
3763
|
var VELA_ETC = "/etc/vela";
|
|
3621
3764
|
var VELA_USER = "vela";
|
|
@@ -3652,7 +3795,7 @@ async function syncServerScripts(session) {
|
|
|
3652
3795
|
const dir = `${SCRIPT_VERSIONS_DIR}/${digest}`;
|
|
3653
3796
|
const present = await session.script(`[ -d "$1" ] && echo yes || echo no`, { args: [dir] });
|
|
3654
3797
|
if (present.stdout.trim() !== "yes") {
|
|
3655
|
-
const incoming = `${SCRIPT_VERSIONS_DIR}/.incoming.${digest}.${
|
|
3798
|
+
const incoming = `${SCRIPT_VERSIONS_DIR}/.incoming.${digest}.${process12.pid}.${Date.now()}`;
|
|
3656
3799
|
await session.script(`mkdir -p "$1" && chmod 0755 "$(dirname "$1")" "$1"`, {
|
|
3657
3800
|
args: [incoming]
|
|
3658
3801
|
});
|
|
@@ -3911,8 +4054,8 @@ function describeTarget(target) {
|
|
|
3911
4054
|
return target.name;
|
|
3912
4055
|
}
|
|
3913
4056
|
}
|
|
3914
|
-
function bold(
|
|
3915
|
-
return `\`${
|
|
4057
|
+
function bold(text19) {
|
|
4058
|
+
return `\`${text19}\``;
|
|
3916
4059
|
}
|
|
3917
4060
|
|
|
3918
4061
|
// src/lib/server-command.ts
|
|
@@ -4016,7 +4159,7 @@ async function ensureBinding(workspaceRootDir, target, request = {}) {
|
|
|
4016
4159
|
writeBinding(workspaceRootDir, key, binding);
|
|
4017
4160
|
}
|
|
4018
4161
|
if (moving) {
|
|
4019
|
-
|
|
4162
|
+
p16.log.warn(
|
|
4020
4163
|
`${pc5.cyan(bindingName(target))} now points at ${pc5.cyan(server)}.
|
|
4021
4164
|
|
|
4022
4165
|
Whatever is running on ${existing.server} is left there, and this project can no
|
|
@@ -4027,7 +4170,7 @@ longer reach it. Remove it there first if that was not intended.`
|
|
|
4027
4170
|
}
|
|
4028
4171
|
async function confirmMove(target, from, to) {
|
|
4029
4172
|
const name = bindingName(target);
|
|
4030
|
-
if (!
|
|
4173
|
+
if (!process13.stdout.isTTY || process13.env.CI) {
|
|
4031
4174
|
throw new Error(
|
|
4032
4175
|
`${pc5.cyan(`--server ${to}`)} does not match the server recorded for ${pc5.cyan(name)}, ${pc5.cyan(from)}.
|
|
4033
4176
|
|
|
@@ -4035,13 +4178,13 @@ Drop ${pc5.cyan("--server")} to use the recorded one, or move the binding on pur
|
|
|
4035
4178
|
this command once from a terminal (or editing .vela/project.json).`
|
|
4036
4179
|
);
|
|
4037
4180
|
}
|
|
4038
|
-
const ok = await
|
|
4181
|
+
const ok = await p16.confirm({
|
|
4039
4182
|
message: `${name} ${target.kind === "preview" ? "run" : "runs"} on ${from}. Point ${name} at ${to} instead?`,
|
|
4040
4183
|
initialValue: false
|
|
4041
4184
|
});
|
|
4042
|
-
if (
|
|
4043
|
-
|
|
4044
|
-
|
|
4185
|
+
if (p16.isCancel(ok) || !ok) {
|
|
4186
|
+
p16.cancel("Operation cancelled.");
|
|
4187
|
+
process13.exit(0);
|
|
4045
4188
|
}
|
|
4046
4189
|
}
|
|
4047
4190
|
function bindingName(target) {
|
|
@@ -4049,7 +4192,7 @@ function bindingName(target) {
|
|
|
4049
4192
|
}
|
|
4050
4193
|
async function promptServer(target) {
|
|
4051
4194
|
const name = bindingName(target);
|
|
4052
|
-
if (!
|
|
4195
|
+
if (!process13.stdout.isTTY || process13.env.CI) {
|
|
4053
4196
|
throw new Error(
|
|
4054
4197
|
`${name} ${target.kind === "preview" ? "are" : "is"} not bound to a server yet, and there is no terminal to ask on.
|
|
4055
4198
|
|
|
@@ -4057,29 +4200,29 @@ Pass ${pc5.cyan("--server user@host")}, or run the command once from your own ma
|
|
|
4057
4200
|
and commit ${pc5.cyan(".vela/project.json")}.`
|
|
4058
4201
|
);
|
|
4059
4202
|
}
|
|
4060
|
-
|
|
4203
|
+
p16.log.info(
|
|
4061
4204
|
`${pc5.cyan(name)} ${target.kind === "preview" ? "are" : "is"} not bound to a server yet.`
|
|
4062
4205
|
);
|
|
4063
|
-
const value = await
|
|
4206
|
+
const value = await p16.text({
|
|
4064
4207
|
message: `Which server should ${name} run on?`,
|
|
4065
4208
|
placeholder: "root@203.0.113.10",
|
|
4066
4209
|
validate: (input) => input?.trim() ? void 0 : "An ssh_config alias, or user@host"
|
|
4067
4210
|
});
|
|
4068
|
-
if (
|
|
4069
|
-
|
|
4070
|
-
|
|
4211
|
+
if (p16.isCancel(value)) {
|
|
4212
|
+
p16.cancel("Operation cancelled.");
|
|
4213
|
+
process13.exit(0);
|
|
4071
4214
|
}
|
|
4072
4215
|
return value.trim();
|
|
4073
4216
|
}
|
|
4074
4217
|
async function promptDomain(target) {
|
|
4075
|
-
if (!
|
|
4076
|
-
const value = await
|
|
4218
|
+
if (!process13.stdout.isTTY || process13.env.CI) return void 0;
|
|
4219
|
+
const value = await p16.text({
|
|
4077
4220
|
message: `Which hostname should ${target.name} be served on?`,
|
|
4078
4221
|
placeholder: "example.com \u2014 leave blank to decide later"
|
|
4079
4222
|
});
|
|
4080
|
-
if (
|
|
4081
|
-
|
|
4082
|
-
|
|
4223
|
+
if (p16.isCancel(value)) {
|
|
4224
|
+
p16.cancel("Operation cancelled.");
|
|
4225
|
+
process13.exit(0);
|
|
4083
4226
|
}
|
|
4084
4227
|
return value.trim() || void 0;
|
|
4085
4228
|
}
|
|
@@ -4087,10 +4230,10 @@ async function applyRestart(ctx) {
|
|
|
4087
4230
|
const outcome = await restartInstance(ctx.session, ctx.instance);
|
|
4088
4231
|
if (!outcome.deployed) return;
|
|
4089
4232
|
if (outcome.restarted) {
|
|
4090
|
-
|
|
4233
|
+
p16.log.success("App restarted");
|
|
4091
4234
|
return;
|
|
4092
4235
|
}
|
|
4093
|
-
|
|
4236
|
+
p16.log.error(
|
|
4094
4237
|
`App restart failed.
|
|
4095
4238
|
|
|
4096
4239
|
The new value is stored and will be used the next time the app starts.
|
|
@@ -4099,7 +4242,7 @@ ${pc5.dim(outcome.error ?? "")}`
|
|
|
4099
4242
|
}
|
|
4100
4243
|
async function applyEnvRestart(ctx, changed) {
|
|
4101
4244
|
if (touchesSuperuser(changed)) {
|
|
4102
|
-
|
|
4245
|
+
p16.log.warn(
|
|
4103
4246
|
`PocketBase superuser credentials changed.
|
|
4104
4247
|
|
|
4105
4248
|
The database still holds the old ones, so the app has not been restarted.
|
|
@@ -4136,7 +4279,7 @@ import pc7 from "picocolors";
|
|
|
4136
4279
|
|
|
4137
4280
|
// src/lib/local-env.ts
|
|
4138
4281
|
import fs24 from "node:fs";
|
|
4139
|
-
import * as
|
|
4282
|
+
import * as p17 from "@clack/prompts";
|
|
4140
4283
|
import pc6 from "picocolors";
|
|
4141
4284
|
function readLocalEnv(envFile) {
|
|
4142
4285
|
if (!fs24.existsSync(envFile)) return {};
|
|
@@ -4162,16 +4305,16 @@ async function applyLocalEnvChange(ctx, changed) {
|
|
|
4162
4305
|
process.env.POCKETBASE_SUPERUSER_EMAIL = email3;
|
|
4163
4306
|
process.env.POCKETBASE_SUPERUSER_PASSWORD = password11;
|
|
4164
4307
|
await ensureSuperuser(ctx.workspaceRootDir);
|
|
4165
|
-
|
|
4308
|
+
p17.log.success("Local superuser updated to match");
|
|
4166
4309
|
} else {
|
|
4167
|
-
|
|
4310
|
+
p17.log.warn(
|
|
4168
4311
|
`The local database still has the old superuser.
|
|
4169
4312
|
Set both ${pc6.cyan("POCKETBASE_SUPERUSER_EMAIL")} and ${pc6.cyan("POCKETBASE_SUPERUSER_PASSWORD")} to reconcile it.`
|
|
4170
4313
|
);
|
|
4171
4314
|
}
|
|
4172
4315
|
}
|
|
4173
4316
|
if (getPocketbaseMetadata(ctx.workspaceRootDir)) {
|
|
4174
|
-
|
|
4317
|
+
p17.log.info(`Restart ${pc6.cyan("vela dev")} to pick this up.`);
|
|
4175
4318
|
}
|
|
4176
4319
|
}
|
|
4177
4320
|
|
|
@@ -4335,7 +4478,7 @@ function hasFile(dir) {
|
|
|
4335
4478
|
|
|
4336
4479
|
// src/commands/enable/s3.ts
|
|
4337
4480
|
var s3 = addTargetOptions(
|
|
4338
|
-
new
|
|
4481
|
+
new Command20("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),
|
|
4339
4482
|
"local"
|
|
4340
4483
|
).action(
|
|
4341
4484
|
(raw) => runCommand(() => {
|
|
@@ -4353,7 +4496,7 @@ var s3 = addTargetOptions(
|
|
|
4353
4496
|
failure = error instanceof Error ? error.message : String(error);
|
|
4354
4497
|
}
|
|
4355
4498
|
if (failure) {
|
|
4356
|
-
|
|
4499
|
+
p18.log.warn(
|
|
4357
4500
|
`The connection test failed \u2014 the settings are saved but may be wrong.
|
|
4358
4501
|
|
|
4359
4502
|
${pc8.dim(failure)}
|
|
@@ -4397,64 +4540,64 @@ Do that first, then re-run with ${pc8.cyan("--force")}.`
|
|
|
4397
4540
|
);
|
|
4398
4541
|
}
|
|
4399
4542
|
async function promptConfig(options, existing) {
|
|
4400
|
-
const endpoint = options.endpoint ?? await
|
|
4401
|
-
const bucket = options.bucket ?? await
|
|
4402
|
-
const region = options.region ?? await
|
|
4403
|
-
const accessKey = options.accessKey ?? await
|
|
4404
|
-
const secret = options.secret ??
|
|
4543
|
+
const endpoint = options.endpoint ?? await text8("S3 endpoint URL", existing.endpoint || "https://s3.amazonaws.com");
|
|
4544
|
+
const bucket = options.bucket ?? await text8("S3 bucket name", existing.bucket);
|
|
4545
|
+
const region = options.region ?? await text8("S3 region", existing.region || "us-east-1");
|
|
4546
|
+
const accessKey = options.accessKey ?? await text8("S3 access key", existing.accessKey);
|
|
4547
|
+
const secret = options.secret ?? process14.env.VELA_S3_SECRET ?? await password5("S3 secret key");
|
|
4405
4548
|
const forcePathStyle = options.forcePathStyle ?? await confirm4(
|
|
4406
4549
|
"Address the bucket in the path? (MinIO, Ceph and most self-hosted gateways need this)",
|
|
4407
4550
|
defaultForcePathStyle(endpoint)
|
|
4408
4551
|
);
|
|
4409
4552
|
return { endpoint, bucket, region, accessKey, secret, forcePathStyle };
|
|
4410
4553
|
}
|
|
4411
|
-
async function
|
|
4412
|
-
const value = await
|
|
4554
|
+
async function text8(message, initialValue = "") {
|
|
4555
|
+
const value = await p18.text({
|
|
4413
4556
|
message,
|
|
4414
4557
|
initialValue,
|
|
4415
4558
|
validate: (input) => input?.trim() ? void 0 : `${message} is required`
|
|
4416
4559
|
});
|
|
4417
|
-
if (
|
|
4418
|
-
|
|
4419
|
-
|
|
4560
|
+
if (p18.isCancel(value)) {
|
|
4561
|
+
p18.cancel("Operation cancelled.");
|
|
4562
|
+
process14.exit(0);
|
|
4420
4563
|
}
|
|
4421
4564
|
return value.trim();
|
|
4422
4565
|
}
|
|
4423
4566
|
async function password5(message) {
|
|
4424
|
-
const value = await
|
|
4567
|
+
const value = await p18.password({
|
|
4425
4568
|
message,
|
|
4426
4569
|
validate: (input) => input ? void 0 : `${message} is required`
|
|
4427
4570
|
});
|
|
4428
|
-
if (
|
|
4429
|
-
|
|
4430
|
-
|
|
4571
|
+
if (p18.isCancel(value)) {
|
|
4572
|
+
p18.cancel("Operation cancelled.");
|
|
4573
|
+
process14.exit(0);
|
|
4431
4574
|
}
|
|
4432
4575
|
return value;
|
|
4433
4576
|
}
|
|
4434
4577
|
async function confirm4(message, initialValue) {
|
|
4435
|
-
const value = await
|
|
4436
|
-
if (
|
|
4437
|
-
|
|
4438
|
-
|
|
4578
|
+
const value = await p18.confirm({ message, initialValue });
|
|
4579
|
+
if (p18.isCancel(value)) {
|
|
4580
|
+
p18.cancel("Operation cancelled.");
|
|
4581
|
+
process14.exit(0);
|
|
4439
4582
|
}
|
|
4440
4583
|
return value;
|
|
4441
4584
|
}
|
|
4442
4585
|
|
|
4443
4586
|
// src/commands/enable/smtp.ts
|
|
4444
|
-
import
|
|
4445
|
-
import { Command as
|
|
4446
|
-
import * as
|
|
4447
|
-
var smtp = new
|
|
4587
|
+
import process15 from "node:process";
|
|
4588
|
+
import { Command as Command21 } from "commander";
|
|
4589
|
+
import * as p19 from "@clack/prompts";
|
|
4590
|
+
var smtp = new Command21("smtp").description("configure SMTP for transactional email").configureHelp(helpConfig).action(
|
|
4448
4591
|
() => runCommand(async () => {
|
|
4449
4592
|
const { workspaceRootDir } = await getWorkspace();
|
|
4450
|
-
const config = await
|
|
4593
|
+
const config = await p19.group(
|
|
4451
4594
|
{
|
|
4452
|
-
host: () =>
|
|
4595
|
+
host: () => p19.text({
|
|
4453
4596
|
message: "SMTP host",
|
|
4454
4597
|
placeholder: "smtp.example.com",
|
|
4455
4598
|
validate: (v10) => v10 ? void 0 : "Host is required"
|
|
4456
4599
|
}),
|
|
4457
|
-
port: () =>
|
|
4600
|
+
port: () => p19.text({
|
|
4458
4601
|
message: "SMTP port",
|
|
4459
4602
|
initialValue: "587",
|
|
4460
4603
|
validate: (v10) => {
|
|
@@ -4464,13 +4607,13 @@ var smtp = new Command20("smtp").description("configure SMTP for transactional e
|
|
|
4464
4607
|
return void 0;
|
|
4465
4608
|
}
|
|
4466
4609
|
}),
|
|
4467
|
-
username: () =>
|
|
4468
|
-
password: () =>
|
|
4610
|
+
username: () => p19.text({ message: "SMTP username" }),
|
|
4611
|
+
password: () => p19.password({ message: "SMTP password" })
|
|
4469
4612
|
},
|
|
4470
4613
|
{
|
|
4471
4614
|
onCancel: () => {
|
|
4472
|
-
|
|
4473
|
-
|
|
4615
|
+
p19.cancel("Operation cancelled.");
|
|
4616
|
+
process15.exit(0);
|
|
4474
4617
|
}
|
|
4475
4618
|
}
|
|
4476
4619
|
);
|
|
@@ -4497,24 +4640,24 @@ var smtp = new Command20("smtp").description("configure SMTP for transactional e
|
|
|
4497
4640
|
);
|
|
4498
4641
|
|
|
4499
4642
|
// src/commands/enable/cms.ts
|
|
4500
|
-
import
|
|
4501
|
-
import { Command as
|
|
4502
|
-
import * as
|
|
4643
|
+
import process16 from "node:process";
|
|
4644
|
+
import { Command as Command22 } from "commander";
|
|
4645
|
+
import * as p20 from "@clack/prompts";
|
|
4503
4646
|
import pc9 from "picocolors";
|
|
4504
|
-
var cms = new
|
|
4647
|
+
var cms = new Command22("cms").description("enable an inline-editing CMS with an admin bar").option(
|
|
4505
4648
|
"--endpoint <url>",
|
|
4506
4649
|
"read from a hosted CMS at this URL instead of installing the backend in this app"
|
|
4507
4650
|
).allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
4508
4651
|
(opts, cmd) => runCommand(async () => {
|
|
4509
4652
|
if (!opts.endpoint && !hasBackend()) {
|
|
4510
|
-
|
|
4653
|
+
p20.log.error(
|
|
4511
4654
|
`${pc9.cyan("vela enable cms")} needs a server to host the CMS backend, and this project is static.
|
|
4512
4655
|
|
|
4513
4656
|
Run ${pc9.cyan("vela bless")} to add a backend, or point at a hosted CMS with ${pc9.cyan("vela enable cms --endpoint <url>")}.`
|
|
4514
4657
|
);
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4658
|
+
p20.log.message();
|
|
4659
|
+
p20.cancel("Operation failed.");
|
|
4660
|
+
process16.exitCode = 1;
|
|
4518
4661
|
return;
|
|
4519
4662
|
}
|
|
4520
4663
|
await runPattern("enable-cms", cmd.args, opts.endpoint ? { endpoint: opts.endpoint } : {}, {
|
|
@@ -4534,8 +4677,8 @@ Run ${pc9.cyan("vela bless")} to add a backend, or point at a hosted CMS with ${
|
|
|
4534
4677
|
);
|
|
4535
4678
|
|
|
4536
4679
|
// src/commands/enable/blog.ts
|
|
4537
|
-
import { Command as
|
|
4538
|
-
var blog = new
|
|
4680
|
+
import { Command as Command23 } from "commander";
|
|
4681
|
+
var blog = new Command23("blog").description("enable an mdsvex blog with posts, tags, and RSS").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
4539
4682
|
(_opts, cmd) => runCommand(
|
|
4540
4683
|
() => runPattern(
|
|
4541
4684
|
"enable-blog",
|
|
@@ -4560,8 +4703,8 @@ var blog = new Command22("blog").description("enable an mdsvex blog with posts,
|
|
|
4560
4703
|
);
|
|
4561
4704
|
|
|
4562
4705
|
// src/commands/enable/content-negotiation.ts
|
|
4563
|
-
import { Command as
|
|
4564
|
-
var contentNegotiation = new
|
|
4706
|
+
import { Command as Command24 } from "commander";
|
|
4707
|
+
var contentNegotiation = new Command24("content-negotiation").description("enable content negotiation (sveltekit-negotiate)").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
4565
4708
|
(_opts, cmd) => runCommand(
|
|
4566
4709
|
() => runPattern(
|
|
4567
4710
|
"enable-content-negotiation",
|
|
@@ -4585,33 +4728,33 @@ var contentNegotiation = new Command23("content-negotiation").description("enabl
|
|
|
4585
4728
|
);
|
|
4586
4729
|
|
|
4587
4730
|
// src/commands/enable.ts
|
|
4588
|
-
var enable = new
|
|
4731
|
+
var enable = new Command25("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);
|
|
4589
4732
|
|
|
4590
4733
|
// src/commands/disable.ts
|
|
4591
|
-
import { Command as
|
|
4734
|
+
import { Command as Command36 } from "commander";
|
|
4592
4735
|
|
|
4593
4736
|
// src/commands/disable/auth.ts
|
|
4594
|
-
import { Command as
|
|
4737
|
+
import { Command as Command26 } from "commander";
|
|
4595
4738
|
|
|
4596
4739
|
// src/commands/disable/_shared.ts
|
|
4597
|
-
import
|
|
4598
|
-
import * as
|
|
4740
|
+
import process17 from "node:process";
|
|
4741
|
+
import * as p21 from "@clack/prompts";
|
|
4599
4742
|
async function runDisable(opts, flags, cmdArgs) {
|
|
4600
4743
|
if (!flags.yes) {
|
|
4601
|
-
const ok = await
|
|
4744
|
+
const ok = await p21.confirm({
|
|
4602
4745
|
message: opts.confirmMessage,
|
|
4603
4746
|
initialValue: false
|
|
4604
4747
|
});
|
|
4605
|
-
if (
|
|
4606
|
-
|
|
4607
|
-
|
|
4748
|
+
if (p21.isCancel(ok) || !ok) {
|
|
4749
|
+
p21.cancel("Operation cancelled.");
|
|
4750
|
+
process17.exit(0);
|
|
4608
4751
|
}
|
|
4609
4752
|
}
|
|
4610
4753
|
await runPattern(opts.slug, cmdArgs, { destructive: true }, opts.report);
|
|
4611
4754
|
}
|
|
4612
4755
|
|
|
4613
4756
|
// src/commands/disable/auth.ts
|
|
4614
|
-
var auth2 = new
|
|
4757
|
+
var auth2 = new Command26("auth").description("disable authentication").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
4615
4758
|
(opts, cmd) => runCommand(
|
|
4616
4759
|
() => runDisable(
|
|
4617
4760
|
{
|
|
@@ -4637,8 +4780,8 @@ var auth2 = new Command25("auth").description("disable authentication").option("
|
|
|
4637
4780
|
);
|
|
4638
4781
|
|
|
4639
4782
|
// src/commands/disable/api.ts
|
|
4640
|
-
import { Command as
|
|
4641
|
-
var api2 = new
|
|
4783
|
+
import { Command as Command27 } from "commander";
|
|
4784
|
+
var api2 = new Command27("api").description("disable the REST API").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
4642
4785
|
(opts, cmd) => runCommand(
|
|
4643
4786
|
() => runDisable(
|
|
4644
4787
|
{
|
|
@@ -4661,8 +4804,8 @@ var api2 = new Command26("api").description("disable the REST API").option("-y,
|
|
|
4661
4804
|
);
|
|
4662
4805
|
|
|
4663
4806
|
// src/commands/disable/api-keys.ts
|
|
4664
|
-
import { Command as
|
|
4665
|
-
var apiKeys2 = new
|
|
4807
|
+
import { Command as Command28 } from "commander";
|
|
4808
|
+
var apiKeys2 = new Command28("api-keys").description("disable API key management").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
4666
4809
|
(opts, cmd) => runCommand(
|
|
4667
4810
|
() => runDisable(
|
|
4668
4811
|
{
|
|
@@ -4685,8 +4828,8 @@ var apiKeys2 = new Command27("api-keys").description("disable API key management
|
|
|
4685
4828
|
);
|
|
4686
4829
|
|
|
4687
4830
|
// src/commands/disable/backend.ts
|
|
4688
|
-
import { Command as
|
|
4689
|
-
var backend2 = new
|
|
4831
|
+
import { Command as Command29 } from "commander";
|
|
4832
|
+
var backend2 = new Command29("backend").description("disable the PocketBase backend").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
4690
4833
|
(opts, cmd) => runCommand(
|
|
4691
4834
|
() => runDisable(
|
|
4692
4835
|
{
|
|
@@ -4709,8 +4852,8 @@ var backend2 = new Command28("backend").description("disable the PocketBase back
|
|
|
4709
4852
|
);
|
|
4710
4853
|
|
|
4711
4854
|
// src/commands/disable/content-negotiation.ts
|
|
4712
|
-
import { Command as
|
|
4713
|
-
var contentNegotiation2 = new
|
|
4855
|
+
import { Command as Command30 } from "commander";
|
|
4856
|
+
var contentNegotiation2 = new Command30("content-negotiation").description("disable content negotiation").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
4714
4857
|
(opts, cmd) => runCommand(
|
|
4715
4858
|
() => runDisable(
|
|
4716
4859
|
{
|
|
@@ -4733,8 +4876,8 @@ var contentNegotiation2 = new Command29("content-negotiation").description("disa
|
|
|
4733
4876
|
);
|
|
4734
4877
|
|
|
4735
4878
|
// src/commands/disable/i18n.ts
|
|
4736
|
-
import { Command as
|
|
4737
|
-
var i18n2 = new
|
|
4879
|
+
import { Command as Command31 } from "commander";
|
|
4880
|
+
var i18n2 = new Command31("i18n").description("disable internationalization").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
4738
4881
|
(opts, cmd) => runCommand(
|
|
4739
4882
|
() => runDisable(
|
|
4740
4883
|
{
|
|
@@ -4760,8 +4903,8 @@ var i18n2 = new Command30("i18n").description("disable internationalization").op
|
|
|
4760
4903
|
);
|
|
4761
4904
|
|
|
4762
4905
|
// src/commands/disable/teams.ts
|
|
4763
|
-
import { Command as
|
|
4764
|
-
var teams2 = new
|
|
4906
|
+
import { Command as Command32 } from "commander";
|
|
4907
|
+
var teams2 = new Command32("teams").description("disable teams").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
4765
4908
|
(opts, cmd) => runCommand(
|
|
4766
4909
|
() => runDisable(
|
|
4767
4910
|
{
|
|
@@ -4787,8 +4930,8 @@ var teams2 = new Command31("teams").description("disable teams").option("-y, --y
|
|
|
4787
4930
|
);
|
|
4788
4931
|
|
|
4789
4932
|
// src/commands/disable/payments.ts
|
|
4790
|
-
import { Command as
|
|
4791
|
-
var payments2 = new
|
|
4933
|
+
import { Command as Command33 } from "commander";
|
|
4934
|
+
var payments2 = new Command33("payments").description("disable payments").option("-y, --yes", "skip confirmation prompt").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
4792
4935
|
(opts, cmd) => runCommand(
|
|
4793
4936
|
() => runDisable(
|
|
4794
4937
|
{
|
|
@@ -4815,11 +4958,11 @@ var payments2 = new Command32("payments").description("disable payments").option
|
|
|
4815
4958
|
);
|
|
4816
4959
|
|
|
4817
4960
|
// src/commands/disable/s3.ts
|
|
4818
|
-
import { Command as
|
|
4819
|
-
import * as
|
|
4961
|
+
import { Command as Command34 } from "commander";
|
|
4962
|
+
import * as p22 from "@clack/prompts";
|
|
4820
4963
|
import pc10 from "picocolors";
|
|
4821
4964
|
var s32 = addTargetOptions(
|
|
4822
|
-
new
|
|
4965
|
+
new Command34("s3").description("disable S3 file storage").option("--backups", "keep backups on the server again, rather than uploads").configureHelp(helpConfig),
|
|
4823
4966
|
"local"
|
|
4824
4967
|
).action(
|
|
4825
4968
|
(raw) => runCommand(() => {
|
|
@@ -4828,7 +4971,7 @@ var s32 = addTargetOptions(
|
|
|
4828
4971
|
return withBackupTarget(raw, "disable s3", async (ctx) => {
|
|
4829
4972
|
const existing = await readS3(ctx.pb, filesystem);
|
|
4830
4973
|
if (!existing.enabled) {
|
|
4831
|
-
|
|
4974
|
+
p22.log.info(`S3 ${label2(filesystem)} is already off for ${ctx.targetName}.`);
|
|
4832
4975
|
return;
|
|
4833
4976
|
}
|
|
4834
4977
|
await disableS3(ctx.pb, filesystem);
|
|
@@ -4848,8 +4991,8 @@ function label2(filesystem) {
|
|
|
4848
4991
|
}
|
|
4849
4992
|
|
|
4850
4993
|
// src/commands/disable/smtp.ts
|
|
4851
|
-
import { Command as
|
|
4852
|
-
var smtp2 = new
|
|
4994
|
+
import { Command as Command35 } from "commander";
|
|
4995
|
+
var smtp2 = new Command35("smtp").description("disable SMTP configuration").configureHelp(helpConfig).action(
|
|
4853
4996
|
() => runCommand(async () => {
|
|
4854
4997
|
const { workspaceRootDir } = await getWorkspace();
|
|
4855
4998
|
await withPocketbase(workspaceRootDir, async (pb) => {
|
|
@@ -4866,30 +5009,30 @@ var smtp2 = new Command34("smtp").description("disable SMTP configuration").conf
|
|
|
4866
5009
|
);
|
|
4867
5010
|
|
|
4868
5011
|
// src/commands/disable.ts
|
|
4869
|
-
var disable = new
|
|
5012
|
+
var disable = new Command36("disable").description("disable features").configureHelp(helpConfig).addCommand(auth2).addCommand(api2).addCommand(apiKeys2).addCommand(backend2).addCommand(contentNegotiation2).addCommand(i18n2).addCommand(teams2).addCommand(payments2).addCommand(s32).addCommand(smtp2);
|
|
4870
5013
|
|
|
4871
5014
|
// src/commands/destroy.ts
|
|
4872
|
-
import { Command as
|
|
5015
|
+
import { Command as Command42 } from "commander";
|
|
4873
5016
|
|
|
4874
5017
|
// src/commands/destroy/form.ts
|
|
4875
|
-
import { Command as
|
|
5018
|
+
import { Command as Command37 } from "commander";
|
|
4876
5019
|
|
|
4877
5020
|
// src/commands/destroy/_shared.ts
|
|
4878
|
-
import
|
|
4879
|
-
import * as
|
|
5021
|
+
import process18 from "node:process";
|
|
5022
|
+
import * as p23 from "@clack/prompts";
|
|
4880
5023
|
async function runDestroy(slug2, model, confirmMessage, report4, flags) {
|
|
4881
5024
|
if (!flags.yes) {
|
|
4882
|
-
const ok = await
|
|
4883
|
-
if (
|
|
4884
|
-
|
|
4885
|
-
|
|
5025
|
+
const ok = await p23.confirm({ message: confirmMessage, initialValue: false });
|
|
5026
|
+
if (p23.isCancel(ok) || !ok) {
|
|
5027
|
+
p23.cancel("Operation cancelled.");
|
|
5028
|
+
process18.exit(0);
|
|
4886
5029
|
}
|
|
4887
5030
|
}
|
|
4888
5031
|
await runPattern(slug2, [model], { destructive: true, route: flags.route }, report4);
|
|
4889
5032
|
}
|
|
4890
5033
|
|
|
4891
5034
|
// src/commands/destroy/form.ts
|
|
4892
|
-
var form2 = new
|
|
5035
|
+
var form2 = new Command37("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(
|
|
4893
5036
|
"--route <route>",
|
|
4894
5037
|
"custom route the form was generated at (must match the --route used at generation)"
|
|
4895
5038
|
).allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
@@ -4913,8 +5056,8 @@ var form2 = new Command36("form").description("destroy a form generated by `vela
|
|
|
4913
5056
|
);
|
|
4914
5057
|
|
|
4915
5058
|
// src/commands/destroy/schema.ts
|
|
4916
|
-
import { Command as
|
|
4917
|
-
var schema2 = new
|
|
5059
|
+
import { Command as Command38 } from "commander";
|
|
5060
|
+
var schema2 = new Command38("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(
|
|
4918
5061
|
(model, opts) => runCommand(
|
|
4919
5062
|
() => runDestroy(
|
|
4920
5063
|
"destroy-schema",
|
|
@@ -4935,8 +5078,8 @@ var schema2 = new Command37("schema").description("destroy a zod schema generate
|
|
|
4935
5078
|
);
|
|
4936
5079
|
|
|
4937
5080
|
// src/commands/destroy/resource.ts
|
|
4938
|
-
import { Command as
|
|
4939
|
-
var resource2 = new
|
|
5081
|
+
import { Command as Command39 } from "commander";
|
|
5082
|
+
var resource2 = new Command39("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(
|
|
4940
5083
|
(model, opts) => runCommand(
|
|
4941
5084
|
() => runDestroy(
|
|
4942
5085
|
"destroy-resource",
|
|
@@ -4957,8 +5100,8 @@ var resource2 = new Command38("resource").description("destroy a resource genera
|
|
|
4957
5100
|
);
|
|
4958
5101
|
|
|
4959
5102
|
// src/commands/destroy/scaffold.ts
|
|
4960
|
-
import { Command as
|
|
4961
|
-
var scaffold2 = new
|
|
5103
|
+
import { Command as Command40 } from "commander";
|
|
5104
|
+
var scaffold2 = new Command40("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(
|
|
4962
5105
|
"--route <route>",
|
|
4963
5106
|
"custom route the scaffold was generated at (must match the --route used at generation)"
|
|
4964
5107
|
).allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
@@ -4985,9 +5128,9 @@ var scaffold2 = new Command39("scaffold").description("destroy a scaffold genera
|
|
|
4985
5128
|
);
|
|
4986
5129
|
|
|
4987
5130
|
// src/commands/destroy/deployment.ts
|
|
4988
|
-
import
|
|
4989
|
-
import { Command as
|
|
4990
|
-
import * as
|
|
5131
|
+
import process19 from "node:process";
|
|
5132
|
+
import { Command as Command41 } from "commander";
|
|
5133
|
+
import * as p26 from "@clack/prompts";
|
|
4991
5134
|
import pc13 from "picocolors";
|
|
4992
5135
|
|
|
4993
5136
|
// src/lib/destroy-guard.ts
|
|
@@ -5035,11 +5178,11 @@ function describe({ appName, envTag, purge }) {
|
|
|
5035
5178
|
}
|
|
5036
5179
|
|
|
5037
5180
|
// src/lib/deploy-report.ts
|
|
5038
|
-
import * as
|
|
5181
|
+
import * as p25 from "@clack/prompts";
|
|
5039
5182
|
import pc12 from "picocolors";
|
|
5040
5183
|
|
|
5041
5184
|
// src/lib/server-identity.ts
|
|
5042
|
-
import * as
|
|
5185
|
+
import * as p24 from "@clack/prompts";
|
|
5043
5186
|
import pc11 from "picocolors";
|
|
5044
5187
|
|
|
5045
5188
|
// src/lib/velastack-api.ts
|
|
@@ -5129,7 +5272,7 @@ async function ensureServerIdentity(session, apiKey) {
|
|
|
5129
5272
|
if (!existing || existing.serverId !== registered.serverId || existing.originHost !== registered.originHost || existing.token !== registered.token) {
|
|
5130
5273
|
await writeServerIdentity(session, registered);
|
|
5131
5274
|
if (existing) {
|
|
5132
|
-
|
|
5275
|
+
p24.log.info(`${pc11.cyan(session.target)} was re-registered with velastack.dev.`);
|
|
5133
5276
|
}
|
|
5134
5277
|
}
|
|
5135
5278
|
await runServerScript(session, "origin.sh");
|
|
@@ -5169,7 +5312,7 @@ function createDeployReporter(workspaceRootDir) {
|
|
|
5169
5312
|
const link2 = readProjectConfig(workspaceRootDir);
|
|
5170
5313
|
const apiKey = link2 ? readApiKey() : null;
|
|
5171
5314
|
if (link2 && !apiKey) {
|
|
5172
|
-
|
|
5315
|
+
p25.log.warn(
|
|
5173
5316
|
`This project is linked to ${pc12.cyan(link2.projectName)} on velastack.dev, but there is no
|
|
5174
5317
|
API key here, so this deploy will not be recorded. Run ${pc12.cyan("vela login")}, or set
|
|
5175
5318
|
${pc12.cyan("VELA_API_KEY")}.`
|
|
@@ -5219,7 +5362,7 @@ async function reportEnvironmentDestroyed(workspaceRootDir, envTag) {
|
|
|
5219
5362
|
}
|
|
5220
5363
|
}
|
|
5221
5364
|
function warn(what, err) {
|
|
5222
|
-
|
|
5365
|
+
p25.log.warn(
|
|
5223
5366
|
`velastack.dev could not ${what}.
|
|
5224
5367
|
${pc12.dim(err instanceof Error ? err.message : String(err))}`
|
|
5225
5368
|
);
|
|
@@ -5228,7 +5371,7 @@ ${pc12.dim(err instanceof Error ? err.message : String(err))}`
|
|
|
5228
5371
|
// src/commands/destroy/deployment.ts
|
|
5229
5372
|
var deployment = addLockWaitOption(
|
|
5230
5373
|
addTargetOptions(
|
|
5231
|
-
new
|
|
5374
|
+
new Command41("deployment").description("remove a deployed environment from its server").configureHelp(helpConfig),
|
|
5232
5375
|
"production"
|
|
5233
5376
|
)
|
|
5234
5377
|
).option("--purge", "also delete the database and uploaded files").option("-y, --yes", "skip the confirmation prompt").option(
|
|
@@ -5247,7 +5390,7 @@ var deployment = addLockWaitOption(
|
|
|
5247
5390
|
purge: options.purge === true,
|
|
5248
5391
|
yes: options.yes === true,
|
|
5249
5392
|
confirm: options.confirm,
|
|
5250
|
-
interactive: Boolean(
|
|
5393
|
+
interactive: Boolean(process19.stdin.isTTY && process19.stdout.isTTY)
|
|
5251
5394
|
});
|
|
5252
5395
|
if (decision.kind === "refuse") throw new Error(decision.message);
|
|
5253
5396
|
if (decision.kind === "prompt") {
|
|
@@ -5262,13 +5405,13 @@ var deployment = addLockWaitOption(
|
|
|
5262
5405
|
stream: true
|
|
5263
5406
|
});
|
|
5264
5407
|
if (result?.existed === false) {
|
|
5265
|
-
|
|
5408
|
+
p26.log.info(
|
|
5266
5409
|
`Nothing named ${pc13.cyan(`${ctx.appName} (${ctx.targetName})`)} on ${ctx.server}; nothing to remove.`
|
|
5267
5410
|
);
|
|
5268
5411
|
return;
|
|
5269
5412
|
}
|
|
5270
5413
|
await reportEnvironmentDestroyed(ctx.workspaceRootDir, ctx.envTag);
|
|
5271
|
-
|
|
5414
|
+
p26.log.success(
|
|
5272
5415
|
`Removed ${pc13.cyan(`${ctx.appName} (${ctx.targetName})`)} from ${ctx.server}.` + (result?.purged ? result.trash ? `
|
|
5273
5416
|
|
|
5274
5417
|
A snapshot of its data is at ${pc13.cyan(result.trash)} on the server for two weeks.` : "" : `
|
|
@@ -5286,35 +5429,35 @@ The database and uploads are still in the instance's shared directory. Pass ${pc
|
|
|
5286
5429
|
);
|
|
5287
5430
|
async function confirm8(appName, targetName, byName) {
|
|
5288
5431
|
if (byName) {
|
|
5289
|
-
const answer = await
|
|
5432
|
+
const answer = await p26.text({
|
|
5290
5433
|
message: `This removes ${pc13.cyan(`${appName} (${targetName})`)}. Type the app name to confirm`,
|
|
5291
5434
|
validate: (value) => value === appName ? void 0 : `Type ${appName} to confirm`
|
|
5292
5435
|
});
|
|
5293
|
-
if (
|
|
5294
|
-
|
|
5295
|
-
|
|
5436
|
+
if (p26.isCancel(answer)) {
|
|
5437
|
+
p26.cancel("Operation cancelled.");
|
|
5438
|
+
process19.exit(0);
|
|
5296
5439
|
}
|
|
5297
5440
|
return;
|
|
5298
5441
|
}
|
|
5299
|
-
const ok = await
|
|
5442
|
+
const ok = await p26.confirm({
|
|
5300
5443
|
message: `Remove ${appName} (${targetName})?`,
|
|
5301
5444
|
initialValue: false
|
|
5302
5445
|
});
|
|
5303
|
-
if (
|
|
5304
|
-
|
|
5305
|
-
|
|
5446
|
+
if (p26.isCancel(ok) || !ok) {
|
|
5447
|
+
p26.cancel("Operation cancelled.");
|
|
5448
|
+
process19.exit(0);
|
|
5306
5449
|
}
|
|
5307
5450
|
}
|
|
5308
5451
|
|
|
5309
5452
|
// src/commands/destroy.ts
|
|
5310
|
-
var destroy = new
|
|
5453
|
+
var destroy = new Command42("destroy").description("destroy scaffolding, or a deployment").configureHelp(helpConfig).addCommand(form2).addCommand(schema2).addCommand(resource2).addCommand(scaffold2).addCommand(deployment);
|
|
5311
5454
|
|
|
5312
5455
|
// src/commands/ui.ts
|
|
5313
|
-
import { Command as
|
|
5456
|
+
import { Command as Command48 } from "commander";
|
|
5314
5457
|
|
|
5315
5458
|
// src/commands/ui/add.ts
|
|
5316
|
-
import { Command as
|
|
5317
|
-
import * as
|
|
5459
|
+
import { Command as Command43 } from "commander";
|
|
5460
|
+
import * as p27 from "@clack/prompts";
|
|
5318
5461
|
import { installComponents } from "@velastack/patterns";
|
|
5319
5462
|
|
|
5320
5463
|
// src/lib/ui-add.ts
|
|
@@ -5363,10 +5506,10 @@ function uiAddReport(requested, outcome) {
|
|
|
5363
5506
|
}
|
|
5364
5507
|
|
|
5365
5508
|
// src/commands/ui/add.ts
|
|
5366
|
-
var add = new
|
|
5509
|
+
var add = new Command43("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(
|
|
5367
5510
|
(components, options) => runCommand(async () => {
|
|
5368
5511
|
const { workspaceRootDir } = await getWorkspace();
|
|
5369
|
-
const log45 =
|
|
5512
|
+
const log45 = p27.taskLog({ title: "Adding UI components..." });
|
|
5370
5513
|
let outcome;
|
|
5371
5514
|
try {
|
|
5372
5515
|
outcome = await installComponents({
|
|
@@ -5385,13 +5528,13 @@ var add = new Command42("add").description("add ui components (shadcn-svelte ite
|
|
|
5385
5528
|
);
|
|
5386
5529
|
|
|
5387
5530
|
// src/commands/ui/base.ts
|
|
5388
|
-
import { Command as
|
|
5389
|
-
import * as
|
|
5531
|
+
import { Command as Command44 } from "commander";
|
|
5532
|
+
import * as p28 from "@clack/prompts";
|
|
5390
5533
|
import { applyBaseColor } from "@velastack/patterns";
|
|
5391
|
-
var base = new
|
|
5534
|
+
var base = new Command44("base").description("change the base (gray) palette").argument("<color>", `base color to use (${BASE_COLORS.join(", ")})`).configureHelp(helpConfig).action(
|
|
5392
5535
|
(color) => runCommand(async () => {
|
|
5393
5536
|
const { workspaceRootDir } = await getWorkspace();
|
|
5394
|
-
const log45 =
|
|
5537
|
+
const log45 = p28.taskLog({ title: `Applying the ${color} palette...` });
|
|
5395
5538
|
let outcome;
|
|
5396
5539
|
try {
|
|
5397
5540
|
outcome = await applyBaseColor({ root: workspaceRootDir, color });
|
|
@@ -5413,8 +5556,8 @@ var base = new Command43("base").description("change the base (gray) palette").a
|
|
|
5413
5556
|
);
|
|
5414
5557
|
|
|
5415
5558
|
// src/commands/ui/list.ts
|
|
5416
|
-
import { Command as
|
|
5417
|
-
import * as
|
|
5559
|
+
import { Command as Command45 } from "commander";
|
|
5560
|
+
import * as p29 from "@clack/prompts";
|
|
5418
5561
|
import { listComponents } from "@velastack/patterns";
|
|
5419
5562
|
|
|
5420
5563
|
// src/lib/ui-list.ts
|
|
@@ -5445,7 +5588,7 @@ function uiListReport(result) {
|
|
|
5445
5588
|
}
|
|
5446
5589
|
|
|
5447
5590
|
// src/commands/ui/list.ts
|
|
5448
|
-
var list = new
|
|
5591
|
+
var list = new Command45("list").description("list installed ui components, vela components and the style registry").option("--json", "print the result as JSON", false).configureHelp(helpConfig).action(
|
|
5449
5592
|
(options) => runCommand(async () => {
|
|
5450
5593
|
const { workspaceRootDir } = await getWorkspace();
|
|
5451
5594
|
if (options.json) {
|
|
@@ -5453,7 +5596,7 @@ var list = new Command44("list").description("list installed ui components, vela
|
|
|
5453
5596
|
console.log(JSON.stringify(result2, null, 2));
|
|
5454
5597
|
return;
|
|
5455
5598
|
}
|
|
5456
|
-
const spinner7 =
|
|
5599
|
+
const spinner7 = p29.spinner();
|
|
5457
5600
|
spinner7.start("Reading the registry...");
|
|
5458
5601
|
let result;
|
|
5459
5602
|
try {
|
|
@@ -5465,15 +5608,15 @@ var list = new Command44("list").description("list installed ui components, vela
|
|
|
5465
5608
|
spinner7.stop(`Read the ${result.style} registry`);
|
|
5466
5609
|
reportResult(uiListReport(result));
|
|
5467
5610
|
if (result.registryUnavailable) {
|
|
5468
|
-
|
|
5611
|
+
p29.log.warn(`${result.registryUnavailable}
|
|
5469
5612
|
Registry components are not listed.`);
|
|
5470
5613
|
}
|
|
5471
5614
|
}, "Failed to list UI components.")
|
|
5472
5615
|
);
|
|
5473
5616
|
|
|
5474
5617
|
// src/commands/ui/style.ts
|
|
5475
|
-
import { Command as
|
|
5476
|
-
import * as
|
|
5618
|
+
import { Command as Command46 } from "commander";
|
|
5619
|
+
import * as p30 from "@clack/prompts";
|
|
5477
5620
|
import { switchStyle } from "@velastack/patterns";
|
|
5478
5621
|
|
|
5479
5622
|
// src/lib/ui-style.ts
|
|
@@ -5499,10 +5642,10 @@ function uiStyleReport(result) {
|
|
|
5499
5642
|
}
|
|
5500
5643
|
|
|
5501
5644
|
// src/commands/ui/style.ts
|
|
5502
|
-
var style = new
|
|
5645
|
+
var style = new Command46("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(
|
|
5503
5646
|
(name, options) => runCommand(async () => {
|
|
5504
5647
|
const { workspaceRootDir } = await getWorkspace();
|
|
5505
|
-
const spinner7 =
|
|
5648
|
+
const spinner7 = p30.spinner();
|
|
5506
5649
|
spinner7.start(`Reading the ${name} registry...`);
|
|
5507
5650
|
let log45;
|
|
5508
5651
|
let outcome;
|
|
@@ -5515,20 +5658,20 @@ var style = new Command45("style").description("switch the shadcn-svelte style,
|
|
|
5515
5658
|
confirm: async (components) => {
|
|
5516
5659
|
spinner7.stop(`Read the ${name} registry`);
|
|
5517
5660
|
if (components.length > 0) {
|
|
5518
|
-
|
|
5661
|
+
p30.log.info(
|
|
5519
5662
|
`Re-adds ${components.length} component(s) from the ${name} registry; local edits to their files are lost:
|
|
5520
5663
|
${components.map((c) => `- ${c}`).join("\n")}`
|
|
5521
5664
|
);
|
|
5522
5665
|
} else {
|
|
5523
|
-
|
|
5666
|
+
p30.log.info(
|
|
5524
5667
|
`No installed component comes from the registry; only the config changes.`
|
|
5525
5668
|
);
|
|
5526
5669
|
}
|
|
5527
5670
|
if (!options.yes) {
|
|
5528
|
-
const ok = await
|
|
5529
|
-
if (
|
|
5671
|
+
const ok = await p30.confirm({ message: `Switch to ${name}?`, initialValue: false });
|
|
5672
|
+
if (p30.isCancel(ok) || !ok) return false;
|
|
5530
5673
|
}
|
|
5531
|
-
log45 =
|
|
5674
|
+
log45 = p30.taskLog({ title: `Switching to the ${name} style...` });
|
|
5532
5675
|
return true;
|
|
5533
5676
|
}
|
|
5534
5677
|
});
|
|
@@ -5539,11 +5682,11 @@ ${components.map((c) => `- ${c}`).join("\n")}`
|
|
|
5539
5682
|
}
|
|
5540
5683
|
spinner7.stop(`Read the ${name} registry`);
|
|
5541
5684
|
if (outcome.status === "unchanged") {
|
|
5542
|
-
|
|
5685
|
+
p30.log.info(`Already using the ${name} style.`);
|
|
5543
5686
|
return;
|
|
5544
5687
|
}
|
|
5545
5688
|
if (outcome.status === "cancelled") {
|
|
5546
|
-
|
|
5689
|
+
p30.cancel("Operation cancelled.");
|
|
5547
5690
|
return;
|
|
5548
5691
|
}
|
|
5549
5692
|
log45?.success("Style switched");
|
|
@@ -5552,13 +5695,13 @@ ${components.map((c) => `- ${c}`).join("\n")}`
|
|
|
5552
5695
|
);
|
|
5553
5696
|
|
|
5554
5697
|
// src/commands/ui/theme.ts
|
|
5555
|
-
import { Command as
|
|
5556
|
-
import * as
|
|
5698
|
+
import { Command as Command47 } from "commander";
|
|
5699
|
+
import * as p31 from "@clack/prompts";
|
|
5557
5700
|
import { applyTheme } from "@velastack/patterns";
|
|
5558
|
-
var theme = new
|
|
5701
|
+
var theme = new Command47("theme").description("change the accent color, keeping the base palette").argument("<accent>", `accent to use (${THEMES.join(", ")})`).configureHelp(helpConfig).action(
|
|
5559
5702
|
(accent) => runCommand(async () => {
|
|
5560
5703
|
const { workspaceRootDir } = await getWorkspace();
|
|
5561
|
-
const log45 =
|
|
5704
|
+
const log45 = p31.taskLog({ title: `Applying the ${accent} accent...` });
|
|
5562
5705
|
let outcome;
|
|
5563
5706
|
try {
|
|
5564
5707
|
outcome = await applyTheme({ root: workspaceRootDir, theme: accent });
|
|
@@ -5580,22 +5723,22 @@ var theme = new Command46("theme").description("change the accent color, keeping
|
|
|
5580
5723
|
);
|
|
5581
5724
|
|
|
5582
5725
|
// src/commands/ui.ts
|
|
5583
|
-
var ui = new
|
|
5726
|
+
var ui = new Command48("ui").description("generate ui components").configureHelp(helpConfig).addCommand(add).addCommand(list).addCommand(style).addCommand(base).addCommand(theme);
|
|
5584
5727
|
|
|
5585
5728
|
// src/commands/legal.ts
|
|
5586
|
-
import { Command as
|
|
5729
|
+
import { Command as Command51 } from "commander";
|
|
5587
5730
|
|
|
5588
5731
|
// src/commands/legal/terms.ts
|
|
5589
5732
|
import fs26 from "node:fs";
|
|
5590
5733
|
import path23 from "node:path";
|
|
5591
|
-
import { Command as
|
|
5592
|
-
import * as
|
|
5734
|
+
import { Command as Command49 } from "commander";
|
|
5735
|
+
import * as p33 from "@clack/prompts";
|
|
5593
5736
|
|
|
5594
5737
|
// src/commands/legal/shared.ts
|
|
5595
|
-
import
|
|
5596
|
-
import * as
|
|
5738
|
+
import process20 from "node:process";
|
|
5739
|
+
import * as p32 from "@clack/prompts";
|
|
5597
5740
|
var sharedFields = {
|
|
5598
|
-
websiteUrl: () =>
|
|
5741
|
+
websiteUrl: () => p32.text({
|
|
5599
5742
|
message: "What is your website URL?",
|
|
5600
5743
|
placeholder: "http://www.mysite.com",
|
|
5601
5744
|
validate: (value) => {
|
|
@@ -5604,7 +5747,7 @@ var sharedFields = {
|
|
|
5604
5747
|
}
|
|
5605
5748
|
}
|
|
5606
5749
|
}),
|
|
5607
|
-
websiteName: () =>
|
|
5750
|
+
websiteName: () => p32.text({
|
|
5608
5751
|
message: "What is your website name?",
|
|
5609
5752
|
placeholder: "My Site",
|
|
5610
5753
|
validate: (value) => {
|
|
@@ -5613,7 +5756,7 @@ var sharedFields = {
|
|
|
5613
5756
|
}
|
|
5614
5757
|
}
|
|
5615
5758
|
}),
|
|
5616
|
-
entityType: () =>
|
|
5759
|
+
entityType: () => p32.select({
|
|
5617
5760
|
message: "Entity type",
|
|
5618
5761
|
options: [
|
|
5619
5762
|
{
|
|
@@ -5624,7 +5767,7 @@ var sharedFields = {
|
|
|
5624
5767
|
{ value: "individual", label: "I'm an Individual" }
|
|
5625
5768
|
]
|
|
5626
5769
|
}),
|
|
5627
|
-
businessName: ({ results }) => results?.entityType === "business" ?
|
|
5770
|
+
businessName: ({ results }) => results?.entityType === "business" ? p32.text({
|
|
5628
5771
|
message: "What is the name of the business?",
|
|
5629
5772
|
placeholder: "My Company LLC",
|
|
5630
5773
|
validate: (value) => {
|
|
@@ -5633,7 +5776,7 @@ var sharedFields = {
|
|
|
5633
5776
|
}
|
|
5634
5777
|
}
|
|
5635
5778
|
}) : void 0,
|
|
5636
|
-
businessAddress: ({ results }) => results?.entityType === "business" ?
|
|
5779
|
+
businessAddress: ({ results }) => results?.entityType === "business" ? p32.text({
|
|
5637
5780
|
message: "What is the address of the business?",
|
|
5638
5781
|
placeholder: "1 Cupertino, CA 95014",
|
|
5639
5782
|
validate: (value) => {
|
|
@@ -5642,7 +5785,7 @@ var sharedFields = {
|
|
|
5642
5785
|
}
|
|
5643
5786
|
}
|
|
5644
5787
|
}) : void 0,
|
|
5645
|
-
country: () =>
|
|
5788
|
+
country: () => p32.text({
|
|
5646
5789
|
message: "Enter the country",
|
|
5647
5790
|
validate: (value) => {
|
|
5648
5791
|
if (!value) {
|
|
@@ -5650,7 +5793,7 @@ var sharedFields = {
|
|
|
5650
5793
|
}
|
|
5651
5794
|
}
|
|
5652
5795
|
}),
|
|
5653
|
-
state: () =>
|
|
5796
|
+
state: () => p32.text({
|
|
5654
5797
|
message: "Enter the state",
|
|
5655
5798
|
validate: (value) => {
|
|
5656
5799
|
if (!value) {
|
|
@@ -5660,11 +5803,11 @@ var sharedFields = {
|
|
|
5660
5803
|
})
|
|
5661
5804
|
};
|
|
5662
5805
|
var onCancel = () => {
|
|
5663
|
-
|
|
5664
|
-
|
|
5806
|
+
p32.cancel("Operation cancelled.");
|
|
5807
|
+
process20.exit(0);
|
|
5665
5808
|
};
|
|
5666
5809
|
async function contactMethods(type) {
|
|
5667
|
-
const selection = await
|
|
5810
|
+
const selection = await p32.multiselect({
|
|
5668
5811
|
message: `How can users contact you for any questions regarding your ${type === "privacy" ? "Privacy Policy" : "Terms & Conditions"}? Check all that apply`,
|
|
5669
5812
|
options: [
|
|
5670
5813
|
{ value: "email", label: "By email" },
|
|
@@ -5673,11 +5816,11 @@ async function contactMethods(type) {
|
|
|
5673
5816
|
{ value: "mail", label: "By sending post mail" }
|
|
5674
5817
|
]
|
|
5675
5818
|
});
|
|
5676
|
-
if (
|
|
5819
|
+
if (p32.isCancel(selection)) onCancel();
|
|
5677
5820
|
const contact = selection;
|
|
5678
5821
|
const details = {};
|
|
5679
5822
|
if (contact.includes("email")) {
|
|
5680
|
-
const email3 = await
|
|
5823
|
+
const email3 = await p32.text({
|
|
5681
5824
|
message: "What's the email?",
|
|
5682
5825
|
placeholder: "office@mycompany.com",
|
|
5683
5826
|
validate: (value) => {
|
|
@@ -5686,11 +5829,11 @@ async function contactMethods(type) {
|
|
|
5686
5829
|
}
|
|
5687
5830
|
}
|
|
5688
5831
|
});
|
|
5689
|
-
if (
|
|
5832
|
+
if (p32.isCancel(email3)) onCancel();
|
|
5690
5833
|
details.email = email3;
|
|
5691
5834
|
}
|
|
5692
5835
|
if (contact.includes("page")) {
|
|
5693
|
-
const page = await
|
|
5836
|
+
const page = await p32.text({
|
|
5694
5837
|
message: "What's the link?",
|
|
5695
5838
|
placeholder: "http://www.mycompany.com/contact",
|
|
5696
5839
|
validate: (value) => {
|
|
@@ -5699,11 +5842,11 @@ async function contactMethods(type) {
|
|
|
5699
5842
|
}
|
|
5700
5843
|
}
|
|
5701
5844
|
});
|
|
5702
|
-
if (
|
|
5845
|
+
if (p32.isCancel(page)) onCancel();
|
|
5703
5846
|
details.page = page;
|
|
5704
5847
|
}
|
|
5705
5848
|
if (contact.includes("phone")) {
|
|
5706
|
-
const phone = await
|
|
5849
|
+
const phone = await p32.text({
|
|
5707
5850
|
message: "What's the phone number?",
|
|
5708
5851
|
placeholder: "408.996.1010",
|
|
5709
5852
|
validate: (value) => {
|
|
@@ -5712,11 +5855,11 @@ async function contactMethods(type) {
|
|
|
5712
5855
|
}
|
|
5713
5856
|
}
|
|
5714
5857
|
});
|
|
5715
|
-
if (
|
|
5858
|
+
if (p32.isCancel(phone)) onCancel();
|
|
5716
5859
|
details.phone = phone;
|
|
5717
5860
|
}
|
|
5718
5861
|
if (contact.includes("mail")) {
|
|
5719
|
-
const address = await
|
|
5862
|
+
const address = await p32.text({
|
|
5720
5863
|
message: "What's the address?",
|
|
5721
5864
|
placeholder: "767 Fifth Avenue New York, NY 10153, United States",
|
|
5722
5865
|
validate: (value) => {
|
|
@@ -5725,7 +5868,7 @@ async function contactMethods(type) {
|
|
|
5725
5868
|
}
|
|
5726
5869
|
}
|
|
5727
5870
|
});
|
|
5728
|
-
if (
|
|
5871
|
+
if (p32.isCancel(address)) onCancel();
|
|
5729
5872
|
details.address = address;
|
|
5730
5873
|
}
|
|
5731
5874
|
return { methods: contact, details };
|
|
@@ -6121,7 +6264,7 @@ var generateTermsHtml = (answers) => {
|
|
|
6121
6264
|
};
|
|
6122
6265
|
async function termsAction() {
|
|
6123
6266
|
const { workspaceRootDir, publicRoutesDir } = await getWorkspace();
|
|
6124
|
-
const core = await
|
|
6267
|
+
const core = await p33.group(
|
|
6125
6268
|
{
|
|
6126
6269
|
websiteUrl: sharedFields.websiteUrl,
|
|
6127
6270
|
websiteName: sharedFields.websiteName,
|
|
@@ -6133,25 +6276,25 @@ async function termsAction() {
|
|
|
6133
6276
|
},
|
|
6134
6277
|
{ onCancel }
|
|
6135
6278
|
);
|
|
6136
|
-
const accounts = await
|
|
6279
|
+
const accounts = await p33.select({
|
|
6137
6280
|
message: "Can users create accounts?",
|
|
6138
6281
|
options: [
|
|
6139
6282
|
{ value: "yes", label: "Yes, users can create accounts" },
|
|
6140
6283
|
{ value: "no", label: "No" }
|
|
6141
6284
|
]
|
|
6142
6285
|
});
|
|
6143
|
-
if (
|
|
6144
|
-
const userContent = await
|
|
6286
|
+
if (p33.isCancel(accounts)) onCancel();
|
|
6287
|
+
const userContent = await p33.select({
|
|
6145
6288
|
message: "Can users create and/or upload content (ie. text, images)?",
|
|
6146
6289
|
options: [
|
|
6147
6290
|
{ value: "yes", label: "Yes, users can create and/or upload content" },
|
|
6148
6291
|
{ value: "no", label: "No" }
|
|
6149
6292
|
]
|
|
6150
6293
|
});
|
|
6151
|
-
if (
|
|
6294
|
+
if (p33.isCancel(userContent)) onCancel();
|
|
6152
6295
|
let infringementEmail;
|
|
6153
6296
|
if (userContent === "yes") {
|
|
6154
|
-
const email3 = await
|
|
6297
|
+
const email3 = await p33.text({
|
|
6155
6298
|
message: "What's the email address where you will receive infringements notices?",
|
|
6156
6299
|
placeholder: "dmca@website.com",
|
|
6157
6300
|
validate: (value) => {
|
|
@@ -6160,10 +6303,10 @@ async function termsAction() {
|
|
|
6160
6303
|
}
|
|
6161
6304
|
}
|
|
6162
6305
|
});
|
|
6163
|
-
if (
|
|
6306
|
+
if (p33.isCancel(email3)) onCancel();
|
|
6164
6307
|
infringementEmail = email3;
|
|
6165
6308
|
}
|
|
6166
|
-
const canBuyGoods = await
|
|
6309
|
+
const canBuyGoods = await p33.select({
|
|
6167
6310
|
message: "Can users buy goods (products, items)?",
|
|
6168
6311
|
options: [
|
|
6169
6312
|
{
|
|
@@ -6173,28 +6316,28 @@ async function termsAction() {
|
|
|
6173
6316
|
{ value: "no", label: "No" }
|
|
6174
6317
|
]
|
|
6175
6318
|
});
|
|
6176
|
-
if (
|
|
6177
|
-
const subscriptions2 = await
|
|
6319
|
+
if (p33.isCancel(canBuyGoods)) onCancel();
|
|
6320
|
+
const subscriptions2 = await p33.select({
|
|
6178
6321
|
message: "Do you offer subscription plans?",
|
|
6179
6322
|
options: [
|
|
6180
6323
|
{ value: "yes", label: "Yes, we offer subscription plans" },
|
|
6181
6324
|
{ value: "no", label: "No" }
|
|
6182
6325
|
]
|
|
6183
6326
|
});
|
|
6184
|
-
if (
|
|
6327
|
+
if (p33.isCancel(subscriptions2)) onCancel();
|
|
6185
6328
|
let freeTrial;
|
|
6186
6329
|
if (subscriptions2 === "yes") {
|
|
6187
|
-
const ft = await
|
|
6330
|
+
const ft = await p33.select({
|
|
6188
6331
|
message: "Do you offer a free trial?",
|
|
6189
6332
|
options: [
|
|
6190
6333
|
{ value: "yes", label: "Yes" },
|
|
6191
6334
|
{ value: "no", label: "No" }
|
|
6192
6335
|
]
|
|
6193
6336
|
});
|
|
6194
|
-
if (
|
|
6337
|
+
if (p33.isCancel(ft)) onCancel();
|
|
6195
6338
|
freeTrial = ft;
|
|
6196
6339
|
}
|
|
6197
|
-
const exclusiveContent = await
|
|
6340
|
+
const exclusiveContent = await p33.select({
|
|
6198
6341
|
message: "Do you want to make it clear that your own content & trademarks are your exclusive property?",
|
|
6199
6342
|
options: [
|
|
6200
6343
|
{
|
|
@@ -6204,24 +6347,24 @@ async function termsAction() {
|
|
|
6204
6347
|
{ value: "no", label: "No" }
|
|
6205
6348
|
]
|
|
6206
6349
|
});
|
|
6207
|
-
if (
|
|
6208
|
-
const feedbackReuse = await
|
|
6350
|
+
if (p33.isCancel(exclusiveContent)) onCancel();
|
|
6351
|
+
const feedbackReuse = await p33.select({
|
|
6209
6352
|
message: "If users provide you feedback & suggestions, do you want to use this feedback without compensation or credits given?",
|
|
6210
6353
|
options: [
|
|
6211
6354
|
{ value: "yes", label: "Yes, we may implement any feedback or suggestions we receive" },
|
|
6212
6355
|
{ value: "no", label: "No" }
|
|
6213
6356
|
]
|
|
6214
6357
|
});
|
|
6215
|
-
if (
|
|
6216
|
-
const promotions = await
|
|
6358
|
+
if (p33.isCancel(feedbackReuse)) onCancel();
|
|
6359
|
+
const promotions = await p33.select({
|
|
6217
6360
|
message: "Do you plan to offer promotions, contests, sweepstakes?",
|
|
6218
6361
|
options: [
|
|
6219
6362
|
{ value: "yes", label: "Yes, we may offer promotions, contests, sweepstakes" },
|
|
6220
6363
|
{ value: "no", label: "No" }
|
|
6221
6364
|
]
|
|
6222
6365
|
});
|
|
6223
|
-
if (
|
|
6224
|
-
const mobileAppRaw = await
|
|
6366
|
+
if (p33.isCancel(promotions)) onCancel();
|
|
6367
|
+
const mobileAppRaw = await p33.multiselect({
|
|
6225
6368
|
message: "Is the Service distributed through any mobile app stores? Check all that apply",
|
|
6226
6369
|
options: [
|
|
6227
6370
|
{ value: "apple", label: "Apple App Store" },
|
|
@@ -6229,7 +6372,7 @@ async function termsAction() {
|
|
|
6229
6372
|
],
|
|
6230
6373
|
required: false
|
|
6231
6374
|
});
|
|
6232
|
-
if (
|
|
6375
|
+
if (p33.isCancel(mobileAppRaw)) onCancel();
|
|
6233
6376
|
const mobileApp = mobileAppRaw ?? [];
|
|
6234
6377
|
const contact = await contactMethods("terms");
|
|
6235
6378
|
const html = generateTermsHtml({
|
|
@@ -6272,13 +6415,13 @@ async function termsAction() {
|
|
|
6272
6415
|
]
|
|
6273
6416
|
});
|
|
6274
6417
|
}
|
|
6275
|
-
var terms = new
|
|
6418
|
+
var terms = new Command49("terms").description("generate placeholder terms and conditions").configureHelp(helpConfig).action(() => runCommand(termsAction, "Failed to generate terms and conditions."));
|
|
6276
6419
|
|
|
6277
6420
|
// src/commands/legal/privacy.ts
|
|
6278
6421
|
import fs27 from "node:fs";
|
|
6279
6422
|
import path24 from "node:path";
|
|
6280
|
-
import { Command as
|
|
6281
|
-
import * as
|
|
6423
|
+
import { Command as Command50 } from "commander";
|
|
6424
|
+
import * as p34 from "@clack/prompts";
|
|
6282
6425
|
var mapLabels = {
|
|
6283
6426
|
personalInfo: {
|
|
6284
6427
|
email: "Email address",
|
|
@@ -6696,12 +6839,12 @@ var generatePrivacyHtml = (answers) => {
|
|
|
6696
6839
|
return `<section data-role="content">${sections.join("")}</section>`;
|
|
6697
6840
|
};
|
|
6698
6841
|
async function promptWithCustom(message, options, customMessage) {
|
|
6699
|
-
const selection = await
|
|
6700
|
-
if (
|
|
6842
|
+
const selection = await p34.multiselect({ message, options });
|
|
6843
|
+
if (p34.isCancel(selection)) onCancel();
|
|
6701
6844
|
const values = selection;
|
|
6702
6845
|
if (values.includes("custom")) {
|
|
6703
|
-
const custom = await
|
|
6704
|
-
if (
|
|
6846
|
+
const custom = await p34.text({ message: customMessage });
|
|
6847
|
+
if (p34.isCancel(custom)) onCancel();
|
|
6705
6848
|
const idx = values.indexOf("custom");
|
|
6706
6849
|
if (idx !== -1) values.splice(idx, 1);
|
|
6707
6850
|
if (custom) values.push(String(custom));
|
|
@@ -6710,7 +6853,7 @@ async function promptWithCustom(message, options, customMessage) {
|
|
|
6710
6853
|
}
|
|
6711
6854
|
async function privacyAction() {
|
|
6712
6855
|
const { workspaceRootDir, publicRoutesDir } = await getWorkspace();
|
|
6713
|
-
const core = await
|
|
6856
|
+
const core = await p34.group(
|
|
6714
6857
|
{
|
|
6715
6858
|
websiteUrl: sharedFields.websiteUrl,
|
|
6716
6859
|
websiteName: sharedFields.websiteName,
|
|
@@ -6722,7 +6865,7 @@ async function privacyAction() {
|
|
|
6722
6865
|
},
|
|
6723
6866
|
{ onCancel }
|
|
6724
6867
|
);
|
|
6725
|
-
const personalInfo = await
|
|
6868
|
+
const personalInfo = await p34.multiselect({
|
|
6726
6869
|
message: "What kind of personal information do you collect from users? Check all that apply",
|
|
6727
6870
|
options: [
|
|
6728
6871
|
{ value: "email", label: "Email address" },
|
|
@@ -6737,16 +6880,16 @@ async function privacyAction() {
|
|
|
6737
6880
|
],
|
|
6738
6881
|
required: false
|
|
6739
6882
|
});
|
|
6740
|
-
if (
|
|
6883
|
+
if (p34.isCancel(personalInfo)) onCancel();
|
|
6741
6884
|
const contact = await contactMethods("privacy");
|
|
6742
|
-
const tracking = await
|
|
6885
|
+
const tracking = await p34.select({
|
|
6743
6886
|
message: "Do you use tracking and/or analytics tools, such as Google Analytics?",
|
|
6744
6887
|
options: [
|
|
6745
6888
|
{ value: "yes", label: "Yes, we use Google Analytics or other related tools" },
|
|
6746
6889
|
{ value: "no", label: "No" }
|
|
6747
6890
|
]
|
|
6748
6891
|
});
|
|
6749
|
-
if (
|
|
6892
|
+
if (p34.isCancel(tracking)) onCancel();
|
|
6750
6893
|
let trackingTools;
|
|
6751
6894
|
if (tracking === "yes") {
|
|
6752
6895
|
trackingTools = await promptWithCustom(
|
|
@@ -6765,7 +6908,7 @@ async function privacyAction() {
|
|
|
6765
6908
|
"Enter your custom tracking/analytics tool name"
|
|
6766
6909
|
);
|
|
6767
6910
|
}
|
|
6768
|
-
const sendEmails = await
|
|
6911
|
+
const sendEmails = await p34.select({
|
|
6769
6912
|
message: "Do you send emails to users?",
|
|
6770
6913
|
options: [
|
|
6771
6914
|
{
|
|
@@ -6775,7 +6918,7 @@ async function privacyAction() {
|
|
|
6775
6918
|
{ value: "no", label: "No" }
|
|
6776
6919
|
]
|
|
6777
6920
|
});
|
|
6778
|
-
if (
|
|
6921
|
+
if (p34.isCancel(sendEmails)) onCancel();
|
|
6779
6922
|
let emailPlatforms;
|
|
6780
6923
|
if (sendEmails === "yes") {
|
|
6781
6924
|
emailPlatforms = await promptWithCustom(
|
|
@@ -6790,14 +6933,14 @@ async function privacyAction() {
|
|
|
6790
6933
|
"Enter your custom email platform"
|
|
6791
6934
|
);
|
|
6792
6935
|
}
|
|
6793
|
-
const showAds = await
|
|
6936
|
+
const showAds = await p34.select({
|
|
6794
6937
|
message: "Do you show ads?",
|
|
6795
6938
|
options: [
|
|
6796
6939
|
{ value: "yes", label: "Yes, we show ads" },
|
|
6797
6940
|
{ value: "no", label: "No" }
|
|
6798
6941
|
]
|
|
6799
6942
|
});
|
|
6800
|
-
if (
|
|
6943
|
+
if (p34.isCancel(showAds)) onCancel();
|
|
6801
6944
|
let adsPlatforms;
|
|
6802
6945
|
if (showAds === "yes") {
|
|
6803
6946
|
adsPlatforms = await promptWithCustom(
|
|
@@ -6820,7 +6963,7 @@ async function privacyAction() {
|
|
|
6820
6963
|
"Enter your custom ads platform"
|
|
6821
6964
|
);
|
|
6822
6965
|
}
|
|
6823
|
-
const canPay = await
|
|
6966
|
+
const canPay = await p34.select({
|
|
6824
6967
|
message: "Can users pay for products or services?",
|
|
6825
6968
|
options: [
|
|
6826
6969
|
{ value: "yes", label: "Yes, users can pay for our products/services" },
|
|
@@ -6830,7 +6973,7 @@ async function privacyAction() {
|
|
|
6830
6973
|
}
|
|
6831
6974
|
]
|
|
6832
6975
|
});
|
|
6833
|
-
if (
|
|
6976
|
+
if (p34.isCancel(canPay)) onCancel();
|
|
6834
6977
|
let paymentProcessors;
|
|
6835
6978
|
if (canPay === "yes") {
|
|
6836
6979
|
paymentProcessors = await promptWithCustom(
|
|
@@ -6861,14 +7004,14 @@ async function privacyAction() {
|
|
|
6861
7004
|
"Enter your custom payment processor/method"
|
|
6862
7005
|
);
|
|
6863
7006
|
}
|
|
6864
|
-
const remarketing = await
|
|
7007
|
+
const remarketing = await p34.select({
|
|
6865
7008
|
message: "Do you use remarketing services for marketing & advertising purposes?",
|
|
6866
7009
|
options: [
|
|
6867
7010
|
{ value: "yes", label: "Yes, we use remarketing services to advertise our business" },
|
|
6868
7011
|
{ value: "no", label: "No" }
|
|
6869
7012
|
]
|
|
6870
7013
|
});
|
|
6871
|
-
if (
|
|
7014
|
+
if (p34.isCancel(remarketing)) onCancel();
|
|
6872
7015
|
let remarketingPlatforms;
|
|
6873
7016
|
if (remarketing === "yes") {
|
|
6874
7017
|
remarketingPlatforms = await promptWithCustom(
|
|
@@ -6887,7 +7030,7 @@ async function privacyAction() {
|
|
|
6887
7030
|
"Enter your custom remarketing platform"
|
|
6888
7031
|
);
|
|
6889
7032
|
}
|
|
6890
|
-
const providersRaw = await
|
|
7033
|
+
const providersRaw = await p34.multiselect({
|
|
6891
7034
|
message: "Select if you use any of the following providers",
|
|
6892
7035
|
options: [
|
|
6893
7036
|
{ value: "recaptcha", label: "Invisible reCAPTCHA" },
|
|
@@ -6898,16 +7041,16 @@ async function privacyAction() {
|
|
|
6898
7041
|
],
|
|
6899
7042
|
required: false
|
|
6900
7043
|
});
|
|
6901
|
-
if (
|
|
7044
|
+
if (p34.isCancel(providersRaw)) onCancel();
|
|
6902
7045
|
const providers = providersRaw;
|
|
6903
7046
|
if (providers.includes("custom")) {
|
|
6904
|
-
const custom = await
|
|
6905
|
-
if (
|
|
7047
|
+
const custom = await p34.text({ message: "Enter your custom provider" });
|
|
7048
|
+
if (p34.isCancel(custom)) onCancel();
|
|
6906
7049
|
const idx = providers.indexOf("custom");
|
|
6907
7050
|
if (idx !== -1) providers.splice(idx, 1);
|
|
6908
7051
|
if (custom) providers.push(String(custom));
|
|
6909
7052
|
}
|
|
6910
|
-
const usStates = await
|
|
7053
|
+
const usStates = await p34.select({
|
|
6911
7054
|
message: "Include U.S. state privacy rights (CCPA/CPRA, VCDPA, CPA, CTDPA, UCPA, TX, OR, etc.)?",
|
|
6912
7055
|
options: [
|
|
6913
7056
|
{
|
|
@@ -6918,55 +7061,55 @@ async function privacyAction() {
|
|
|
6918
7061
|
],
|
|
6919
7062
|
initialValue: "yes"
|
|
6920
7063
|
});
|
|
6921
|
-
if (
|
|
6922
|
-
const gdpr = await
|
|
7064
|
+
if (p34.isCancel(usStates)) onCancel();
|
|
7065
|
+
const gdpr = await p34.select({
|
|
6923
7066
|
message: "Do you want your Privacy Policy to include GDPR / UK GDPR wording?",
|
|
6924
7067
|
options: [
|
|
6925
7068
|
{ value: "yes", label: "Yes. Include GDPR rights for EEA, UK, and Swiss residents" },
|
|
6926
7069
|
{ value: "no", label: "No" }
|
|
6927
7070
|
]
|
|
6928
7071
|
});
|
|
6929
|
-
if (
|
|
7072
|
+
if (p34.isCancel(gdpr)) onCancel();
|
|
6930
7073
|
let facebookFanPage = "no";
|
|
6931
7074
|
const facebookDetails = { name: "", url: "" };
|
|
6932
7075
|
if (gdpr === "yes") {
|
|
6933
|
-
const fan = await
|
|
7076
|
+
const fan = await p34.select({
|
|
6934
7077
|
message: "Do you have a Facebook Fan Page?",
|
|
6935
7078
|
options: [
|
|
6936
7079
|
{ value: "yes", label: "Yes, we have a Facebook Fan Page" },
|
|
6937
7080
|
{ value: "no", label: "No" }
|
|
6938
7081
|
]
|
|
6939
7082
|
});
|
|
6940
|
-
if (
|
|
7083
|
+
if (p34.isCancel(fan)) onCancel();
|
|
6941
7084
|
facebookFanPage = fan;
|
|
6942
7085
|
if (facebookFanPage === "yes") {
|
|
6943
|
-
const name = await
|
|
7086
|
+
const name = await p34.text({
|
|
6944
7087
|
message: "What is the name of the Facebook Fan Page?",
|
|
6945
7088
|
placeholder: "My Facebook Page"
|
|
6946
7089
|
});
|
|
6947
|
-
if (
|
|
7090
|
+
if (p34.isCancel(name)) onCancel();
|
|
6948
7091
|
facebookDetails.name = name;
|
|
6949
|
-
const url = await
|
|
7092
|
+
const url = await p34.text({
|
|
6950
7093
|
message: "What is the URL of the Facebook Fan Page?",
|
|
6951
7094
|
placeholder: "https://facebook.com/my-facebook-page"
|
|
6952
7095
|
});
|
|
6953
|
-
if (
|
|
7096
|
+
if (p34.isCancel(url)) onCancel();
|
|
6954
7097
|
facebookDetails.url = url;
|
|
6955
7098
|
}
|
|
6956
7099
|
}
|
|
6957
|
-
const kids = await
|
|
7100
|
+
const kids = await p34.select({
|
|
6958
7101
|
message: "Do you collect information from kids under the age of 13?",
|
|
6959
7102
|
options: [
|
|
6960
7103
|
{ value: "yes", label: "Yes. We collect information from children under the age of 13" },
|
|
6961
7104
|
{ value: "no", label: "No" }
|
|
6962
7105
|
]
|
|
6963
7106
|
});
|
|
6964
|
-
if (
|
|
6965
|
-
const retention = await
|
|
7107
|
+
if (p34.isCancel(kids)) onCancel();
|
|
7108
|
+
const retention = await p34.text({
|
|
6966
7109
|
message: "How long do you retain personal information? (leave blank for default wording)",
|
|
6967
7110
|
placeholder: "e.g. 12 months after account closure"
|
|
6968
7111
|
});
|
|
6969
|
-
if (
|
|
7112
|
+
if (p34.isCancel(retention)) onCancel();
|
|
6970
7113
|
const html = generatePrivacyHtml({
|
|
6971
7114
|
core,
|
|
6972
7115
|
personalInfo: personalInfo ?? [],
|
|
@@ -7021,16 +7164,16 @@ async function privacyAction() {
|
|
|
7021
7164
|
]
|
|
7022
7165
|
});
|
|
7023
7166
|
}
|
|
7024
|
-
var privacy = new
|
|
7167
|
+
var privacy = new Command50("privacy").description("generate placeholder privacy policy").configureHelp(helpConfig).action(() => runCommand(privacyAction, "Failed to generate privacy policy."));
|
|
7025
7168
|
|
|
7026
7169
|
// src/commands/legal.ts
|
|
7027
|
-
var legal = new
|
|
7170
|
+
var legal = new Command51("legal").description("generate placeholder legal documents").configureHelp(helpConfig).addCommand(terms).addCommand(privacy);
|
|
7028
7171
|
|
|
7029
7172
|
// src/commands/fixtures.ts
|
|
7030
|
-
import { Command as
|
|
7173
|
+
import { Command as Command57 } from "commander";
|
|
7031
7174
|
|
|
7032
7175
|
// src/commands/fixtures/load.ts
|
|
7033
|
-
import { Command as
|
|
7176
|
+
import { Command as Command52 } from "commander";
|
|
7034
7177
|
|
|
7035
7178
|
// src/lib/data.ts
|
|
7036
7179
|
import fs28 from "node:fs";
|
|
@@ -7220,7 +7363,7 @@ async function hasLoadedFixtures(pb) {
|
|
|
7220
7363
|
}
|
|
7221
7364
|
|
|
7222
7365
|
// src/commands/fixtures/load.ts
|
|
7223
|
-
var load = new
|
|
7366
|
+
var load = new Command52("load").description("load fixtures into the database").configureHelp(helpConfig).action(
|
|
7224
7367
|
() => runCommand(async () => {
|
|
7225
7368
|
const { workspaceRootDir } = await getWorkspace();
|
|
7226
7369
|
let loaded = [];
|
|
@@ -7246,8 +7389,8 @@ var load = new Command51("load").description("load fixtures into the database").
|
|
|
7246
7389
|
);
|
|
7247
7390
|
|
|
7248
7391
|
// src/commands/fixtures/clear.ts
|
|
7249
|
-
import { Command as
|
|
7250
|
-
var clear = new
|
|
7392
|
+
import { Command as Command53 } from "commander";
|
|
7393
|
+
var clear = new Command53("clear").description("clear loaded fixtures").configureHelp(helpConfig).action(
|
|
7251
7394
|
() => runCommand(async () => {
|
|
7252
7395
|
const { workspaceRootDir } = await getWorkspace();
|
|
7253
7396
|
let cleared = [];
|
|
@@ -7276,8 +7419,8 @@ var clear = new Command52("clear").description("clear loaded fixtures").configur
|
|
|
7276
7419
|
);
|
|
7277
7420
|
|
|
7278
7421
|
// src/commands/fixtures/reset.ts
|
|
7279
|
-
import { Command as
|
|
7280
|
-
var reset = new
|
|
7422
|
+
import { Command as Command54 } from "commander";
|
|
7423
|
+
var reset = new Command54("reset").description("clear and reload fixtures").configureHelp(helpConfig).action(
|
|
7281
7424
|
() => runCommand(async () => {
|
|
7282
7425
|
const { workspaceRootDir } = await getWorkspace();
|
|
7283
7426
|
let cleared = [];
|
|
@@ -7309,8 +7452,8 @@ var reset = new Command53("reset").description("clear and reload fixtures").conf
|
|
|
7309
7452
|
// src/commands/fixtures/generate.ts
|
|
7310
7453
|
import fs29 from "node:fs";
|
|
7311
7454
|
import path26 from "node:path";
|
|
7312
|
-
import { Command as
|
|
7313
|
-
import * as
|
|
7455
|
+
import { Command as Command55, InvalidArgumentError } from "commander";
|
|
7456
|
+
import * as p35 from "@clack/prompts";
|
|
7314
7457
|
import { annotate } from "annotate-json-schema";
|
|
7315
7458
|
import { createGenerator } from "json-schema-faker";
|
|
7316
7459
|
import { faker } from "@faker-js/faker";
|
|
@@ -7420,7 +7563,7 @@ async function generateFixtureFiles(pb, workspaceRootDir, opts) {
|
|
|
7420
7563
|
}
|
|
7421
7564
|
return { writtenFiles, warnings };
|
|
7422
7565
|
}
|
|
7423
|
-
var generate2 = new
|
|
7566
|
+
var generate2 = new Command55("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(
|
|
7424
7567
|
(opts) => runCommand(async () => {
|
|
7425
7568
|
const { workspaceRootDir } = await getWorkspace();
|
|
7426
7569
|
const existing = getFixtureFiles(workspaceRootDir);
|
|
@@ -7449,7 +7592,7 @@ var generate2 = new Command54("generate").description("generate fixture data").o
|
|
|
7449
7592
|
seed: opts.seed
|
|
7450
7593
|
});
|
|
7451
7594
|
});
|
|
7452
|
-
for (const warning of result.warnings)
|
|
7595
|
+
for (const warning of result.warnings) p35.log.warn(warning);
|
|
7453
7596
|
if (result.writtenFiles.length === 0) {
|
|
7454
7597
|
reportResult({
|
|
7455
7598
|
summary: "No eligible collections found to generate fixtures for.",
|
|
@@ -7473,8 +7616,8 @@ var generate2 = new Command54("generate").description("generate fixture data").o
|
|
|
7473
7616
|
);
|
|
7474
7617
|
|
|
7475
7618
|
// src/commands/fixtures/regen.ts
|
|
7476
|
-
import { Command as
|
|
7477
|
-
import * as
|
|
7619
|
+
import { Command as Command56, InvalidArgumentError as InvalidArgumentError2 } from "commander";
|
|
7620
|
+
import * as p36 from "@clack/prompts";
|
|
7478
7621
|
function parseCount2(value) {
|
|
7479
7622
|
const n = parseInt(value, 10);
|
|
7480
7623
|
if (!Number.isFinite(n) || n <= 0 || n > 999) {
|
|
@@ -7489,7 +7632,7 @@ function parseSeed2(value) {
|
|
|
7489
7632
|
}
|
|
7490
7633
|
return n;
|
|
7491
7634
|
}
|
|
7492
|
-
var regen = new
|
|
7635
|
+
var regen = new Command56("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(
|
|
7493
7636
|
(opts) => runCommand(async () => {
|
|
7494
7637
|
const { workspaceRootDir } = await getWorkspace();
|
|
7495
7638
|
let cleared = [];
|
|
@@ -7503,7 +7646,7 @@ var regen = new Command55("regen").description("clear the database, regenerate f
|
|
|
7503
7646
|
});
|
|
7504
7647
|
loaded = await loadFixtures(pb, workspaceRootDir);
|
|
7505
7648
|
});
|
|
7506
|
-
for (const warning of result.warnings)
|
|
7649
|
+
for (const warning of result.warnings) p36.log.warn(warning);
|
|
7507
7650
|
reportResult({
|
|
7508
7651
|
summary: `Regenerated fixtures (${loaded.length} collection(s) reloaded).`,
|
|
7509
7652
|
filesCreated: result.writtenFiles,
|
|
@@ -7518,14 +7661,14 @@ var regen = new Command55("regen").description("clear the database, regenerate f
|
|
|
7518
7661
|
);
|
|
7519
7662
|
|
|
7520
7663
|
// src/commands/fixtures.ts
|
|
7521
|
-
var fixtures = new
|
|
7664
|
+
var fixtures = new Command57("fixtures").description("manage fixture data").configureHelp(helpConfig).addCommand(generate2).addCommand(load).addCommand(clear).addCommand(reset).addCommand(regen);
|
|
7522
7665
|
|
|
7523
7666
|
// src/commands/seeds.ts
|
|
7524
|
-
import { Command as
|
|
7667
|
+
import { Command as Command61 } from "commander";
|
|
7525
7668
|
|
|
7526
7669
|
// src/commands/seeds/load.ts
|
|
7527
|
-
import { Command as
|
|
7528
|
-
var load2 = new
|
|
7670
|
+
import { Command as Command58 } from "commander";
|
|
7671
|
+
var load2 = new Command58("load").description("load seeds into the database").option("-f, --force", "load even if target collections already have records").configureHelp(helpConfig).action(
|
|
7529
7672
|
(opts) => runCommand(async () => {
|
|
7530
7673
|
const { workspaceRootDir } = await getWorkspace();
|
|
7531
7674
|
const seedFiles = getSeedFiles(workspaceRootDir);
|
|
@@ -7564,7 +7707,7 @@ var load2 = new Command57("load").description("load seeds into the database").op
|
|
|
7564
7707
|
// src/commands/seeds/save.ts
|
|
7565
7708
|
import fs30 from "node:fs";
|
|
7566
7709
|
import path27 from "node:path";
|
|
7567
|
-
import { Command as
|
|
7710
|
+
import { Command as Command59 } from "commander";
|
|
7568
7711
|
var padZeros2 = (num, length) => num.toString().padStart(length, "0");
|
|
7569
7712
|
function filterSystemFields(record, systemFieldNames) {
|
|
7570
7713
|
const out = {};
|
|
@@ -7575,7 +7718,7 @@ function filterSystemFields(record, systemFieldNames) {
|
|
|
7575
7718
|
}
|
|
7576
7719
|
return out;
|
|
7577
7720
|
}
|
|
7578
|
-
var save = new
|
|
7721
|
+
var save = new Command59("save").description("save the current data as seeds").option("-f, --force", "overwrite existing seed files").configureHelp(helpConfig).action(
|
|
7579
7722
|
(opts) => runCommand(async () => {
|
|
7580
7723
|
const { workspaceRootDir } = await getWorkspace();
|
|
7581
7724
|
const seedsPath = dataDir(workspaceRootDir, "seeds");
|
|
@@ -7647,8 +7790,8 @@ var save = new Command58("save").description("save the current data as seeds").o
|
|
|
7647
7790
|
);
|
|
7648
7791
|
|
|
7649
7792
|
// src/commands/seeds/clear.ts
|
|
7650
|
-
import { Command as
|
|
7651
|
-
var clear2 = new
|
|
7793
|
+
import { Command as Command60 } from "commander";
|
|
7794
|
+
var clear2 = new Command60("clear").description("clear seeded records").configureHelp(helpConfig).action(
|
|
7652
7795
|
() => runCommand(async () => {
|
|
7653
7796
|
const { workspaceRootDir } = await getWorkspace();
|
|
7654
7797
|
const seedFiles = getSeedFiles(workspaceRootDir);
|
|
@@ -7679,23 +7822,23 @@ var clear2 = new Command59("clear").description("clear seeded records").configur
|
|
|
7679
7822
|
);
|
|
7680
7823
|
|
|
7681
7824
|
// src/commands/seeds.ts
|
|
7682
|
-
var seeds = new
|
|
7825
|
+
var seeds = new Command61("seeds").description("manage seed data").configureHelp(helpConfig).addCommand(load2).addCommand(save).addCommand(clear2);
|
|
7683
7826
|
|
|
7684
7827
|
// src/commands/signup.ts
|
|
7685
|
-
import { Command as
|
|
7686
|
-
import * as
|
|
7828
|
+
import { Command as Command63 } from "commander";
|
|
7829
|
+
import * as p38 from "@clack/prompts";
|
|
7687
7830
|
import makeFetchCookie2 from "fetch-cookie";
|
|
7688
7831
|
|
|
7689
7832
|
// src/commands/login.ts
|
|
7690
7833
|
import os4 from "node:os";
|
|
7691
|
-
import { Command as
|
|
7692
|
-
import * as
|
|
7834
|
+
import { Command as Command62 } from "commander";
|
|
7835
|
+
import * as p37 from "@clack/prompts";
|
|
7693
7836
|
import makeFetchCookie from "fetch-cookie";
|
|
7694
|
-
var login = new
|
|
7837
|
+
var login = new Command62("login").description("login to velastack.dev").configureHelp(helpConfig).action(
|
|
7695
7838
|
() => runCommand(async () => {
|
|
7696
|
-
const { email: email3, password: password11 } = await
|
|
7697
|
-
email: () =>
|
|
7698
|
-
password: () =>
|
|
7839
|
+
const { email: email3, password: password11 } = await p37.group({
|
|
7840
|
+
email: () => p37.text({ message: "Email" }),
|
|
7841
|
+
password: () => p37.password({ message: "Password" })
|
|
7699
7842
|
});
|
|
7700
7843
|
const fetchCookie = makeFetchCookie(fetch);
|
|
7701
7844
|
const loginRes = await fetchCookie(`${API_URL}/login`, {
|
|
@@ -7717,7 +7860,7 @@ var login = new Command61("login").description("login to velastack.dev").configu
|
|
|
7717
7860
|
}
|
|
7718
7861
|
const apiKey = await issueApiKey(fetchCookie);
|
|
7719
7862
|
writeConfig({ apiKey });
|
|
7720
|
-
|
|
7863
|
+
p37.log.success("Logged in to velastack.dev");
|
|
7721
7864
|
}, "Failed to login.")
|
|
7722
7865
|
);
|
|
7723
7866
|
async function issueApiKey(fetchCookie) {
|
|
@@ -7758,12 +7901,12 @@ function extractApiKey(cookie) {
|
|
|
7758
7901
|
}
|
|
7759
7902
|
|
|
7760
7903
|
// src/commands/signup.ts
|
|
7761
|
-
var signup = new
|
|
7904
|
+
var signup = new Command63("signup").description("signup to velastack.dev").configureHelp(helpConfig).action(
|
|
7762
7905
|
() => runCommand(async () => {
|
|
7763
|
-
const { email: email3, password: password11, passwordConfirm } = await
|
|
7764
|
-
email: () =>
|
|
7765
|
-
password: () =>
|
|
7766
|
-
passwordConfirm: () =>
|
|
7906
|
+
const { email: email3, password: password11, passwordConfirm } = await p38.group({
|
|
7907
|
+
email: () => p38.text({ message: "Email" }),
|
|
7908
|
+
password: () => p38.password({ message: "Password" }),
|
|
7909
|
+
passwordConfirm: () => p38.password({ message: "Confirm password" })
|
|
7767
7910
|
});
|
|
7768
7911
|
if (password11 !== passwordConfirm) {
|
|
7769
7912
|
throw new Error("Passwords do not match.");
|
|
@@ -7787,33 +7930,33 @@ var signup = new Command62("signup").description("signup to velastack.dev").conf
|
|
|
7787
7930
|
}
|
|
7788
7931
|
const apiKey = await issueApiKey(fetchCookie);
|
|
7789
7932
|
writeConfig({ apiKey });
|
|
7790
|
-
|
|
7791
|
-
|
|
7933
|
+
p38.log.success("Signed up to velastack.dev");
|
|
7934
|
+
p38.log.info("Check your email for a confirmation link.");
|
|
7792
7935
|
}, "Failed to signup.")
|
|
7793
7936
|
);
|
|
7794
7937
|
|
|
7795
7938
|
// src/commands/logout.ts
|
|
7796
|
-
import { Command as
|
|
7797
|
-
import * as
|
|
7798
|
-
var logout = new
|
|
7939
|
+
import { Command as Command64 } from "commander";
|
|
7940
|
+
import * as p39 from "@clack/prompts";
|
|
7941
|
+
var logout = new Command64("logout").alias("signout").description("logout from velastack.dev").configureHelp(helpConfig).action(
|
|
7799
7942
|
() => runCommand(() => {
|
|
7800
7943
|
if (!readConfig()) {
|
|
7801
|
-
|
|
7944
|
+
p39.log.info("Not logged in");
|
|
7802
7945
|
return;
|
|
7803
7946
|
}
|
|
7804
7947
|
clearConfig();
|
|
7805
|
-
|
|
7948
|
+
p39.log.success("Logged out of velastack.dev");
|
|
7806
7949
|
})
|
|
7807
7950
|
);
|
|
7808
7951
|
|
|
7809
7952
|
// src/commands/whoami.ts
|
|
7810
|
-
import { Command as
|
|
7811
|
-
import * as
|
|
7812
|
-
var whoami = new
|
|
7953
|
+
import { Command as Command65 } from "commander";
|
|
7954
|
+
import * as p40 from "@clack/prompts";
|
|
7955
|
+
var whoami = new Command65("whoami").description("show the current user").configureHelp(helpConfig).action(
|
|
7813
7956
|
() => runCommand(async () => {
|
|
7814
7957
|
const apiKey = readConfig()?.apiKey;
|
|
7815
7958
|
if (!apiKey) {
|
|
7816
|
-
|
|
7959
|
+
p40.log.info("Not logged in. Run `vela login` to login.");
|
|
7817
7960
|
return;
|
|
7818
7961
|
}
|
|
7819
7962
|
const res = await fetch(`${API_URL}/api/collections/users/records`, {
|
|
@@ -7821,22 +7964,22 @@ var whoami = new Command64("whoami").description("show the current user").config
|
|
|
7821
7964
|
});
|
|
7822
7965
|
const data = await res.json();
|
|
7823
7966
|
if (!data.items.length) throw new Error("No user found. Run `vela login` to login.");
|
|
7824
|
-
|
|
7967
|
+
p40.log.success(`Logged in as ${data.items[0].email}`);
|
|
7825
7968
|
})
|
|
7826
7969
|
);
|
|
7827
7970
|
|
|
7828
7971
|
// src/commands/migrate.ts
|
|
7829
|
-
import { Command as
|
|
7972
|
+
import { Command as Command71 } from "commander";
|
|
7830
7973
|
|
|
7831
7974
|
// src/commands/migrate/up.ts
|
|
7832
|
-
import { Command as
|
|
7975
|
+
import { Command as Command66 } from "commander";
|
|
7833
7976
|
|
|
7834
7977
|
// src/lib/migrate.ts
|
|
7835
7978
|
import path28 from "node:path";
|
|
7836
|
-
import
|
|
7979
|
+
import process21 from "node:process";
|
|
7837
7980
|
import { x as x2 } from "tinyexec";
|
|
7838
7981
|
async function runPocketbaseMigrate(args) {
|
|
7839
|
-
const cwd =
|
|
7982
|
+
const cwd = process21.cwd();
|
|
7840
7983
|
const { getBinaryPath } = await import("pocketbase-server");
|
|
7841
7984
|
const binaryPath = getBinaryPath();
|
|
7842
7985
|
await x2(
|
|
@@ -7868,10 +8011,10 @@ async function runMigrateUp() {
|
|
|
7868
8011
|
]
|
|
7869
8012
|
});
|
|
7870
8013
|
}
|
|
7871
|
-
var up = new
|
|
8014
|
+
var up = new Command66("up").description("apply all pending migrations").configureHelp(helpConfig).action(() => runCommand(runMigrateUp, "Failed to run migrations."));
|
|
7872
8015
|
|
|
7873
8016
|
// src/commands/migrate/down.ts
|
|
7874
|
-
import { Command as
|
|
8017
|
+
import { Command as Command67, InvalidArgumentError as InvalidArgumentError3 } from "commander";
|
|
7875
8018
|
function parseSteps(value) {
|
|
7876
8019
|
const n = parseInt(value, 10);
|
|
7877
8020
|
if (!Number.isFinite(n) || n <= 0) {
|
|
@@ -7879,7 +8022,7 @@ function parseSteps(value) {
|
|
|
7879
8022
|
}
|
|
7880
8023
|
return n;
|
|
7881
8024
|
}
|
|
7882
|
-
var down = new
|
|
8025
|
+
var down = new Command67("down").alias("rollback").description("revert the last N applied migrations").argument("[number]", "how many migrations to revert", parseSteps, 1).configureHelp(helpConfig).action(
|
|
7883
8026
|
(n) => runCommand(async () => {
|
|
7884
8027
|
await runPocketbaseMigrate(["down", String(n)]);
|
|
7885
8028
|
reportResult({
|
|
@@ -7895,11 +8038,11 @@ var down = new Command66("down").alias("rollback").description("revert the last
|
|
|
7895
8038
|
// src/commands/migrate/create.ts
|
|
7896
8039
|
import fs31 from "node:fs";
|
|
7897
8040
|
import path29 from "node:path";
|
|
7898
|
-
import
|
|
7899
|
-
import { Command as
|
|
7900
|
-
var create2 = new
|
|
8041
|
+
import process22 from "node:process";
|
|
8042
|
+
import { Command as Command68 } from "commander";
|
|
8043
|
+
var create2 = new Command68("create").alias("new").description("create a new blank migration").argument("<name>", "migration name (snake_case)").configureHelp(helpConfig).action(
|
|
7901
8044
|
(name) => runCommand(async () => {
|
|
7902
|
-
const cwd =
|
|
8045
|
+
const cwd = process22.cwd();
|
|
7903
8046
|
const before = listMigrationFiles(cwd);
|
|
7904
8047
|
await runPocketbaseMigrate(["create", name]);
|
|
7905
8048
|
const after = listMigrationFiles(cwd);
|
|
@@ -7923,11 +8066,11 @@ function listMigrationFiles(cwd) {
|
|
|
7923
8066
|
// src/commands/migrate/collections.ts
|
|
7924
8067
|
import fs32 from "node:fs";
|
|
7925
8068
|
import path30 from "node:path";
|
|
7926
|
-
import
|
|
7927
|
-
import { Command as
|
|
7928
|
-
var collections = new
|
|
8069
|
+
import process23 from "node:process";
|
|
8070
|
+
import { Command as Command69 } from "commander";
|
|
8071
|
+
var collections = new Command69("collections").alias("snapshot").description("snapshot local collections into a new migration").configureHelp(helpConfig).action(
|
|
7929
8072
|
() => runCommand(async () => {
|
|
7930
|
-
const cwd =
|
|
8073
|
+
const cwd = process23.cwd();
|
|
7931
8074
|
const before = listMigrationFiles2(cwd);
|
|
7932
8075
|
await runPocketbaseMigrate(["collections"]);
|
|
7933
8076
|
const after = listMigrationFiles2(cwd);
|
|
@@ -7956,8 +8099,8 @@ function listMigrationFiles2(cwd) {
|
|
|
7956
8099
|
}
|
|
7957
8100
|
|
|
7958
8101
|
// src/commands/migrate/history-sync.ts
|
|
7959
|
-
import { Command as
|
|
7960
|
-
var historySync = new
|
|
8102
|
+
import { Command as Command70 } from "commander";
|
|
8103
|
+
var historySync = new Command70("history-sync").description("drop _migrations rows whose files no longer exist").configureHelp(helpConfig).action(
|
|
7961
8104
|
() => runCommand(async () => {
|
|
7962
8105
|
await runPocketbaseMigrate(["history-sync"]);
|
|
7963
8106
|
reportResult({
|
|
@@ -7968,20 +8111,20 @@ var historySync = new Command69("history-sync").description("drop _migrations ro
|
|
|
7968
8111
|
);
|
|
7969
8112
|
|
|
7970
8113
|
// src/commands/migrate.ts
|
|
7971
|
-
var migrate = new
|
|
8114
|
+
var migrate = new Command71("migrate").description("manage database migrations").configureHelp(helpConfig).action(() => runCommand(runMigrateUp, "Failed to run migrations.")).addCommand(up).addCommand(down).addCommand(create2).addCommand(collections).addCommand(historySync);
|
|
7972
8115
|
|
|
7973
8116
|
// src/commands/dev.ts
|
|
7974
8117
|
import fs33 from "node:fs";
|
|
7975
8118
|
import path32 from "node:path";
|
|
7976
|
-
import
|
|
8119
|
+
import process25 from "node:process";
|
|
7977
8120
|
import { performance } from "node:perf_hooks";
|
|
7978
|
-
import { Command as
|
|
8121
|
+
import { Command as Command72, InvalidArgumentError as InvalidArgumentError4 } from "commander";
|
|
7979
8122
|
import pc15 from "picocolors";
|
|
7980
8123
|
import PocketBase4 from "pocketbase";
|
|
7981
8124
|
|
|
7982
8125
|
// src/lib/vite.ts
|
|
7983
8126
|
import path31 from "node:path";
|
|
7984
|
-
import
|
|
8127
|
+
import process24 from "node:process";
|
|
7985
8128
|
import { createRequire as createRequire2 } from "node:module";
|
|
7986
8129
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
7987
8130
|
import pc14 from "picocolors";
|
|
@@ -8005,13 +8148,13 @@ function resolveProjectVite(cwd) {
|
|
|
8005
8148
|
return null;
|
|
8006
8149
|
}
|
|
8007
8150
|
}
|
|
8008
|
-
async function loadVite(cwd =
|
|
8151
|
+
async function loadVite(cwd = process24.cwd()) {
|
|
8009
8152
|
const entry = resolveProjectVite(cwd);
|
|
8010
8153
|
const vite = entry ? await import(pathToFileURL2(entry).href) : await import("vite");
|
|
8011
8154
|
const error = viteVersionError(vite.version);
|
|
8012
8155
|
if (error) {
|
|
8013
8156
|
console.error(`${pc14.redBright("\u2717")} ${error}`);
|
|
8014
|
-
|
|
8157
|
+
process24.exit(1);
|
|
8015
8158
|
}
|
|
8016
8159
|
return vite;
|
|
8017
8160
|
}
|
|
@@ -8024,16 +8167,16 @@ function parsePort(value) {
|
|
|
8024
8167
|
}
|
|
8025
8168
|
return port;
|
|
8026
8169
|
}
|
|
8027
|
-
var dev = new
|
|
8028
|
-
const cwd =
|
|
8029
|
-
|
|
8170
|
+
var dev = new Command72("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) => {
|
|
8171
|
+
const cwd = process25.cwd();
|
|
8172
|
+
process25.env.VELA_DATA_DIR ??= localDataDir(cwd);
|
|
8030
8173
|
const startTime = performance.now();
|
|
8031
8174
|
const { createServer, version } = await loadVite(cwd);
|
|
8032
8175
|
const viteMetadataDir = path32.join(cwd, "node_modules", ".vite");
|
|
8033
8176
|
const viteMetadataFile = path32.join(viteMetadataDir, "_pocketbase_metadata.json");
|
|
8034
8177
|
let pbProc;
|
|
8035
8178
|
const backend3 = hasBackend(cwd);
|
|
8036
|
-
const needsStart = backend3 && !
|
|
8179
|
+
const needsStart = backend3 && !process25.env.POCKETBASE_URL;
|
|
8037
8180
|
const cleanup = () => {
|
|
8038
8181
|
if (pbProc?.pid) pbProc.kill();
|
|
8039
8182
|
if (fs33.existsSync(viteMetadataFile)) fs33.rmSync(viteMetadataFile);
|
|
@@ -8048,15 +8191,15 @@ var dev = new Command71("dev").description("start the development server").optio
|
|
|
8048
8191
|
stdio: "pipe"
|
|
8049
8192
|
});
|
|
8050
8193
|
pbProc = started.proc;
|
|
8051
|
-
|
|
8052
|
-
pbProc.stdout?.pipe(
|
|
8053
|
-
pbProc.stderr?.pipe(
|
|
8194
|
+
process25.env.POCKETBASE_URL = started.url;
|
|
8195
|
+
pbProc.stdout?.pipe(process25.stdout);
|
|
8196
|
+
pbProc.stderr?.pipe(process25.stderr);
|
|
8054
8197
|
pbProc.on("error", (err) => console.error("PocketBase error:", err));
|
|
8055
8198
|
pbProc.on("exit", (code) => console.log(`PocketBase exited with code ${code}`));
|
|
8056
|
-
|
|
8057
|
-
|
|
8199
|
+
process25.on("exit", cleanup);
|
|
8200
|
+
process25.on("SIGINT", () => {
|
|
8058
8201
|
cleanup();
|
|
8059
|
-
|
|
8202
|
+
process25.exit(0);
|
|
8060
8203
|
});
|
|
8061
8204
|
}
|
|
8062
8205
|
const serverOptions = {};
|
|
@@ -8078,21 +8221,21 @@ var dev = new Command71("dev").description("start the development server").optio
|
|
|
8078
8221
|
await fs33.promises.writeFile(
|
|
8079
8222
|
viteMetadataFile,
|
|
8080
8223
|
JSON.stringify({
|
|
8081
|
-
pocketbaseUrl:
|
|
8224
|
+
pocketbaseUrl: process25.env.POCKETBASE_URL,
|
|
8082
8225
|
vitePort,
|
|
8083
8226
|
viteHost
|
|
8084
8227
|
})
|
|
8085
8228
|
);
|
|
8086
|
-
const pb = new PocketBase4(
|
|
8229
|
+
const pb = new PocketBase4(process25.env.POCKETBASE_URL);
|
|
8087
8230
|
await pb.collection("_superusers").authWithPassword(
|
|
8088
|
-
|
|
8089
|
-
|
|
8231
|
+
process25.env.POCKETBASE_SUPERUSER_EMAIL,
|
|
8232
|
+
process25.env.POCKETBASE_SUPERUSER_PASSWORD
|
|
8090
8233
|
);
|
|
8091
8234
|
await pb.settings.update({ meta: { appURL: `http://${viteHost}:${vitePort}` } });
|
|
8092
8235
|
await startWatchingTypes(cwd, pb);
|
|
8093
8236
|
});
|
|
8094
8237
|
await server.listen();
|
|
8095
|
-
const hasExistingLogs =
|
|
8238
|
+
const hasExistingLogs = process25.stdout.bytesWritten > 0 || process25.stderr.bytesWritten > 0;
|
|
8096
8239
|
const startupDurationString = pc15.dim(
|
|
8097
8240
|
`ready in ${pc15.reset(pc15.bold(Math.ceil(performance.now() - startTime)))} ms`
|
|
8098
8241
|
);
|
|
@@ -8132,9 +8275,9 @@ async function startWatchingTypes(cwd, pb) {
|
|
|
8132
8275
|
// src/commands/build.ts
|
|
8133
8276
|
import fs34 from "node:fs";
|
|
8134
8277
|
import path33 from "node:path";
|
|
8135
|
-
import
|
|
8136
|
-
import { Command as
|
|
8137
|
-
import * as
|
|
8278
|
+
import process27 from "node:process";
|
|
8279
|
+
import { Command as Command73 } from "commander";
|
|
8280
|
+
import * as p41 from "@clack/prompts";
|
|
8138
8281
|
import pc16 from "picocolors";
|
|
8139
8282
|
import { x as x3 } from "tinyexec";
|
|
8140
8283
|
import { detect as detect5 } from "package-manager-detector";
|
|
@@ -8147,10 +8290,10 @@ function applyBuildEnv(cwd, env2 = process.env) {
|
|
|
8147
8290
|
}
|
|
8148
8291
|
|
|
8149
8292
|
// src/lib/origin.ts
|
|
8150
|
-
import
|
|
8293
|
+
import process26 from "node:process";
|
|
8151
8294
|
function resolveOrigin(workspaceRootDir, envTag, config = {}) {
|
|
8152
8295
|
return normalizeOrigin(
|
|
8153
|
-
|
|
8296
|
+
process26.env.VELA_ORIGIN ?? readBinding(workspaceRootDir, envTag)?.domain ?? config.deploy?.domain
|
|
8154
8297
|
);
|
|
8155
8298
|
}
|
|
8156
8299
|
function normalizeOrigin(value) {
|
|
@@ -8170,13 +8313,13 @@ function splitHosts(value) {
|
|
|
8170
8313
|
|
|
8171
8314
|
// src/commands/build.ts
|
|
8172
8315
|
var PRERENDERED_DIR = path33.join(".svelte-kit", "output", "prerendered");
|
|
8173
|
-
var build = new
|
|
8174
|
-
const cwd =
|
|
8316
|
+
var build = new Command73("build").description("build the app").configureHelp(helpConfig).option("-t, --target <target>", "which copy of the app to build for", PRODUCTION_TARGET).action(async (options) => {
|
|
8317
|
+
const cwd = process27.cwd();
|
|
8175
8318
|
applyBuildEnv(cwd);
|
|
8176
8319
|
const origin = await originForBuild(cwd, options.target);
|
|
8177
|
-
if (origin)
|
|
8320
|
+
if (origin) process27.env.VELA_ORIGIN = origin;
|
|
8178
8321
|
let pbProc;
|
|
8179
|
-
const needsStart = hasBackend(cwd) && !
|
|
8322
|
+
const needsStart = hasBackend(cwd) && !process27.env.POCKETBASE_URL;
|
|
8180
8323
|
const cleanup = () => {
|
|
8181
8324
|
if (pbProc?.pid) pbProc.kill();
|
|
8182
8325
|
};
|
|
@@ -8190,11 +8333,11 @@ var build = new Command72("build").description("build the app").configureHelp(he
|
|
|
8190
8333
|
dev: true
|
|
8191
8334
|
});
|
|
8192
8335
|
pbProc = started.proc;
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8336
|
+
process27.env.POCKETBASE_URL = started.url;
|
|
8337
|
+
process27.on("exit", cleanup);
|
|
8338
|
+
process27.on("SIGINT", () => {
|
|
8196
8339
|
cleanup();
|
|
8197
|
-
|
|
8340
|
+
process27.exit(0);
|
|
8198
8341
|
});
|
|
8199
8342
|
}
|
|
8200
8343
|
try {
|
|
@@ -8227,7 +8370,7 @@ async function originForBuild(cwd, target) {
|
|
|
8227
8370
|
function warnIfPrerendered(cwd) {
|
|
8228
8371
|
const dir = path33.join(cwd, PRERENDERED_DIR);
|
|
8229
8372
|
if (!fs34.existsSync(dir) || fs34.readdirSync(dir).length === 0) return;
|
|
8230
|
-
|
|
8373
|
+
p41.log.warn(
|
|
8231
8374
|
`Prerendered pages were built with no domain configured, so their canonical
|
|
8232
8375
|
links point at SvelteKit's placeholder host rather than at this site.
|
|
8233
8376
|
|
|
@@ -8237,16 +8380,16 @@ Set one with ${pc16.cyan("vela deploy --domain example.com")}, or pass ${pc16.cy
|
|
|
8237
8380
|
|
|
8238
8381
|
// src/commands/preview.ts
|
|
8239
8382
|
import path34 from "node:path";
|
|
8240
|
-
import
|
|
8241
|
-
import { Command as
|
|
8383
|
+
import process28 from "node:process";
|
|
8384
|
+
import { Command as Command74 } from "commander";
|
|
8242
8385
|
import { x as x4 } from "tinyexec";
|
|
8243
8386
|
import { detect as detect6 } from "package-manager-detector";
|
|
8244
8387
|
import { resolveCommand as resolveCommand6 } from "package-manager-detector/commands";
|
|
8245
|
-
var preview = new
|
|
8246
|
-
const cwd =
|
|
8247
|
-
|
|
8388
|
+
var preview = new Command74("preview").description("preview the built app").configureHelp(helpConfig).action(async () => {
|
|
8389
|
+
const cwd = process28.cwd();
|
|
8390
|
+
process28.env.VELA_DATA_DIR ??= localDataDir(cwd);
|
|
8248
8391
|
let pbProc;
|
|
8249
|
-
const needsStart = hasBackend(cwd) && !
|
|
8392
|
+
const needsStart = hasBackend(cwd) && !process28.env.POCKETBASE_URL;
|
|
8250
8393
|
const cleanup = () => {
|
|
8251
8394
|
if (pbProc?.pid) pbProc.kill();
|
|
8252
8395
|
};
|
|
@@ -8259,11 +8402,11 @@ var preview = new Command73("preview").description("preview the built app").conf
|
|
|
8259
8402
|
dev: true
|
|
8260
8403
|
});
|
|
8261
8404
|
pbProc = started.proc;
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8405
|
+
process28.env.POCKETBASE_URL = started.url;
|
|
8406
|
+
process28.on("exit", cleanup);
|
|
8407
|
+
process28.on("SIGINT", () => {
|
|
8265
8408
|
cleanup();
|
|
8266
|
-
|
|
8409
|
+
process28.exit(0);
|
|
8267
8410
|
});
|
|
8268
8411
|
}
|
|
8269
8412
|
try {
|
|
@@ -8282,8 +8425,8 @@ var preview = new Command73("preview").description("preview the built app").conf
|
|
|
8282
8425
|
|
|
8283
8426
|
// src/commands/sync.ts
|
|
8284
8427
|
import path35 from "node:path";
|
|
8285
|
-
import { Command as
|
|
8286
|
-
var sync = new
|
|
8428
|
+
import { Command as Command75 } from "commander";
|
|
8429
|
+
var sync = new Command75("sync").description("sync types from the database").configureHelp(helpConfig).action(
|
|
8287
8430
|
() => runCommand(async () => {
|
|
8288
8431
|
const { workspaceRootDir } = await getWorkspace();
|
|
8289
8432
|
const typesDir = path35.join(workspaceRootDir, ".svelte-kit", "types");
|
|
@@ -8296,8 +8439,8 @@ var sync = new Command74("sync").description("sync types from the database").con
|
|
|
8296
8439
|
);
|
|
8297
8440
|
|
|
8298
8441
|
// src/commands/provision.ts
|
|
8299
|
-
import { Command as
|
|
8300
|
-
import * as
|
|
8442
|
+
import { Command as Command76 } from "commander";
|
|
8443
|
+
import * as p42 from "@clack/prompts";
|
|
8301
8444
|
import pc17 from "picocolors";
|
|
8302
8445
|
import * as v7 from "valibot";
|
|
8303
8446
|
var OptionsSchema2 = v7.object({
|
|
@@ -8306,24 +8449,24 @@ var OptionsSchema2 = v7.object({
|
|
|
8306
8449
|
nodeMajor: v7.optional(v7.string())
|
|
8307
8450
|
});
|
|
8308
8451
|
var provision = addSshOptions(
|
|
8309
|
-
new
|
|
8452
|
+
new Command76("provision").description("prepare a server to host vela apps").argument("<target>", "SSH target \u2014 an alias from ~/.ssh/config, or user@host").configureHelp(helpConfig)
|
|
8310
8453
|
).option("--pb-version <version>", "PocketBase version to install").option("--node-major <version>", "Node.js major version to install", "22").action(
|
|
8311
8454
|
(target, raw) => runCommand(async () => {
|
|
8312
8455
|
const options = parseOptions(OptionsSchema2, raw);
|
|
8313
8456
|
const pbVersion = options.pbVersion ?? pocketbaseVersion();
|
|
8314
|
-
|
|
8315
|
-
|
|
8457
|
+
p42.intro(pc17.bgCyan(pc17.black(" vela provision ")));
|
|
8458
|
+
p42.log.info(`Target ${pc17.cyan(target)}`);
|
|
8316
8459
|
await withSsh(target, sshOptionsFrom(options), async (session) => {
|
|
8317
8460
|
await session.detectElevation();
|
|
8318
8461
|
const existing = await readServerInfo(session);
|
|
8319
8462
|
if (existing) {
|
|
8320
|
-
|
|
8463
|
+
p42.log.info(
|
|
8321
8464
|
`Already provisioned by vela ${existing.cliVersion} on ${existing.provisionedAt}. Bringing it up to date.`
|
|
8322
8465
|
);
|
|
8323
8466
|
}
|
|
8324
|
-
|
|
8467
|
+
p42.log.step("Uploading server scripts");
|
|
8325
8468
|
await syncServerScripts(session);
|
|
8326
|
-
|
|
8469
|
+
p42.log.step("Running provision");
|
|
8327
8470
|
const result = await runServerScript(session, "provision.sh", {
|
|
8328
8471
|
args: [
|
|
8329
8472
|
"--pb-version",
|
|
@@ -8335,7 +8478,7 @@ var provision = addSshOptions(
|
|
|
8335
8478
|
],
|
|
8336
8479
|
stream: true
|
|
8337
8480
|
});
|
|
8338
|
-
|
|
8481
|
+
p42.log.success(
|
|
8339
8482
|
`${target} is ready.
|
|
8340
8483
|
|
|
8341
8484
|
Node ${result?.node ?? "installed"}
|
|
@@ -8343,29 +8486,29 @@ var provision = addSshOptions(
|
|
|
8343
8486
|
PocketBase ${result?.pocketbase ?? pbVersion}`
|
|
8344
8487
|
);
|
|
8345
8488
|
});
|
|
8346
|
-
|
|
8489
|
+
p42.outro(`Deploy with ${pc17.cyan(`vela deploy --server ${target}`)}`);
|
|
8347
8490
|
}, "Failed to provision.")
|
|
8348
8491
|
);
|
|
8349
8492
|
|
|
8350
8493
|
// src/commands/deploy.ts
|
|
8351
8494
|
import path38 from "node:path";
|
|
8352
8495
|
import fs37 from "node:fs";
|
|
8353
|
-
import { Command as
|
|
8354
|
-
import * as
|
|
8496
|
+
import { Command as Command77, Option as Option2 } from "commander";
|
|
8497
|
+
import * as p43 from "@clack/prompts";
|
|
8355
8498
|
import pc18 from "picocolors";
|
|
8356
8499
|
import * as v8 from "valibot";
|
|
8357
8500
|
|
|
8358
8501
|
// src/lib/pocketbase-settings.ts
|
|
8359
8502
|
import fs35 from "node:fs";
|
|
8360
8503
|
import path36 from "node:path";
|
|
8361
|
-
import
|
|
8504
|
+
import process29 from "node:process";
|
|
8362
8505
|
import PocketBase5 from "pocketbase";
|
|
8363
8506
|
var COPIED_KEYS = ["appName", "senderName", "senderAddress"];
|
|
8364
8507
|
async function readLocalMeta(cwd) {
|
|
8365
8508
|
const dataDir2 = path36.join(cwd, DATA_DIR);
|
|
8366
8509
|
if (!fs35.existsSync(dataDir2)) return null;
|
|
8367
|
-
const email3 =
|
|
8368
|
-
const password11 =
|
|
8510
|
+
const email3 = process29.env.POCKETBASE_SUPERUSER_EMAIL;
|
|
8511
|
+
const password11 = process29.env.POCKETBASE_SUPERUSER_PASSWORD;
|
|
8369
8512
|
if (!email3 || !password11) return null;
|
|
8370
8513
|
let proc;
|
|
8371
8514
|
try {
|
|
@@ -8694,7 +8837,7 @@ var OptionsSchema3 = v8.object({
|
|
|
8694
8837
|
});
|
|
8695
8838
|
var deploy = addLockWaitOption(
|
|
8696
8839
|
addTargetOptions(
|
|
8697
|
-
new
|
|
8840
|
+
new Command77("deploy").description("deploy the app").configureHelp(helpConfig),
|
|
8698
8841
|
"production"
|
|
8699
8842
|
)
|
|
8700
8843
|
).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(
|
|
@@ -8710,7 +8853,7 @@ var deploy = addLockWaitOption(
|
|
|
8710
8853
|
(raw) => runCommand(async () => {
|
|
8711
8854
|
const options = parseOptions(OptionsSchema3, raw);
|
|
8712
8855
|
const backend3 = hasBackend();
|
|
8713
|
-
|
|
8856
|
+
p43.intro(pc18.bgCyan(pc18.black(" vela deploy ")));
|
|
8714
8857
|
if (options.build !== false) {
|
|
8715
8858
|
const { workspaceRootDir } = await getWorkspace();
|
|
8716
8859
|
await prepareAdapter(workspaceRootDir);
|
|
@@ -8720,7 +8863,7 @@ var deploy = addLockWaitOption(
|
|
|
8720
8863
|
{
|
|
8721
8864
|
remote: async (ctx) => {
|
|
8722
8865
|
const { session, instance, workspaceRootDir, config } = ctx;
|
|
8723
|
-
|
|
8866
|
+
p43.log.info(
|
|
8724
8867
|
`${pc18.cyan(ctx.appName)} ${pc18.dim("\u2192")} ${pc18.cyan(ctx.targetName)} ${pc18.dim(`(${ctx.server})`)}`
|
|
8725
8868
|
);
|
|
8726
8869
|
const [existing] = await readInstanceStates(session, instance);
|
|
@@ -8730,7 +8873,7 @@ var deploy = addLockWaitOption(
|
|
|
8730
8873
|
const askedForRemoteDb = options.remoteDb ?? config.deploy?.buildAgainstRemote;
|
|
8731
8874
|
const remoteDb = askedForRemoteDb ?? instanceHasBackend(existing);
|
|
8732
8875
|
if (existing && instanceHasBackend(existing) !== backend3) {
|
|
8733
|
-
|
|
8876
|
+
p43.log.info(
|
|
8734
8877
|
backend3 ? `${pc18.cyan(ctx.targetName)} was deployed without a backend before. This deploy adds PocketBase.` : `${pc18.cyan(ctx.targetName)} was deployed with a backend before. This deploy removes PocketBase; its database stays on the server.`
|
|
8735
8878
|
);
|
|
8736
8879
|
}
|
|
@@ -8773,7 +8916,7 @@ with DNS of your own pointing at ${ctx.server}.`
|
|
|
8773
8916
|
tunnel = await openDatabaseTunnel(session, instance, existing);
|
|
8774
8917
|
} catch (err) {
|
|
8775
8918
|
if (askedForRemoteDb) throw err;
|
|
8776
|
-
|
|
8919
|
+
p43.log.warn(
|
|
8777
8920
|
`Could not build against the ${pc18.cyan(ctx.targetName)} database, using a local one instead.
|
|
8778
8921
|
${pc18.dim(String(err))}`
|
|
8779
8922
|
);
|
|
@@ -8781,13 +8924,13 @@ ${pc18.dim(String(err))}`
|
|
|
8781
8924
|
}
|
|
8782
8925
|
if (tunnel) {
|
|
8783
8926
|
buildEnv = { ...buildEnv, ...tunnel.env };
|
|
8784
|
-
|
|
8927
|
+
p43.log.info(
|
|
8785
8928
|
`Building against the ${pc18.cyan(ctx.targetName)} database on ${ctx.server} ${pc18.dim(`(port ${tunnel.pbPort})`)}`
|
|
8786
8929
|
);
|
|
8787
8930
|
} else if (backend3) {
|
|
8788
8931
|
await ensureSuperuser(workspaceRootDir);
|
|
8789
8932
|
}
|
|
8790
|
-
|
|
8933
|
+
p43.log.step("Building");
|
|
8791
8934
|
try {
|
|
8792
8935
|
await runBuild(workspaceRootDir, config.deploy?.buildCommand, buildEnv);
|
|
8793
8936
|
} finally {
|
|
@@ -8795,9 +8938,9 @@ ${pc18.dim(String(err))}`
|
|
|
8795
8938
|
}
|
|
8796
8939
|
}
|
|
8797
8940
|
const entries = collectArtifact(workspaceRootDir, config.deploy ?? {});
|
|
8798
|
-
|
|
8941
|
+
p43.log.step(`Uploading release ${pc18.dim(release)}`);
|
|
8799
8942
|
await uploadRelease(session, instance, release, entries);
|
|
8800
|
-
|
|
8943
|
+
p43.log.step("Activating");
|
|
8801
8944
|
result = await runServerScript(session, "apply.sh", {
|
|
8802
8945
|
args: [
|
|
8803
8946
|
instance,
|
|
@@ -8848,7 +8991,7 @@ ${pc18.dim(String(err))}`
|
|
|
8848
8991
|
url: primaryHost ? url : void 0
|
|
8849
8992
|
});
|
|
8850
8993
|
const redirects = started?.environment.redirects ?? [];
|
|
8851
|
-
|
|
8994
|
+
p43.log.success(
|
|
8852
8995
|
`Deployed ${pc18.cyan(ctx.appName)} ${pc18.dim(release)}
|
|
8853
8996
|
|
|
8854
8997
|
URL ${url}
|
|
@@ -8856,7 +8999,7 @@ ${pc18.dim(String(err))}`
|
|
|
8856
8999
|
` : "") + ` Port ${result?.webPort ?? "?"}${backend3 ? ` (PocketBase ${result?.pbPort ?? "?"})` : ""}`
|
|
8857
9000
|
);
|
|
8858
9001
|
if (managed && managed !== existing?.managed) {
|
|
8859
|
-
|
|
9002
|
+
p43.log.info(`${pc18.cyan(managed)} goes live within a minute.`);
|
|
8860
9003
|
}
|
|
8861
9004
|
if (result?.superuserCreated) {
|
|
8862
9005
|
await copyLocalBranding(
|
|
@@ -8865,7 +9008,7 @@ ${pc18.dim(String(err))}`
|
|
|
8865
9008
|
workspaceRootDir,
|
|
8866
9009
|
primaryHost ? result?.url ?? "" : ""
|
|
8867
9010
|
);
|
|
8868
|
-
|
|
9011
|
+
p43.log.info(
|
|
8869
9012
|
`Created the PocketBase superuser this app authenticates as.
|
|
8870
9013
|
|
|
8871
9014
|
Its credentials are stored in the environment on the server. To use
|
|
@@ -8876,7 +9019,7 @@ and deploy again.`
|
|
|
8876
9019
|
await reportAppURLDrift(session, instance, primaryHost);
|
|
8877
9020
|
}
|
|
8878
9021
|
if (!primaryHost) {
|
|
8879
|
-
|
|
9022
|
+
p43.log.warn(
|
|
8880
9023
|
`No domain configured, so nothing is proxied to this app yet.
|
|
8881
9024
|
Redeploy with ${pc18.cyan("--domain example.com")} once DNS points at ${ctx.server}` + (reporter.enabled ? "" : `,
|
|
8882
9025
|
or ${pc18.cyan("vela link")} it to get a free velastack.app hostname.`) + `.`
|
|
@@ -8886,7 +9029,7 @@ or ${pc18.cyan("vela link")} it to get a free velastack.app hostname.`) + `.`
|
|
|
8886
9029
|
},
|
|
8887
9030
|
{ project: options.project, askDomain: true, label: "deploy" }
|
|
8888
9031
|
);
|
|
8889
|
-
|
|
9032
|
+
p43.outro(`${pc18.cyan("vela status")} to see what is running`);
|
|
8890
9033
|
}, "Failed to deploy.")
|
|
8891
9034
|
);
|
|
8892
9035
|
async function prepareAdapter(workspaceRootDir) {
|
|
@@ -8905,8 +9048,8 @@ ${pc18.cyan(err.snippet)}` : err.message);
|
|
|
8905
9048
|
outcome.packageJsonChanged ? "package.json" : void 0
|
|
8906
9049
|
].filter((f) => Boolean(f));
|
|
8907
9050
|
const why = outcome.previous === "auto" ? `${ADAPTER_AUTO} builds nothing for a server of your own` : outcome.previous === "none" ? "No adapter was configured" : `${ADAPTER_NODE} was configured but not in package.json`;
|
|
8908
|
-
|
|
8909
|
-
|
|
9051
|
+
p43.log.step(`Switching the adapter to ${pc18.cyan(ADAPTER_NODE)}`);
|
|
9052
|
+
p43.log.info(
|
|
8910
9053
|
`${why}, and vela deploy runs the app as a Node server.
|
|
8911
9054
|
|
|
8912
9055
|
Changed ${changed.join(", ")}` + (outcome.removedDeps.length ? `
|
|
@@ -8919,14 +9062,14 @@ ${pc18.cyan(err.snippet)}` : err.message);
|
|
|
8919
9062
|
rethrow(err);
|
|
8920
9063
|
}
|
|
8921
9064
|
}
|
|
8922
|
-
|
|
9065
|
+
p43.log.warn(`Commit ${changed.join(", ")} so every deploy builds the same way.`);
|
|
8923
9066
|
}
|
|
8924
9067
|
async function reportAppURLDrift(session, instance, domain) {
|
|
8925
9068
|
const expected = normalizeOrigin(domain);
|
|
8926
9069
|
if (!expected) return;
|
|
8927
9070
|
const current = await readRemoteAppURL(session, instance);
|
|
8928
9071
|
if (!current || normalizeOrigin(current) === expected) return;
|
|
8929
|
-
|
|
9072
|
+
p43.log.warn(
|
|
8930
9073
|
`This app's PocketBase ${pc18.cyan("appURL")} is ${pc18.dim(current)}, but it is served on ${pc18.dim(expected)}.
|
|
8931
9074
|
|
|
8932
9075
|
Emails and anything else PocketBase links to will use the former. Update it in
|
|
@@ -8941,15 +9084,15 @@ async function copyLocalBranding(session, instance, workspaceRootDir, appURL) {
|
|
|
8941
9084
|
if (copied.length === 0) return;
|
|
8942
9085
|
const outcome = await restartInstance(session, instance);
|
|
8943
9086
|
if (outcome.deployed && !outcome.restarted) {
|
|
8944
|
-
|
|
9087
|
+
p43.log.warn(
|
|
8945
9088
|
`Copied ${copied.join(", ")}, but the app did not restart to pick them up.
|
|
8946
9089
|
${pc18.dim(outcome.error ?? "")}`
|
|
8947
9090
|
);
|
|
8948
9091
|
return;
|
|
8949
9092
|
}
|
|
8950
|
-
|
|
9093
|
+
p43.log.success(`Copied ${copied.join(", ")} from this project's database`);
|
|
8951
9094
|
} catch (err) {
|
|
8952
|
-
|
|
9095
|
+
p43.log.warn(
|
|
8953
9096
|
`Could not copy this project's PocketBase settings across.
|
|
8954
9097
|
Set them in the admin panel instead. ${pc18.dim(String(err))}`
|
|
8955
9098
|
);
|
|
@@ -9042,7 +9185,7 @@ async function reportEmptyEnvironment(session, instance, workspaceRootDir) {
|
|
|
9042
9185
|
const remote = await readRemoteEnv(session, instance);
|
|
9043
9186
|
if (Object.keys(remote).length > 0) return;
|
|
9044
9187
|
if (!fs37.existsSync(path38.join(workspaceRootDir, ".env"))) return;
|
|
9045
|
-
|
|
9188
|
+
p43.log.warn(
|
|
9046
9189
|
`This app has no production environment variables yet.
|
|
9047
9190
|
|
|
9048
9191
|
Local ${pc18.cyan(".env")} values are not uploaded by a deploy. Set them with
|
|
@@ -9053,23 +9196,23 @@ async function serverTimeOrLocal(session) {
|
|
|
9053
9196
|
try {
|
|
9054
9197
|
return await serverTime(session);
|
|
9055
9198
|
} catch {
|
|
9056
|
-
|
|
9199
|
+
p43.log.warn("Could not read the clock on the server; stamping this release from this machine.");
|
|
9057
9200
|
return /* @__PURE__ */ new Date();
|
|
9058
9201
|
}
|
|
9059
9202
|
}
|
|
9060
9203
|
|
|
9061
9204
|
// src/commands/link.ts
|
|
9062
9205
|
import path39 from "node:path";
|
|
9063
|
-
import
|
|
9064
|
-
import { Command as
|
|
9065
|
-
import * as
|
|
9206
|
+
import process30 from "node:process";
|
|
9207
|
+
import { Command as Command78 } from "commander";
|
|
9208
|
+
import * as p44 from "@clack/prompts";
|
|
9066
9209
|
var CREATE_NEW = "__new__";
|
|
9067
|
-
var link = new
|
|
9210
|
+
var link = new Command78("link").description("link this project to a velastack.dev project").configureHelp(helpConfig).action(() => runCommand(linkProject, "Failed to link the project."));
|
|
9068
9211
|
async function linkProject() {
|
|
9069
9212
|
const { workspaceRootDir } = await getWorkspace();
|
|
9070
9213
|
const existing = readProjectConfig(workspaceRootDir);
|
|
9071
9214
|
if (existing) {
|
|
9072
|
-
|
|
9215
|
+
p44.log.success(`Linked to ${existing.projectName}.`);
|
|
9073
9216
|
return;
|
|
9074
9217
|
}
|
|
9075
9218
|
const apiKey = requireApiKey();
|
|
@@ -9096,10 +9239,10 @@ async function linkProject() {
|
|
|
9096
9239
|
projectName = created.name;
|
|
9097
9240
|
}
|
|
9098
9241
|
writeProjectConfig(workspaceRootDir, { projectId, teamId, projectName });
|
|
9099
|
-
|
|
9242
|
+
p44.log.success(`Linked to ${projectName}.`);
|
|
9100
9243
|
}
|
|
9101
9244
|
async function pickExistingProject(projects) {
|
|
9102
|
-
const choice = await
|
|
9245
|
+
const choice = await p44.select({
|
|
9103
9246
|
message: "Select a project",
|
|
9104
9247
|
options: [
|
|
9105
9248
|
...projects.map((pr) => ({
|
|
@@ -9109,39 +9252,39 @@ async function pickExistingProject(projects) {
|
|
|
9109
9252
|
{ value: CREATE_NEW, label: "Create a new project" }
|
|
9110
9253
|
]
|
|
9111
9254
|
});
|
|
9112
|
-
if (
|
|
9113
|
-
|
|
9114
|
-
|
|
9255
|
+
if (p44.isCancel(choice)) {
|
|
9256
|
+
p44.cancel("Operation cancelled.");
|
|
9257
|
+
process30.exit(0);
|
|
9115
9258
|
}
|
|
9116
9259
|
return choice;
|
|
9117
9260
|
}
|
|
9118
9261
|
async function pickTeam(teams3) {
|
|
9119
9262
|
if (teams3.length === 1) return teams3[0];
|
|
9120
|
-
const choice = await
|
|
9263
|
+
const choice = await p44.select({
|
|
9121
9264
|
message: "Select a team",
|
|
9122
9265
|
options: teams3.map((team) => ({
|
|
9123
9266
|
value: team.id,
|
|
9124
9267
|
label: team.is_personal ? `${team.name} (personal)` : team.name
|
|
9125
9268
|
}))
|
|
9126
9269
|
});
|
|
9127
|
-
if (
|
|
9128
|
-
|
|
9129
|
-
|
|
9270
|
+
if (p44.isCancel(choice)) {
|
|
9271
|
+
p44.cancel("Operation cancelled.");
|
|
9272
|
+
process30.exit(0);
|
|
9130
9273
|
}
|
|
9131
9274
|
return teams3.find((team) => team.id === choice);
|
|
9132
9275
|
}
|
|
9133
9276
|
async function promptProjectName(workspaceRootDir) {
|
|
9134
9277
|
const defaultValue = defaultProjectName2(workspaceRootDir);
|
|
9135
|
-
const value = await
|
|
9278
|
+
const value = await p44.text({
|
|
9136
9279
|
message: "Project name",
|
|
9137
9280
|
defaultValue,
|
|
9138
9281
|
initialValue: defaultValue,
|
|
9139
9282
|
placeholder: defaultValue,
|
|
9140
9283
|
validate: (v10) => !v10?.trim() ? "Required" : void 0
|
|
9141
9284
|
});
|
|
9142
|
-
if (
|
|
9143
|
-
|
|
9144
|
-
|
|
9285
|
+
if (p44.isCancel(value)) {
|
|
9286
|
+
p44.cancel("Operation cancelled.");
|
|
9287
|
+
process30.exit(0);
|
|
9145
9288
|
}
|
|
9146
9289
|
return value.trim();
|
|
9147
9290
|
}
|
|
@@ -9156,14 +9299,14 @@ function defaultProjectName2(workspaceRootDir) {
|
|
|
9156
9299
|
}
|
|
9157
9300
|
|
|
9158
9301
|
// src/commands/env.ts
|
|
9159
|
-
import { Command as
|
|
9302
|
+
import { Command as Command83 } from "commander";
|
|
9160
9303
|
|
|
9161
9304
|
// src/commands/env/list.ts
|
|
9162
|
-
import { Command as
|
|
9163
|
-
import * as
|
|
9305
|
+
import { Command as Command79 } from "commander";
|
|
9306
|
+
import * as p45 from "@clack/prompts";
|
|
9164
9307
|
import pc19 from "picocolors";
|
|
9165
9308
|
var envList = addTargetOptions(
|
|
9166
|
-
new
|
|
9309
|
+
new Command79("list").description("list environment variable names").configureHelp(helpConfig),
|
|
9167
9310
|
"local"
|
|
9168
9311
|
).action(
|
|
9169
9312
|
(raw) => runCommand(
|
|
@@ -9185,10 +9328,10 @@ var envList = addTargetOptions(
|
|
|
9185
9328
|
);
|
|
9186
9329
|
function report(keys, where) {
|
|
9187
9330
|
if (keys.length === 0) {
|
|
9188
|
-
|
|
9331
|
+
p45.log.info(`No environment variables configured ${pc19.dim(`(${where})`)}.`);
|
|
9189
9332
|
return;
|
|
9190
9333
|
}
|
|
9191
|
-
|
|
9334
|
+
p45.log.info(
|
|
9192
9335
|
`Environment ${pc19.dim(`(${where})`)}
|
|
9193
9336
|
|
|
9194
9337
|
` + keys.sort().map((key) => ` ${key}`).join("\n")
|
|
@@ -9196,12 +9339,12 @@ function report(keys, where) {
|
|
|
9196
9339
|
}
|
|
9197
9340
|
|
|
9198
9341
|
// src/commands/env/set.ts
|
|
9199
|
-
import
|
|
9200
|
-
import { Command as
|
|
9201
|
-
import * as
|
|
9342
|
+
import process31 from "node:process";
|
|
9343
|
+
import { Command as Command80 } from "commander";
|
|
9344
|
+
import * as p46 from "@clack/prompts";
|
|
9202
9345
|
import pc20 from "picocolors";
|
|
9203
9346
|
var envSet = addTargetOptions(
|
|
9204
|
-
new
|
|
9347
|
+
new Command80("set").description("set an environment variable").argument("<key>", "variable name").argument("[value]", "value \u2014 prompted for, without echo, when omitted").configureHelp(helpConfig),
|
|
9205
9348
|
"local"
|
|
9206
9349
|
).action(
|
|
9207
9350
|
(key, value, raw) => runCommand(
|
|
@@ -9211,14 +9354,14 @@ var envSet = addTargetOptions(
|
|
|
9211
9354
|
local: async (ctx) => {
|
|
9212
9355
|
const resolved = await resolveValue(key, value);
|
|
9213
9356
|
setLocalEnv(ctx.envFile, key, resolved);
|
|
9214
|
-
|
|
9357
|
+
p46.log.success(`${key} updated ${pc20.dim("(local)")}`);
|
|
9215
9358
|
await applyLocalEnvChange(ctx, [key]);
|
|
9216
9359
|
},
|
|
9217
9360
|
remote: async (ctx) => {
|
|
9218
9361
|
const resolved = await resolveValue(key, value);
|
|
9219
9362
|
const env2 = await readRemoteEnv(ctx.session, ctx.instance);
|
|
9220
9363
|
await writeRemoteEnv(ctx.session, ctx.instance, { ...env2, [key]: resolved });
|
|
9221
|
-
|
|
9364
|
+
p46.log.success(`${key} updated ${pc20.dim(`(${ctx.targetName})`)}`);
|
|
9222
9365
|
await applyEnvRestart(ctx, [key]);
|
|
9223
9366
|
}
|
|
9224
9367
|
},
|
|
@@ -9232,23 +9375,23 @@ async function resolveValue(key, value) {
|
|
|
9232
9375
|
return value ?? await promptValue(key);
|
|
9233
9376
|
}
|
|
9234
9377
|
async function promptValue(key) {
|
|
9235
|
-
const value = await
|
|
9378
|
+
const value = await p46.password({
|
|
9236
9379
|
message: `Value for ${pc20.cyan(key)}`,
|
|
9237
9380
|
validate: (input) => !input?.length ? "Required" : void 0
|
|
9238
9381
|
});
|
|
9239
|
-
if (
|
|
9240
|
-
|
|
9241
|
-
|
|
9382
|
+
if (p46.isCancel(value)) {
|
|
9383
|
+
p46.cancel("Operation cancelled.");
|
|
9384
|
+
process31.exit(0);
|
|
9242
9385
|
}
|
|
9243
9386
|
return value;
|
|
9244
9387
|
}
|
|
9245
9388
|
|
|
9246
9389
|
// src/commands/env/unset.ts
|
|
9247
|
-
import { Command as
|
|
9248
|
-
import * as
|
|
9390
|
+
import { Command as Command81 } from "commander";
|
|
9391
|
+
import * as p47 from "@clack/prompts";
|
|
9249
9392
|
import pc21 from "picocolors";
|
|
9250
9393
|
var envUnset = addTargetOptions(
|
|
9251
|
-
new
|
|
9394
|
+
new Command81("unset").description("remove an environment variable").argument("<key>", "variable name").configureHelp(helpConfig),
|
|
9252
9395
|
"local"
|
|
9253
9396
|
).action(
|
|
9254
9397
|
(key, raw) => runCommand(
|
|
@@ -9257,22 +9400,22 @@ var envUnset = addTargetOptions(
|
|
|
9257
9400
|
{
|
|
9258
9401
|
local: async (ctx) => {
|
|
9259
9402
|
if (!(key in readLocalEnv(ctx.envFile))) {
|
|
9260
|
-
|
|
9403
|
+
p47.log.info(`${key} is not set \u2014 nothing to remove.`);
|
|
9261
9404
|
return;
|
|
9262
9405
|
}
|
|
9263
9406
|
unsetLocalEnv(ctx.envFile, key);
|
|
9264
|
-
|
|
9407
|
+
p47.log.success(`${key} removed ${pc21.dim("(local)")}`);
|
|
9265
9408
|
await applyLocalEnvChange(ctx, [key]);
|
|
9266
9409
|
},
|
|
9267
9410
|
remote: async (ctx) => {
|
|
9268
9411
|
const env2 = await readRemoteEnv(ctx.session, ctx.instance);
|
|
9269
9412
|
if (!(key in env2)) {
|
|
9270
|
-
|
|
9413
|
+
p47.log.info(`${key} is not set \u2014 nothing to remove.`);
|
|
9271
9414
|
return;
|
|
9272
9415
|
}
|
|
9273
9416
|
delete env2[key];
|
|
9274
9417
|
await writeRemoteEnv(ctx.session, ctx.instance, env2);
|
|
9275
|
-
|
|
9418
|
+
p47.log.success(`${key} removed ${pc21.dim(`(${ctx.targetName})`)}`);
|
|
9276
9419
|
await applyEnvRestart(ctx, [key]);
|
|
9277
9420
|
}
|
|
9278
9421
|
},
|
|
@@ -9285,12 +9428,12 @@ var envUnset = addTargetOptions(
|
|
|
9285
9428
|
// src/commands/env/import.ts
|
|
9286
9429
|
import fs38 from "node:fs";
|
|
9287
9430
|
import path40 from "node:path";
|
|
9288
|
-
import
|
|
9289
|
-
import { Command as
|
|
9290
|
-
import * as
|
|
9431
|
+
import process32 from "node:process";
|
|
9432
|
+
import { Command as Command82 } from "commander";
|
|
9433
|
+
import * as p48 from "@clack/prompts";
|
|
9291
9434
|
import pc22 from "picocolors";
|
|
9292
9435
|
var envImport = addTargetOptions(
|
|
9293
|
-
new
|
|
9436
|
+
new Command82("import").description("merge a dotenv file into the environment").argument("<file>", "dotenv file to read").configureHelp(helpConfig),
|
|
9294
9437
|
"local"
|
|
9295
9438
|
).action(
|
|
9296
9439
|
(file, raw) => runCommand(
|
|
@@ -9305,22 +9448,22 @@ var envImport = addTargetOptions(
|
|
|
9305
9448
|
const incoming = read(source, file);
|
|
9306
9449
|
const keys = Object.keys(incoming);
|
|
9307
9450
|
if (keys.length === 0) return;
|
|
9308
|
-
|
|
9451
|
+
p48.log.step(`Importing ${keys.length} variable(s) from ${pc22.cyan(file)}`);
|
|
9309
9452
|
editLocalEnv(
|
|
9310
9453
|
ctx.envFile,
|
|
9311
9454
|
(content) => keys.reduce((acc, key) => upsertEnvVar(acc, key, incoming[key]), content)
|
|
9312
9455
|
);
|
|
9313
|
-
|
|
9456
|
+
p48.log.success(`${keys.length} variable(s) updated ${pc22.dim("(local)")}`);
|
|
9314
9457
|
await applyLocalEnvChange(ctx, keys);
|
|
9315
9458
|
},
|
|
9316
9459
|
remote: async (ctx) => {
|
|
9317
9460
|
const incoming = read(resolve(file), file);
|
|
9318
9461
|
const keys = Object.keys(incoming);
|
|
9319
9462
|
if (keys.length === 0) return;
|
|
9320
|
-
|
|
9463
|
+
p48.log.step(`Importing ${keys.length} variable(s) from ${pc22.cyan(file)}`);
|
|
9321
9464
|
const existing = await readRemoteEnv(ctx.session, ctx.instance);
|
|
9322
9465
|
await writeRemoteEnv(ctx.session, ctx.instance, { ...existing, ...incoming });
|
|
9323
|
-
|
|
9466
|
+
p48.log.success(`${keys.length} variable(s) updated ${pc22.dim(`(${ctx.targetName})`)}`);
|
|
9324
9467
|
await applyEnvRestart(ctx, keys);
|
|
9325
9468
|
}
|
|
9326
9469
|
},
|
|
@@ -9330,24 +9473,24 @@ var envImport = addTargetOptions(
|
|
|
9330
9473
|
)
|
|
9331
9474
|
);
|
|
9332
9475
|
function resolve(file) {
|
|
9333
|
-
return path40.resolve(
|
|
9476
|
+
return path40.resolve(process32.cwd(), file);
|
|
9334
9477
|
}
|
|
9335
9478
|
function read(resolved, shown) {
|
|
9336
9479
|
if (!fs38.existsSync(resolved)) throw new Error(`${shown} does not exist.`);
|
|
9337
9480
|
const incoming = readLocalEnvFile(resolved);
|
|
9338
|
-
if (Object.keys(incoming).length === 0)
|
|
9481
|
+
if (Object.keys(incoming).length === 0) p48.log.info(`${shown} has no variables to import.`);
|
|
9339
9482
|
return incoming;
|
|
9340
9483
|
}
|
|
9341
9484
|
|
|
9342
9485
|
// src/commands/env.ts
|
|
9343
|
-
var env = new
|
|
9486
|
+
var env = new Command83("env").description("manage environment variables, locally or on a target").configureHelp(helpConfig).addCommand(envList).addCommand(envSet).addCommand(envUnset).addCommand(envImport);
|
|
9344
9487
|
|
|
9345
9488
|
// src/commands/status.ts
|
|
9346
|
-
import { Command as
|
|
9347
|
-
import * as
|
|
9489
|
+
import { Command as Command84 } from "commander";
|
|
9490
|
+
import * as p49 from "@clack/prompts";
|
|
9348
9491
|
import pc23 from "picocolors";
|
|
9349
9492
|
var status = addTargetOptions(
|
|
9350
|
-
new
|
|
9493
|
+
new Command84("status").description("show what is deployed").configureHelp(helpConfig),
|
|
9351
9494
|
"production"
|
|
9352
9495
|
).option("--all", "show every app on the server, not just this project").option("--json", "print raw JSON").action(
|
|
9353
9496
|
(raw) => runCommand(async () => {
|
|
@@ -9378,11 +9521,11 @@ function report2(states, json) {
|
|
|
9378
9521
|
return;
|
|
9379
9522
|
}
|
|
9380
9523
|
if (states.length === 0) {
|
|
9381
|
-
|
|
9524
|
+
p49.log.info("Nothing is deployed here yet.");
|
|
9382
9525
|
return;
|
|
9383
9526
|
}
|
|
9384
9527
|
for (const state of states) {
|
|
9385
|
-
|
|
9528
|
+
p49.log.info(describe2(state));
|
|
9386
9529
|
}
|
|
9387
9530
|
}
|
|
9388
9531
|
function describe2(state) {
|
|
@@ -9406,12 +9549,12 @@ function describe2(state) {
|
|
|
9406
9549
|
}
|
|
9407
9550
|
|
|
9408
9551
|
// src/commands/rollback.ts
|
|
9409
|
-
import { Command as
|
|
9410
|
-
import * as
|
|
9552
|
+
import { Command as Command85 } from "commander";
|
|
9553
|
+
import * as p50 from "@clack/prompts";
|
|
9411
9554
|
import pc24 from "picocolors";
|
|
9412
9555
|
var rollback = addLockWaitOption(
|
|
9413
9556
|
addTargetOptions(
|
|
9414
|
-
new
|
|
9557
|
+
new Command85("rollback").description("put the previous release back").configureHelp(helpConfig),
|
|
9415
9558
|
"production"
|
|
9416
9559
|
)
|
|
9417
9560
|
).option("--to <release>", "roll back to a specific release instead of the previous one").action(
|
|
@@ -9421,7 +9564,7 @@ var rollback = addLockWaitOption(
|
|
|
9421
9564
|
raw,
|
|
9422
9565
|
{
|
|
9423
9566
|
remote: async (ctx) => {
|
|
9424
|
-
|
|
9567
|
+
p50.log.step(
|
|
9425
9568
|
`Rolling back ${pc24.cyan(ctx.appName)} ${pc24.dim(`(${ctx.targetName})`)} on ${ctx.server}`
|
|
9426
9569
|
);
|
|
9427
9570
|
const result = await runServerScript(
|
|
@@ -9436,7 +9579,7 @@ var rollback = addLockWaitOption(
|
|
|
9436
9579
|
stream: true
|
|
9437
9580
|
}
|
|
9438
9581
|
);
|
|
9439
|
-
|
|
9582
|
+
p50.log.success(
|
|
9440
9583
|
`Rolled back to ${pc24.cyan(result?.release ?? "the previous release")}` + (result?.from ? ` ${pc24.dim(`(was ${result.from})`)}` : "")
|
|
9441
9584
|
);
|
|
9442
9585
|
}
|
|
@@ -9450,9 +9593,9 @@ var rollback = addLockWaitOption(
|
|
|
9450
9593
|
);
|
|
9451
9594
|
|
|
9452
9595
|
// src/commands/logs.ts
|
|
9453
|
-
import { Command as
|
|
9596
|
+
import { Command as Command86 } from "commander";
|
|
9454
9597
|
var logs = addTargetOptions(
|
|
9455
|
-
new
|
|
9598
|
+
new Command86("logs").description("tail the logs of a deployed app").configureHelp(helpConfig),
|
|
9456
9599
|
"production"
|
|
9457
9600
|
).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(
|
|
9458
9601
|
(raw) => runCommand(async () => {
|
|
@@ -9486,16 +9629,16 @@ var logs = addTargetOptions(
|
|
|
9486
9629
|
);
|
|
9487
9630
|
|
|
9488
9631
|
// src/commands/admin.ts
|
|
9489
|
-
import { Command as
|
|
9632
|
+
import { Command as Command88 } from "commander";
|
|
9490
9633
|
|
|
9491
9634
|
// src/commands/admin/create.ts
|
|
9492
|
-
import
|
|
9493
|
-
import { Command as
|
|
9494
|
-
import * as
|
|
9635
|
+
import process33 from "node:process";
|
|
9636
|
+
import { Command as Command87 } from "commander";
|
|
9637
|
+
import * as p51 from "@clack/prompts";
|
|
9495
9638
|
import pc25 from "picocolors";
|
|
9496
9639
|
var MIN_PASSWORD = 10;
|
|
9497
9640
|
var adminCreate = addTargetOptions(
|
|
9498
|
-
new
|
|
9641
|
+
new Command87("create").description("create a login for the admin panel").argument("[email]", "email to sign in with \u2014 prompted for when omitted").configureHelp(helpConfig),
|
|
9499
9642
|
"local"
|
|
9500
9643
|
).action(
|
|
9501
9644
|
(email3, raw) => runCommand(
|
|
@@ -9523,7 +9666,7 @@ var adminCreate = addTargetOptions(
|
|
|
9523
9666
|
const metadata = getPocketbaseMetadata(ctx.workspaceRootDir);
|
|
9524
9667
|
if (metadata) signIn = `http://${metadata.viteHost}:${metadata.vitePort}`;
|
|
9525
9668
|
}
|
|
9526
|
-
|
|
9669
|
+
p51.log.info(
|
|
9527
9670
|
signIn ? `Sign in at ${pc25.cyan(`${signIn}/admin`)}` : `Sign in at ${pc25.cyan("/admin")} once ${pc25.cyan("vela dev")} is running.`
|
|
9528
9671
|
);
|
|
9529
9672
|
},
|
|
@@ -9537,7 +9680,7 @@ var adminCreate = addTargetOptions(
|
|
|
9537
9680
|
(pb) => upsertSuperuser(pb, address, password11)
|
|
9538
9681
|
);
|
|
9539
9682
|
const base2 = state?.domain ? `https://${state.domain.split(",")[0].trim()}` : "";
|
|
9540
|
-
|
|
9683
|
+
p51.log.info(
|
|
9541
9684
|
base2 ? `Sign in at ${pc25.cyan(`${base2}/admin`)}` : `Sign in at ${pc25.cyan("/admin")} once a domain is configured for this target.`
|
|
9542
9685
|
);
|
|
9543
9686
|
}
|
|
@@ -9550,20 +9693,20 @@ var adminCreate = addTargetOptions(
|
|
|
9550
9693
|
async function upsertSuperuser(pb, email3, password11) {
|
|
9551
9694
|
const existing = await findSuperuser(pb, email3);
|
|
9552
9695
|
if (existing) {
|
|
9553
|
-
const confirmed = await
|
|
9696
|
+
const confirmed = await p51.confirm({
|
|
9554
9697
|
message: `${email3} already has an account, update its password?`,
|
|
9555
9698
|
initialValue: false
|
|
9556
9699
|
});
|
|
9557
|
-
if (
|
|
9558
|
-
|
|
9559
|
-
|
|
9700
|
+
if (p51.isCancel(confirmed) || !confirmed) {
|
|
9701
|
+
p51.cancel("Operation cancelled.");
|
|
9702
|
+
process33.exit(0);
|
|
9560
9703
|
}
|
|
9561
9704
|
await pb.collection("_superusers").update(existing, { password: password11, passwordConfirm: password11 });
|
|
9562
|
-
|
|
9705
|
+
p51.log.success(`Password updated for ${pc25.cyan(email3)}, you can sign in now`);
|
|
9563
9706
|
return;
|
|
9564
9707
|
}
|
|
9565
9708
|
await pb.collection("_superusers").create({ email: email3, password: password11, passwordConfirm: password11 });
|
|
9566
|
-
|
|
9709
|
+
p51.log.success(`${pc25.cyan(email3)} can now sign in`);
|
|
9567
9710
|
}
|
|
9568
9711
|
async function findSuperuser(pb, email3) {
|
|
9569
9712
|
try {
|
|
@@ -9574,47 +9717,47 @@ async function findSuperuser(pb, email3) {
|
|
|
9574
9717
|
}
|
|
9575
9718
|
}
|
|
9576
9719
|
async function promptEmail() {
|
|
9577
|
-
const value = await
|
|
9720
|
+
const value = await p51.text({
|
|
9578
9721
|
message: "Email to sign in with",
|
|
9579
9722
|
validate: (input) => input?.includes("@") ? void 0 : "An email address is required"
|
|
9580
9723
|
});
|
|
9581
|
-
if (
|
|
9582
|
-
|
|
9583
|
-
|
|
9724
|
+
if (p51.isCancel(value)) {
|
|
9725
|
+
p51.cancel("Operation cancelled.");
|
|
9726
|
+
process33.exit(0);
|
|
9584
9727
|
}
|
|
9585
9728
|
return value.trim();
|
|
9586
9729
|
}
|
|
9587
9730
|
async function promptPassword2() {
|
|
9588
|
-
const value = await
|
|
9731
|
+
const value = await p51.password({
|
|
9589
9732
|
message: "Password",
|
|
9590
9733
|
validate: (input) => (input?.length ?? 0) >= MIN_PASSWORD ? void 0 : `At least ${MIN_PASSWORD} characters is required`
|
|
9591
9734
|
});
|
|
9592
|
-
if (
|
|
9593
|
-
|
|
9594
|
-
|
|
9735
|
+
if (p51.isCancel(value)) {
|
|
9736
|
+
p51.cancel("Operation cancelled.");
|
|
9737
|
+
process33.exit(0);
|
|
9595
9738
|
}
|
|
9596
|
-
const again = await
|
|
9739
|
+
const again = await p51.password({
|
|
9597
9740
|
message: "Password again",
|
|
9598
9741
|
validate: (input) => input === value ? void 0 : "The two do not match"
|
|
9599
9742
|
});
|
|
9600
|
-
if (
|
|
9601
|
-
|
|
9602
|
-
|
|
9743
|
+
if (p51.isCancel(again)) {
|
|
9744
|
+
p51.cancel("Operation cancelled.");
|
|
9745
|
+
process33.exit(0);
|
|
9603
9746
|
}
|
|
9604
9747
|
return value;
|
|
9605
9748
|
}
|
|
9606
9749
|
|
|
9607
9750
|
// src/commands/admin.ts
|
|
9608
|
-
var admin = new
|
|
9751
|
+
var admin = new Command88("admin").description("manage admin panel logins").configureHelp(helpConfig).addCommand(adminCreate);
|
|
9609
9752
|
|
|
9610
9753
|
// src/commands/backup.ts
|
|
9611
|
-
import { Command as
|
|
9754
|
+
import { Command as Command94 } from "commander";
|
|
9612
9755
|
|
|
9613
9756
|
// src/commands/backup/create.ts
|
|
9614
9757
|
import fs39 from "node:fs";
|
|
9615
9758
|
import path41 from "node:path";
|
|
9616
|
-
import { Command as
|
|
9617
|
-
import * as
|
|
9759
|
+
import { Command as Command89 } from "commander";
|
|
9760
|
+
import * as p52 from "@clack/prompts";
|
|
9618
9761
|
import pc26 from "picocolors";
|
|
9619
9762
|
|
|
9620
9763
|
// src/lib/backups.ts
|
|
@@ -9702,7 +9845,7 @@ async function writeSchedule(pb, cron, maxKeep) {
|
|
|
9702
9845
|
// src/commands/backup/create.ts
|
|
9703
9846
|
var DEFAULT_BACKUP_DIR = "backups";
|
|
9704
9847
|
var backupCreate = addTargetOptions(
|
|
9705
|
-
new
|
|
9848
|
+
new Command89("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),
|
|
9706
9849
|
"production"
|
|
9707
9850
|
).action(
|
|
9708
9851
|
(name, raw) => runCommand(() => {
|
|
@@ -9718,7 +9861,7 @@ Backup names are lowercase letters, digits, ${pc26.cyan("-")} and ${pc26.cyan("_
|
|
|
9718
9861
|
}
|
|
9719
9862
|
const storage = await readStorageSettings(ctx.pb);
|
|
9720
9863
|
if (storage.s3Enabled) {
|
|
9721
|
-
|
|
9864
|
+
p52.log.warn(
|
|
9722
9865
|
`Uploads are stored in S3, so this archive holds the database only.
|
|
9723
9866
|
|
|
9724
9867
|
PocketBase leaves ${pc26.cyan("storage/")} out of a backup whenever S3 is on.
|
|
@@ -9726,7 +9869,7 @@ Your bucket's own versioning is what protects the uploaded files.`
|
|
|
9726
9869
|
);
|
|
9727
9870
|
}
|
|
9728
9871
|
if (ctx.session) await checkpointAppDatabases(ctx.session, ctx.instance);
|
|
9729
|
-
const spinner7 =
|
|
9872
|
+
const spinner7 = p52.spinner();
|
|
9730
9873
|
spinner7.start(`Backing up ${ctx.targetName}`);
|
|
9731
9874
|
try {
|
|
9732
9875
|
await createBackup(ctx.pb, key);
|
|
@@ -9773,7 +9916,7 @@ async function download(ctx, key, outputDir) {
|
|
|
9773
9916
|
fs39.copyFileSync(path41.join(ctx.workspaceRootDir, "data", "backups", key), destination);
|
|
9774
9917
|
return path41.relative(ctx.workspaceRootDir, destination);
|
|
9775
9918
|
}
|
|
9776
|
-
const spinner7 =
|
|
9919
|
+
const spinner7 = p52.spinner();
|
|
9777
9920
|
spinner7.start(`Downloading ${key}`);
|
|
9778
9921
|
try {
|
|
9779
9922
|
await ctx.session.download(remotePaths.backup(ctx.instance, key), destination);
|
|
@@ -9786,18 +9929,18 @@ async function download(ctx, key, outputDir) {
|
|
|
9786
9929
|
}
|
|
9787
9930
|
|
|
9788
9931
|
// src/commands/backup/list.ts
|
|
9789
|
-
import { Command as
|
|
9790
|
-
import * as
|
|
9932
|
+
import { Command as Command90 } from "commander";
|
|
9933
|
+
import * as p53 from "@clack/prompts";
|
|
9791
9934
|
import pc27 from "picocolors";
|
|
9792
9935
|
var backupList = addTargetOptions(
|
|
9793
|
-
new
|
|
9936
|
+
new Command90("list").description("list the backups on a target").configureHelp(helpConfig),
|
|
9794
9937
|
"production"
|
|
9795
9938
|
).action(
|
|
9796
9939
|
(raw) => runCommand(
|
|
9797
9940
|
() => withBackupTarget(raw, "backup list", async (ctx) => {
|
|
9798
9941
|
const backups = await listBackups(ctx.pb);
|
|
9799
9942
|
if (backups.length === 0) {
|
|
9800
|
-
|
|
9943
|
+
p53.log.info(
|
|
9801
9944
|
`${pc27.cyan(ctx.targetName)} has no backups yet.
|
|
9802
9945
|
|
|
9803
9946
|
Take one with ${pc27.cyan("vela backup create")}.`
|
|
@@ -9805,7 +9948,7 @@ Take one with ${pc27.cyan("vela backup create")}.`
|
|
|
9805
9948
|
return;
|
|
9806
9949
|
}
|
|
9807
9950
|
const width = Math.max(...backups.map((b) => b.key.length));
|
|
9808
|
-
|
|
9951
|
+
p53.log.message(
|
|
9809
9952
|
backups.map(
|
|
9810
9953
|
(b) => `${b.key.padEnd(width)} ${pc27.dim(formatBytes(b.size).padStart(8))} ${pc27.dim(b.modified)}`
|
|
9811
9954
|
).join("\n")
|
|
@@ -9818,11 +9961,11 @@ Take one with ${pc27.cyan("vela backup create")}.`
|
|
|
9818
9961
|
// src/commands/backup/download.ts
|
|
9819
9962
|
import fs40 from "node:fs";
|
|
9820
9963
|
import path42 from "node:path";
|
|
9821
|
-
import { Command as
|
|
9822
|
-
import * as
|
|
9964
|
+
import { Command as Command91 } from "commander";
|
|
9965
|
+
import * as p54 from "@clack/prompts";
|
|
9823
9966
|
import pc28 from "picocolors";
|
|
9824
9967
|
var backupDownload = addTargetOptions(
|
|
9825
|
-
new
|
|
9968
|
+
new Command91("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),
|
|
9826
9969
|
"production"
|
|
9827
9970
|
).action(
|
|
9828
9971
|
(key, raw) => runCommand(() => {
|
|
@@ -9850,7 +9993,7 @@ Fetch it from the bucket directly \u2014 vela does not hold its credentials.`
|
|
|
9850
9993
|
if (!ctx.session) {
|
|
9851
9994
|
fs40.copyFileSync(path42.join(ctx.workspaceRootDir, "data", "backups", key), destination);
|
|
9852
9995
|
} else {
|
|
9853
|
-
const spinner7 =
|
|
9996
|
+
const spinner7 = p54.spinner();
|
|
9854
9997
|
spinner7.start(`Downloading ${key} (${formatBytes(found.size)})`);
|
|
9855
9998
|
try {
|
|
9856
9999
|
await ctx.session.download(remotePaths.backup(ctx.instance, key), destination);
|
|
@@ -9869,12 +10012,12 @@ Fetch it from the bucket directly \u2014 vela does not hold its credentials.`
|
|
|
9869
10012
|
);
|
|
9870
10013
|
|
|
9871
10014
|
// src/commands/backup/delete.ts
|
|
9872
|
-
import
|
|
9873
|
-
import { Command as
|
|
9874
|
-
import * as
|
|
10015
|
+
import process34 from "node:process";
|
|
10016
|
+
import { Command as Command92 } from "commander";
|
|
10017
|
+
import * as p55 from "@clack/prompts";
|
|
9875
10018
|
import pc29 from "picocolors";
|
|
9876
10019
|
var backupDelete = addTargetOptions(
|
|
9877
|
-
new
|
|
10020
|
+
new Command92("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),
|
|
9878
10021
|
"production"
|
|
9879
10022
|
).action(
|
|
9880
10023
|
(key, raw) => runCommand(() => {
|
|
@@ -9889,13 +10032,13 @@ Run ${pc29.cyan("vela backup list")} to see what it does have.`
|
|
|
9889
10032
|
);
|
|
9890
10033
|
}
|
|
9891
10034
|
if (!options.yes) {
|
|
9892
|
-
const confirmed = await
|
|
10035
|
+
const confirmed = await p55.confirm({
|
|
9893
10036
|
message: `Delete ${key} (${formatBytes(found.size)}) from ${ctx.targetName}?`,
|
|
9894
10037
|
initialValue: false
|
|
9895
10038
|
});
|
|
9896
|
-
if (
|
|
9897
|
-
|
|
9898
|
-
|
|
10039
|
+
if (p55.isCancel(confirmed) || !confirmed) {
|
|
10040
|
+
p55.cancel("Operation cancelled.");
|
|
10041
|
+
process34.exit(0);
|
|
9899
10042
|
}
|
|
9900
10043
|
}
|
|
9901
10044
|
await ctx.pb.backups.delete(key);
|
|
@@ -9905,12 +10048,12 @@ Run ${pc29.cyan("vela backup list")} to see what it does have.`
|
|
|
9905
10048
|
);
|
|
9906
10049
|
|
|
9907
10050
|
// src/commands/backup/schedule.ts
|
|
9908
|
-
import { Command as
|
|
9909
|
-
import * as
|
|
10051
|
+
import { Command as Command93 } from "commander";
|
|
10052
|
+
import * as p56 from "@clack/prompts";
|
|
9910
10053
|
import pc30 from "picocolors";
|
|
9911
10054
|
var DEFAULT_KEEP = 7;
|
|
9912
10055
|
var backupSchedule = addTargetOptions(
|
|
9913
|
-
new
|
|
10056
|
+
new Command93("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),
|
|
9914
10057
|
"production"
|
|
9915
10058
|
).action(
|
|
9916
10059
|
(cron, raw) => runCommand(() => {
|
|
@@ -9923,7 +10066,7 @@ var backupSchedule = addTargetOptions(
|
|
|
9923
10066
|
}
|
|
9924
10067
|
if (!cron) {
|
|
9925
10068
|
const current = await readSchedule(ctx.pb);
|
|
9926
|
-
|
|
10069
|
+
p56.log.info(
|
|
9927
10070
|
current.cron ? `${ctx.targetName} backs up on ${pc30.cyan(current.cron)}, keeping ${current.maxKeep}.` : `${ctx.targetName} has no backup schedule.
|
|
9928
10071
|
|
|
9929
10072
|
Set one with ${pc30.cyan('vela backup schedule "0 3 * * *"')}.`
|
|
@@ -9954,18 +10097,18 @@ Set one with ${pc30.cyan('vela backup schedule "0 3 * * *"')}.`
|
|
|
9954
10097
|
);
|
|
9955
10098
|
|
|
9956
10099
|
// src/commands/backup.ts
|
|
9957
|
-
var backup = new
|
|
10100
|
+
var backup = new Command94("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);
|
|
9958
10101
|
|
|
9959
10102
|
// src/commands/restore.ts
|
|
9960
10103
|
import fs41 from "node:fs";
|
|
9961
10104
|
import path43 from "node:path";
|
|
9962
|
-
import
|
|
9963
|
-
import { Command as
|
|
9964
|
-
import * as
|
|
10105
|
+
import process35 from "node:process";
|
|
10106
|
+
import { Command as Command95 } from "commander";
|
|
10107
|
+
import * as p57 from "@clack/prompts";
|
|
9965
10108
|
import pc31 from "picocolors";
|
|
9966
10109
|
var restore = addLockWaitOption(
|
|
9967
10110
|
addTargetOptions(
|
|
9968
|
-
new
|
|
10111
|
+
new Command95("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),
|
|
9969
10112
|
"production"
|
|
9970
10113
|
)
|
|
9971
10114
|
).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(
|
|
@@ -10002,18 +10145,18 @@ var restore = addLockWaitOption(
|
|
|
10002
10145
|
],
|
|
10003
10146
|
stream: true
|
|
10004
10147
|
});
|
|
10005
|
-
|
|
10148
|
+
p57.log.success(
|
|
10006
10149
|
`Restored ${pc31.cyan(`${ctx.appName} (${ctx.targetName})`)} from ${pc31.cyan(
|
|
10007
10150
|
local ? path43.basename(local) : key
|
|
10008
10151
|
)}.`
|
|
10009
10152
|
);
|
|
10010
10153
|
if (result?.storageCarriedOver) {
|
|
10011
|
-
|
|
10154
|
+
p57.log.info(
|
|
10012
10155
|
"The archive held no uploads, so the files already on the server were kept."
|
|
10013
10156
|
);
|
|
10014
10157
|
}
|
|
10015
10158
|
if (result?.previousDataDir) {
|
|
10016
|
-
|
|
10159
|
+
p57.log.info(
|
|
10017
10160
|
`The database this replaced is at ${pc31.cyan(result.previousDataDir)}.
|
|
10018
10161
|
|
|
10019
10162
|
It is the only way back. Remove it once you are satisfied with the restore.`
|
|
@@ -10054,7 +10197,7 @@ Run ${pc31.cyan("vela backup list")} to see what it does have.`
|
|
|
10054
10197
|
Take one with ${pc31.cyan("vela backup create")}, or pass the path to an archive on this machine.`
|
|
10055
10198
|
);
|
|
10056
10199
|
}
|
|
10057
|
-
const chosen = await
|
|
10200
|
+
const chosen = await p57.select({
|
|
10058
10201
|
message: `Which backup should ${ctx.targetName} be restored from?`,
|
|
10059
10202
|
options: backups.map((b) => ({
|
|
10060
10203
|
value: b.key,
|
|
@@ -10062,16 +10205,16 @@ Take one with ${pc31.cyan("vela backup create")}, or pass the path to an archive
|
|
|
10062
10205
|
hint: `${formatBytes(b.size)}, ${b.modified}`
|
|
10063
10206
|
}))
|
|
10064
10207
|
});
|
|
10065
|
-
if (
|
|
10066
|
-
|
|
10067
|
-
|
|
10208
|
+
if (p57.isCancel(chosen)) {
|
|
10209
|
+
p57.cancel("Operation cancelled.");
|
|
10210
|
+
process35.exit(0);
|
|
10068
10211
|
}
|
|
10069
10212
|
return chosen;
|
|
10070
10213
|
}
|
|
10071
10214
|
async function stage(ctx, file) {
|
|
10072
10215
|
const dir = remotePaths.restoreStage(ctx.instance);
|
|
10073
10216
|
const remote = `${dir}/${path43.basename(file)}`;
|
|
10074
|
-
const spinner7 =
|
|
10217
|
+
const spinner7 = p57.spinner();
|
|
10075
10218
|
spinner7.start(`Uploading ${path43.basename(file)}`);
|
|
10076
10219
|
try {
|
|
10077
10220
|
await ctx.session.script(`mkdir -p "$1"`, { args: [dir] });
|
|
@@ -10086,29 +10229,29 @@ async function stage(ctx, file) {
|
|
|
10086
10229
|
async function confirm13(appName, targetName, envTag, from) {
|
|
10087
10230
|
const what = `${pc31.cyan(`${appName} (${targetName})`)} from ${pc31.cyan(path43.basename(from))}`;
|
|
10088
10231
|
if (isProd(envTag)) {
|
|
10089
|
-
const answer = await
|
|
10232
|
+
const answer = await p57.text({
|
|
10090
10233
|
message: `This replaces the database and uploads of ${what}. Type the app name to confirm`,
|
|
10091
10234
|
validate: (value) => value === appName ? void 0 : `Type ${appName} to confirm`
|
|
10092
10235
|
});
|
|
10093
|
-
if (
|
|
10094
|
-
|
|
10095
|
-
|
|
10236
|
+
if (p57.isCancel(answer)) {
|
|
10237
|
+
p57.cancel("Operation cancelled.");
|
|
10238
|
+
process35.exit(0);
|
|
10096
10239
|
}
|
|
10097
10240
|
return;
|
|
10098
10241
|
}
|
|
10099
|
-
const ok = await
|
|
10242
|
+
const ok = await p57.confirm({
|
|
10100
10243
|
message: `Replace the database and uploads of ${what}?`,
|
|
10101
10244
|
initialValue: false
|
|
10102
10245
|
});
|
|
10103
|
-
if (
|
|
10104
|
-
|
|
10105
|
-
|
|
10246
|
+
if (p57.isCancel(ok) || !ok) {
|
|
10247
|
+
p57.cancel("Operation cancelled.");
|
|
10248
|
+
process35.exit(0);
|
|
10106
10249
|
}
|
|
10107
10250
|
}
|
|
10108
10251
|
|
|
10109
10252
|
// src/commands/targets.ts
|
|
10110
|
-
import { Command as
|
|
10111
|
-
import * as
|
|
10253
|
+
import { Command as Command96 } from "commander";
|
|
10254
|
+
import * as p58 from "@clack/prompts";
|
|
10112
10255
|
import pc32 from "picocolors";
|
|
10113
10256
|
import * as v9 from "valibot";
|
|
10114
10257
|
var OptionsSchema4 = v9.object({
|
|
@@ -10117,7 +10260,7 @@ var OptionsSchema4 = v9.object({
|
|
|
10117
10260
|
offline: v9.optional(v9.boolean())
|
|
10118
10261
|
});
|
|
10119
10262
|
var targets = addSshOptions(
|
|
10120
|
-
new
|
|
10263
|
+
new Command96("targets").description("list the targets this project can deploy to").configureHelp(helpConfig)
|
|
10121
10264
|
).option("--json", "print raw JSON").option("--offline", "skip connecting to servers").action(
|
|
10122
10265
|
(raw) => runCommand(async () => {
|
|
10123
10266
|
const options = parseOptions(OptionsSchema4, raw);
|
|
@@ -10183,11 +10326,11 @@ function report3(rows, offline) {
|
|
|
10183
10326
|
const lines = rows.map(
|
|
10184
10327
|
(row) => `${row.kind === "local" ? pc32.dim(row.target.padEnd(target)) : pc32.cyan(row.target.padEnd(target))} ${row.server.padEnd(server)} ${row.domain.padEnd(domain)} ${row.release}`
|
|
10185
10328
|
);
|
|
10186
|
-
|
|
10329
|
+
p58.log.info(`${pc32.dim(header)}
|
|
10187
10330
|
${lines.join("\n")}`);
|
|
10188
10331
|
const unreachable = rows.filter((row) => row.kind === "remote" && !row.reachable);
|
|
10189
10332
|
if (!offline && unreachable.length > 0) {
|
|
10190
|
-
|
|
10333
|
+
p58.log.warn(
|
|
10191
10334
|
`Could not reach ${unreachable.map((row) => row.server).join(", ")}.
|
|
10192
10335
|
Release and domain are shown from what this project recorded.`
|
|
10193
10336
|
);
|
|
@@ -10196,16 +10339,16 @@ Release and domain are shown from what this project recorded.`
|
|
|
10196
10339
|
|
|
10197
10340
|
// src/commands/test.ts
|
|
10198
10341
|
import path44 from "node:path";
|
|
10199
|
-
import
|
|
10200
|
-
import { Command as
|
|
10342
|
+
import process36 from "node:process";
|
|
10343
|
+
import { Command as Command97 } from "commander";
|
|
10201
10344
|
import PocketBase6 from "pocketbase";
|
|
10202
10345
|
import pc33 from "picocolors";
|
|
10203
10346
|
import { x as x5 } from "tinyexec";
|
|
10204
10347
|
import { detect as detect8 } from "package-manager-detector";
|
|
10205
10348
|
import { resolveCommand as resolveCommand7 } from "package-manager-detector/commands";
|
|
10206
10349
|
import fs42 from "node:fs";
|
|
10207
|
-
var testServer = new
|
|
10208
|
-
const cwd =
|
|
10350
|
+
var testServer = new Command97("test:server").description("run server tests").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(async (_opts, cmd) => {
|
|
10351
|
+
const cwd = process36.cwd();
|
|
10209
10352
|
const email3 = `test-${Math.random().toString(36).slice(2)}@example.com`;
|
|
10210
10353
|
const password11 = "password";
|
|
10211
10354
|
const testDataDir = path44.join(cwd, "test-data");
|
|
@@ -10220,11 +10363,11 @@ var testServer = new Command96("test:server").description("run server tests").al
|
|
|
10220
10363
|
email: email3,
|
|
10221
10364
|
password: password11
|
|
10222
10365
|
});
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
|
|
10366
|
+
process36.env.POCKETBASE_URL = url;
|
|
10367
|
+
process36.env.POCKETBASE_SUPERUSER_EMAIL = email3;
|
|
10368
|
+
process36.env.POCKETBASE_SUPERUSER_PASSWORD = password11;
|
|
10369
|
+
process36.env.VELA_DATA_DIR = testDataDir;
|
|
10370
|
+
process36.env.TEST = "true";
|
|
10228
10371
|
console.log(`${pc33.greenBright("\u2713")} Created test database`);
|
|
10229
10372
|
let vite;
|
|
10230
10373
|
let cleanedUp = false;
|
|
@@ -10243,12 +10386,12 @@ var testServer = new Command96("test:server").description("run server tests").al
|
|
|
10243
10386
|
const fail = async (message) => {
|
|
10244
10387
|
console.error(`${pc33.redBright("\u2717")} ${message}`);
|
|
10245
10388
|
await cleanup();
|
|
10246
|
-
|
|
10389
|
+
process36.exit(1);
|
|
10247
10390
|
};
|
|
10248
|
-
|
|
10249
|
-
|
|
10391
|
+
process36.on("exit", cleanupSync);
|
|
10392
|
+
process36.on("SIGINT", () => {
|
|
10250
10393
|
cleanupSync();
|
|
10251
|
-
|
|
10394
|
+
process36.exit(130);
|
|
10252
10395
|
});
|
|
10253
10396
|
const pb = new PocketBase6(url);
|
|
10254
10397
|
try {
|
|
@@ -10276,7 +10419,7 @@ var testServer = new Command96("test:server").description("run server tests").al
|
|
|
10276
10419
|
});
|
|
10277
10420
|
const vitePort = await findFreePort();
|
|
10278
10421
|
await vite.listen(vitePort);
|
|
10279
|
-
|
|
10422
|
+
process36.env.VITE_TEST_URL = `http://localhost:${vitePort}`;
|
|
10280
10423
|
console.log(`${pc33.greenBright("\u2713")} Started Vite: http://localhost:${vitePort}`);
|
|
10281
10424
|
console.log(`${pc33.greenBright("\u2713")} Started PocketBase: ${url}`);
|
|
10282
10425
|
const extraArgs = (cmd.parent?.args ?? []).slice(1);
|
|
@@ -10295,12 +10438,12 @@ var testServer = new Command96("test:server").description("run server tests").al
|
|
|
10295
10438
|
const resolvedArgs = resolved.args.slice();
|
|
10296
10439
|
if (pm === "npm") resolvedArgs.unshift("--yes");
|
|
10297
10440
|
const result = await x5(resolved.command, resolvedArgs, {
|
|
10298
|
-
nodeOptions: { cwd, stdio: "inherit", env: { ...
|
|
10441
|
+
nodeOptions: { cwd, stdio: "inherit", env: { ...process36.env, CI: "1" } }
|
|
10299
10442
|
});
|
|
10300
|
-
|
|
10443
|
+
process36.exitCode = result.exitCode ?? 1;
|
|
10301
10444
|
} catch (e) {
|
|
10302
10445
|
console.error(`${pc33.redBright("\u2717")} ${e.message}`);
|
|
10303
|
-
|
|
10446
|
+
process36.exitCode = 1;
|
|
10304
10447
|
} finally {
|
|
10305
10448
|
await cleanup();
|
|
10306
10449
|
}
|
|
@@ -10333,7 +10476,7 @@ function stubPagesPlugin() {
|
|
|
10333
10476
|
// src/commands/routes.ts
|
|
10334
10477
|
import fs43 from "node:fs";
|
|
10335
10478
|
import path45 from "node:path";
|
|
10336
|
-
import { Command as
|
|
10479
|
+
import { Command as Command98 } from "commander";
|
|
10337
10480
|
var HTTP_METHODS = /* @__PURE__ */ new Set([
|
|
10338
10481
|
"GET",
|
|
10339
10482
|
"POST",
|
|
@@ -10344,7 +10487,7 @@ var HTTP_METHODS = /* @__PURE__ */ new Set([
|
|
|
10344
10487
|
"HEAD",
|
|
10345
10488
|
"fallback"
|
|
10346
10489
|
]);
|
|
10347
|
-
var routes = new
|
|
10490
|
+
var routes = new Command98("routes").description("list routes").configureHelp(helpConfig).action(async () => {
|
|
10348
10491
|
const { workspaceRootDir, routesDir } = await getWorkspace();
|
|
10349
10492
|
const routesRoot = path45.join(workspaceRootDir, routesDir);
|
|
10350
10493
|
const found = walk(routesRoot, routesRoot).filter((r) => r.methods.length > 0);
|
|
@@ -10419,13 +10562,13 @@ function printTable(routes2) {
|
|
|
10419
10562
|
}
|
|
10420
10563
|
|
|
10421
10564
|
// src/commands/i18n.ts
|
|
10422
|
-
import
|
|
10423
|
-
import { Command as
|
|
10565
|
+
import process37 from "node:process";
|
|
10566
|
+
import { Command as Command99 } from "commander";
|
|
10424
10567
|
import { x as x6 } from "tinyexec";
|
|
10425
10568
|
import { detect as detect9 } from "package-manager-detector";
|
|
10426
10569
|
import { resolveCommand as resolveCommand8 } from "package-manager-detector/commands";
|
|
10427
10570
|
async function runWuchale(extraArgs) {
|
|
10428
|
-
const cwd =
|
|
10571
|
+
const cwd = process37.cwd();
|
|
10429
10572
|
const pm = (await detect9({ cwd }))?.name ?? "npm";
|
|
10430
10573
|
const resolved = resolveCommand8(pm, "execute", ["wuchale", ...extraArgs]);
|
|
10431
10574
|
const args = resolved.args.slice();
|
|
@@ -10435,11 +10578,11 @@ async function runWuchale(extraArgs) {
|
|
|
10435
10578
|
throwOnError: true
|
|
10436
10579
|
});
|
|
10437
10580
|
}
|
|
10438
|
-
var extract2 = new
|
|
10439
|
-
var watch = new
|
|
10440
|
-
var status2 = new
|
|
10441
|
-
var clean = new
|
|
10442
|
-
var i18n3 = new
|
|
10581
|
+
var extract2 = new Command99("extract").description("extract translatable strings").configureHelp(helpConfig).action(() => runWuchale([]));
|
|
10582
|
+
var watch = new Command99("watch").description("watch and extract translatable strings").configureHelp(helpConfig).action(() => runWuchale(["--watch"]));
|
|
10583
|
+
var status2 = new Command99("status").description("show i18n status").configureHelp(helpConfig).action(() => runWuchale(["status"]));
|
|
10584
|
+
var clean = new Command99("clean").description("clean unused translatable strings").configureHelp(helpConfig).action(() => runWuchale(["--clean"]));
|
|
10585
|
+
var i18n3 = new Command99("i18n").description("i18n utilities").configureHelp(helpConfig).addCommand(extract2, { isDefault: true }).addCommand(watch).addCommand(status2).addCommand(clean);
|
|
10443
10586
|
|
|
10444
10587
|
// src/commands/oauth.ts
|
|
10445
10588
|
var oauth = stubCommand("oauth", "configure OAuth providers");
|
|
@@ -10448,21 +10591,21 @@ var oauth = stubCommand("oauth", "configure OAuth providers");
|
|
|
10448
10591
|
var schemas = stubCommand("schemas", "manage database schemas");
|
|
10449
10592
|
|
|
10450
10593
|
// src/commands/cms.ts
|
|
10451
|
-
import { Command as
|
|
10594
|
+
import { Command as Command104 } from "commander";
|
|
10452
10595
|
|
|
10453
10596
|
// src/commands/cms/editor.ts
|
|
10454
|
-
import { Command as
|
|
10597
|
+
import { Command as Command103 } from "commander";
|
|
10455
10598
|
|
|
10456
10599
|
// src/commands/cms/editor/add.ts
|
|
10457
10600
|
import { randomBytes } from "node:crypto";
|
|
10458
|
-
import { Command as
|
|
10459
|
-
import * as
|
|
10601
|
+
import { Command as Command100 } from "commander";
|
|
10602
|
+
import * as p59 from "@clack/prompts";
|
|
10460
10603
|
import pc35 from "picocolors";
|
|
10461
10604
|
|
|
10462
10605
|
// src/lib/cms-backend.ts
|
|
10463
10606
|
import { createRequire as createRequire3 } from "node:module";
|
|
10464
10607
|
import path46 from "node:path";
|
|
10465
|
-
import
|
|
10608
|
+
import process38 from "node:process";
|
|
10466
10609
|
import { pathToFileURL as pathToFileURL3 } from "node:url";
|
|
10467
10610
|
import pc34 from "picocolors";
|
|
10468
10611
|
var DEFAULT_PROJECT = "default";
|
|
@@ -10479,7 +10622,7 @@ Run ${pc34.cyan("vela enable cms")} first.`
|
|
|
10479
10622
|
}
|
|
10480
10623
|
return await import(pathToFileURL3(entry).href);
|
|
10481
10624
|
}
|
|
10482
|
-
async function withCmsBackend(fn, cwd =
|
|
10625
|
+
async function withCmsBackend(fn, cwd = process38.cwd()) {
|
|
10483
10626
|
const root = findWorkspaceRoot(cwd);
|
|
10484
10627
|
if (!root) {
|
|
10485
10628
|
throw new Error("Could not find workspace root (no package.json found)");
|
|
@@ -10498,7 +10641,7 @@ async function withCmsBackend(fn, cwd = process37.cwd()) {
|
|
|
10498
10641
|
}
|
|
10499
10642
|
|
|
10500
10643
|
// src/commands/cms/editor/add.ts
|
|
10501
|
-
var editorAdd = new
|
|
10644
|
+
var editorAdd = new Command100("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(
|
|
10502
10645
|
(email3, options) => runCommand(async () => {
|
|
10503
10646
|
const generated = options.password === void 0;
|
|
10504
10647
|
const password11 = options.password ?? randomBytes(12).toString("base64url");
|
|
@@ -10509,31 +10652,31 @@ var editorAdd = new Command99("add").description("create an editor who can sign
|
|
|
10509
10652
|
if (generated) {
|
|
10510
10653
|
lines.push("", `Password: ${pc35.bold(password11)}`, "", "It is shown once; copy it now.");
|
|
10511
10654
|
}
|
|
10512
|
-
|
|
10513
|
-
|
|
10655
|
+
p59.log.success(lines.join("\n"));
|
|
10656
|
+
p59.log.info(
|
|
10514
10657
|
`Run ${pc35.cyan("vela dev")}, open any page with ${pc35.cyan("?edit")} on the URL (or press ${pc35.cyan("Ctrl+E")}), and sign in.`
|
|
10515
10658
|
);
|
|
10516
10659
|
}, "Failed to add the editor.")
|
|
10517
10660
|
);
|
|
10518
10661
|
|
|
10519
10662
|
// src/commands/cms/editor/password.ts
|
|
10520
|
-
import { Command as
|
|
10521
|
-
import * as
|
|
10663
|
+
import { Command as Command101 } from "commander";
|
|
10664
|
+
import * as p60 from "@clack/prompts";
|
|
10522
10665
|
import pc36 from "picocolors";
|
|
10523
|
-
var editorPassword = new
|
|
10666
|
+
var editorPassword = new Command101("password").description("set an editor's password").argument("<email>", "email of the editor").argument("<password>", "new password").configureHelp(helpConfig).action(
|
|
10524
10667
|
(email3, password11) => runCommand(async () => {
|
|
10525
10668
|
await withCmsBackend((cms3) => cms3.editors.setPassword(email3, password11));
|
|
10526
|
-
|
|
10669
|
+
p60.log.success(
|
|
10527
10670
|
`Updated the password for ${pc36.cyan(email3)}. Existing sessions were signed out.`
|
|
10528
10671
|
);
|
|
10529
10672
|
}, "Failed to set the password.")
|
|
10530
10673
|
);
|
|
10531
10674
|
|
|
10532
10675
|
// src/commands/cms/editor/list.ts
|
|
10533
|
-
import { Command as
|
|
10534
|
-
import * as
|
|
10676
|
+
import { Command as Command102 } from "commander";
|
|
10677
|
+
import * as p61 from "@clack/prompts";
|
|
10535
10678
|
import pc37 from "picocolors";
|
|
10536
|
-
var editorList = new
|
|
10679
|
+
var editorList = new Command102("list").description("list editors and the projects they may edit").configureHelp(helpConfig).action(
|
|
10537
10680
|
() => runCommand(async () => {
|
|
10538
10681
|
const rows = await withCmsBackend(
|
|
10539
10682
|
async (cms3) => cms3.editors.list().map((editor2) => ({
|
|
@@ -10542,11 +10685,11 @@ var editorList = new Command101("list").description("list editors and the projec
|
|
|
10542
10685
|
}))
|
|
10543
10686
|
);
|
|
10544
10687
|
if (rows.length === 0) {
|
|
10545
|
-
|
|
10688
|
+
p61.log.info(`No editors yet. Add one with ${pc37.cyan("vela cms editor add <email>")}.`);
|
|
10546
10689
|
return;
|
|
10547
10690
|
}
|
|
10548
10691
|
const width = Math.max(...rows.map((row) => row.email.length));
|
|
10549
|
-
|
|
10692
|
+
p61.log.info(
|
|
10550
10693
|
`Editors
|
|
10551
10694
|
|
|
10552
10695
|
` + rows.map(
|
|
@@ -10557,10 +10700,10 @@ var editorList = new Command101("list").description("list editors and the projec
|
|
|
10557
10700
|
);
|
|
10558
10701
|
|
|
10559
10702
|
// src/commands/cms/editor.ts
|
|
10560
|
-
var editor = new
|
|
10703
|
+
var editor = new Command103("editor").description("manage who can sign in to the admin bar").configureHelp(helpConfig).addCommand(editorAdd).addCommand(editorPassword).addCommand(editorList);
|
|
10561
10704
|
|
|
10562
10705
|
// src/commands/cms.ts
|
|
10563
|
-
var cms2 = new
|
|
10706
|
+
var cms2 = new Command104("cms").description("manage the CMS").configureHelp(helpConfig).addCommand(editor);
|
|
10564
10707
|
|
|
10565
10708
|
// src/program.ts
|
|
10566
10709
|
var NO_BACKEND_COMMMANDS = /* @__PURE__ */ new Set([
|
|
@@ -10578,6 +10721,8 @@ var NO_BACKEND_COMMMANDS = /* @__PURE__ */ new Set([
|
|
|
10578
10721
|
"generate form",
|
|
10579
10722
|
// The CMS keeps its own SQLite database and editors; PocketBase is never involved.
|
|
10580
10723
|
"enable cms",
|
|
10724
|
+
// Analytics only touches the root layout and .env; it must work on static sites.
|
|
10725
|
+
"enable analytics",
|
|
10581
10726
|
"cms",
|
|
10582
10727
|
// Server commands talk to a VPS over SSH, never to the local database.
|
|
10583
10728
|
"provision",
|
|
@@ -10598,10 +10743,10 @@ var NO_BACKEND_COMMMANDS = /* @__PURE__ */ new Set([
|
|
|
10598
10743
|
]);
|
|
10599
10744
|
var BACKEND_OPTIONAL_COMMANDS = /* @__PURE__ */ new Set(["dev", "build", "preview", "deploy"]);
|
|
10600
10745
|
var SELF_CREDENTIALED_COMMANDS = /* @__PURE__ */ new Set(["test:server"]);
|
|
10601
|
-
var program = new
|
|
10746
|
+
var program = new Command105().name(package_default.name).description(package_default.description).version(package_default.version, "-v, --version").configureHelp(helpConfig);
|
|
10602
10747
|
program.hook("preAction", (_thisCommand, actionCommand) => {
|
|
10603
10748
|
if (isStub(actionCommand)) return;
|
|
10604
|
-
const envRoot = findWorkspaceRoot() ??
|
|
10749
|
+
const envRoot = findWorkspaceRoot() ?? process39.cwd();
|
|
10605
10750
|
dotenv2.config({ path: nodePath.join(envRoot, ".env"), quiet: true });
|
|
10606
10751
|
const path47 = getCommandPath(actionCommand);
|
|
10607
10752
|
if (NO_BACKEND_COMMMANDS.has(path47)) return;
|
|
@@ -10609,20 +10754,20 @@ program.hook("preAction", (_thisCommand, actionCommand) => {
|
|
|
10609
10754
|
if (NO_BACKEND_COMMMANDS.has(top)) return;
|
|
10610
10755
|
if (!hasBackend()) {
|
|
10611
10756
|
if (BACKEND_OPTIONAL_COMMANDS.has(top)) return;
|
|
10612
|
-
|
|
10757
|
+
p62.log.error(
|
|
10613
10758
|
`${pc38.cyan(`vela ${path47}`)} needs a backend, and this project does not have one.
|
|
10614
10759
|
|
|
10615
10760
|
Static projects have no database to talk to.
|
|
10616
10761
|
|
|
10617
10762
|
To add a backend to this project, run ${pc38.cyan("vela bless")}.`
|
|
10618
10763
|
);
|
|
10619
|
-
|
|
10620
|
-
|
|
10621
|
-
|
|
10764
|
+
p62.log.message();
|
|
10765
|
+
p62.cancel("Operation failed.");
|
|
10766
|
+
process39.exit(1);
|
|
10622
10767
|
}
|
|
10623
10768
|
if (SELF_CREDENTIALED_COMMANDS.has(path47)) return;
|
|
10624
|
-
if (!
|
|
10625
|
-
|
|
10769
|
+
if (!process39.env.POCKETBASE_SUPERUSER_EMAIL || !process39.env.POCKETBASE_SUPERUSER_PASSWORD) {
|
|
10770
|
+
p62.log.error(
|
|
10626
10771
|
`PocketBase superuser credentials are required.
|
|
10627
10772
|
|
|
10628
10773
|
Set ${pc38.cyan("POCKETBASE_SUPERUSER_EMAIL")} and ${pc38.cyan("POCKETBASE_SUPERUSER_PASSWORD")} in your .env file.
|
|
@@ -10630,9 +10775,9 @@ Set ${pc38.cyan("POCKETBASE_SUPERUSER_EMAIL")} and ${pc38.cyan("POCKETBASE_SUPER
|
|
|
10630
10775
|
To set up a new project, run ${pc38.cyan("vela create")}.
|
|
10631
10776
|
To set up an existing project, run ${pc38.cyan("vela bless")}.`
|
|
10632
10777
|
);
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
|
|
10778
|
+
p62.log.message();
|
|
10779
|
+
p62.cancel("Operation failed.");
|
|
10780
|
+
process39.exit(1);
|
|
10636
10781
|
}
|
|
10637
10782
|
});
|
|
10638
10783
|
function getCommandPath(cmd) {
|
|
@@ -10686,5 +10831,5 @@ for (const command of [
|
|
|
10686
10831
|
}
|
|
10687
10832
|
|
|
10688
10833
|
// src/bin.ts
|
|
10689
|
-
program.parse(normalizeArgv(
|
|
10834
|
+
program.parse(normalizeArgv(process40.argv.slice(2)), { from: "user" });
|
|
10690
10835
|
//# sourceMappingURL=bin.js.map
|