vela 0.15.12 → 0.15.13
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/README.md +2 -1
- package/dist/bin.js +665 -365
- package/dist/bin.js.map +4 -4
- package/package.json +1 -1
- package/templates/minimal/src/routes/(public)/+page.svelte +1 -1
- package/templates/minimal/test/setup.ts +9 -3
- package/templates/server/systemd/vela-pb@.service +1 -1
- package/templates/server/systemd/vela-web@.service +1 -1
- package/templates/static/src/routes/(public)/+page.svelte +1 -1
package/dist/bin.js
CHANGED
|
@@ -13,7 +13,7 @@ function normalizeArgv(argv) {
|
|
|
13
13
|
// src/program.ts
|
|
14
14
|
import process52 from "node:process";
|
|
15
15
|
import * as p73 from "@clack/prompts";
|
|
16
|
-
import { Command as
|
|
16
|
+
import { Command as Command116 } from "commander";
|
|
17
17
|
import nodePath from "node:path";
|
|
18
18
|
import dotenv2 from "dotenv";
|
|
19
19
|
import pc47 from "picocolors";
|
|
@@ -21,7 +21,7 @@ import pc47 from "picocolors";
|
|
|
21
21
|
// package.json
|
|
22
22
|
var package_default = {
|
|
23
23
|
name: "vela",
|
|
24
|
-
version: "0.15.
|
|
24
|
+
version: "0.15.13",
|
|
25
25
|
type: "module",
|
|
26
26
|
description: "A CLI for creating and updating SvelteKit projects",
|
|
27
27
|
license: "MIT",
|
|
@@ -596,6 +596,9 @@ function detectFeatures(root, { isAppMode, isPaymentsMode }) {
|
|
|
596
596
|
contentNegotiation: hasDep("sveltekit-negotiate"),
|
|
597
597
|
cms: hasDep("@velastack/cms"),
|
|
598
598
|
workflows: has("src/lib/server/workflows.ts"),
|
|
599
|
+
// The code page, not src/lib/server/whatsapp.ts, which goes once the
|
|
600
|
+
// PocketBase SDK has WhatsApp.
|
|
601
|
+
whatsapp: has("src/routes/(public)/(auth)/whatsapp"),
|
|
599
602
|
ui: detectUi(root)
|
|
600
603
|
};
|
|
601
604
|
}
|
|
@@ -1784,20 +1787,20 @@ var SITE_FILE = path10.join("src", "lib", "site.ts");
|
|
|
1784
1787
|
async function readSite(root) {
|
|
1785
1788
|
const file = path10.join(root, SITE_FILE);
|
|
1786
1789
|
if (!fs12.existsSync(file)) return null;
|
|
1787
|
-
const { Project:
|
|
1788
|
-
const project = new
|
|
1790
|
+
const { Project: Project6, Node: Node6 } = await import("ts-morph");
|
|
1791
|
+
const project = new Project6({ useInMemoryFileSystem: true });
|
|
1789
1792
|
const source = project.createSourceFile("site.ts", fs12.readFileSync(file, "utf8"));
|
|
1790
1793
|
let object8 = source.getVariableDeclaration("site")?.getInitializer();
|
|
1791
|
-
while (object8 && (
|
|
1794
|
+
while (object8 && (Node6.isAsExpression(object8) || Node6.isSatisfiesExpression(object8))) {
|
|
1792
1795
|
object8 = object8.getExpression();
|
|
1793
1796
|
}
|
|
1794
|
-
if (!object8 || !
|
|
1797
|
+
if (!object8 || !Node6.isObjectLiteralExpression(object8)) return null;
|
|
1795
1798
|
const info = {};
|
|
1796
1799
|
for (const key of ["name", "url"]) {
|
|
1797
1800
|
const property = object8.getProperty(key);
|
|
1798
|
-
if (!property || !
|
|
1801
|
+
if (!property || !Node6.isPropertyAssignment(property)) continue;
|
|
1799
1802
|
const value = property.getInitializer();
|
|
1800
|
-
if (
|
|
1803
|
+
if (Node6.isStringLiteral(value) || Node6.isNoSubstitutionTemplateLiteral(value)) {
|
|
1801
1804
|
const text18 = value.getLiteralValue().trim();
|
|
1802
1805
|
if (text18) info[key] = text18;
|
|
1803
1806
|
}
|
|
@@ -1947,19 +1950,22 @@ function declaredMajor(range) {
|
|
|
1947
1950
|
}
|
|
1948
1951
|
function assertKit3(root, label2) {
|
|
1949
1952
|
const status3 = kitStatus(root);
|
|
1950
|
-
const
|
|
1951
|
-
const why =
|
|
1953
|
+
const major = kitMajor(root, status3);
|
|
1954
|
+
const why = major !== null && major < 3 ? status3.declaredMajor !== null ? `package.json declares ${KIT} ${status3.declaredMajor}.x.` : `It has ${KIT} ${status3.installedVersion} installed.` : status3.svelteConfig ? `It still has ${path12.basename(status3.svelteConfig)}, which SvelteKit 3 no longer reads.` : null;
|
|
1952
1955
|
if (!why) return;
|
|
1953
1956
|
throw new KitVersionError(
|
|
1954
1957
|
`${label2}: SvelteKit 2 project detected. ${why}
|
|
1955
1958
|
|
|
1956
|
-
vela 0.15
|
|
1959
|
+
vela 0.15 generates SvelteKit 3 code only. Upgrade the project with
|
|
1957
1960
|
|
|
1958
1961
|
${KIT3_MIGRATE_COMMAND}
|
|
1959
1962
|
|
|
1960
|
-
or stay on vela@0.14, which keeps
|
|
1963
|
+
or stay on vela@0.14, which keeps generating for SvelteKit 2.`
|
|
1961
1964
|
);
|
|
1962
1965
|
}
|
|
1966
|
+
function kitMajor(root, status3 = kitStatus(root)) {
|
|
1967
|
+
return status3.declaredMajor ?? installedMajor(status3.installedVersion);
|
|
1968
|
+
}
|
|
1963
1969
|
function installedMajor(version) {
|
|
1964
1970
|
if (!version) return null;
|
|
1965
1971
|
return minVersion(version)?.major ?? null;
|
|
@@ -1980,7 +1986,7 @@ function warnIfKit2(root, warn2) {
|
|
|
1980
1986
|
if (!(e instanceof KitVersionError)) return;
|
|
1981
1987
|
warned = true;
|
|
1982
1988
|
warn2(
|
|
1983
|
-
`SvelteKit 2 project: vela 0.15 generators
|
|
1989
|
+
`SvelteKit 2 project: vela 0.15 generators (enable, generate, bless) need SvelteKit 3. Upgrade with \`${KIT3_MIGRATE_COMMAND}\`, or pin vela@^0.14.`
|
|
1984
1990
|
);
|
|
1985
1991
|
}
|
|
1986
1992
|
}
|
|
@@ -3049,7 +3055,7 @@ function printNextSteps(projectPath, packageManager2) {
|
|
|
3049
3055
|
nextSteps.push(
|
|
3050
3056
|
"Run `vela enable auth` to layer on sign-in flows, or `vela generate scaffold <model>` to scaffold a CRUD page."
|
|
3051
3057
|
);
|
|
3052
|
-
nextSteps.push("Stuck? Visit https://
|
|
3058
|
+
nextSteps.push("Stuck? Visit https://velastack.dev/docs");
|
|
3053
3059
|
reportResult({
|
|
3054
3060
|
summary: `Blessed project at ${projectPath}.`,
|
|
3055
3061
|
nextSteps
|
|
@@ -3876,6 +3882,8 @@ import {
|
|
|
3876
3882
|
import fs22 from "node:fs";
|
|
3877
3883
|
import path21 from "node:path";
|
|
3878
3884
|
import {
|
|
3885
|
+
Node as Node2,
|
|
3886
|
+
Project as Project3,
|
|
3879
3887
|
SyntaxKind as SyntaxKind3
|
|
3880
3888
|
} from "ts-morph";
|
|
3881
3889
|
import { detect as detect3 } from "package-manager-detector";
|
|
@@ -3897,23 +3905,26 @@ var AdapterError = class extends Error {
|
|
|
3897
3905
|
};
|
|
3898
3906
|
function resolveKitTarget(root) {
|
|
3899
3907
|
const svelteConfig = findSvelteConfig(root);
|
|
3900
|
-
|
|
3908
|
+
const major = kitMajor(root);
|
|
3909
|
+
if (svelteConfig && major !== null && major >= 3) {
|
|
3901
3910
|
throw new AdapterError(
|
|
3902
|
-
`${path21.basename(svelteConfig)} found:
|
|
3903
|
-
|
|
3911
|
+
`${path21.basename(svelteConfig)} found: SvelteKit 3 reads its config only from
|
|
3912
|
+
sveltekit({...}) in vite.config and will not start while this file exists.
|
|
3904
3913
|
|
|
3905
3914
|
Migrate it first:`,
|
|
3906
3915
|
KIT3_MIGRATE_COMMAND
|
|
3907
3916
|
);
|
|
3908
3917
|
}
|
|
3909
3918
|
const vite = inspectViteSveltekit(root);
|
|
3919
|
+
if (!vite?.inlineArg && svelteConfig) return resolveSvelteConfigTarget(svelteConfig);
|
|
3910
3920
|
if (vite?.inlineArg) {
|
|
3911
3921
|
return {
|
|
3912
3922
|
sourceFile: vite.sourceFile,
|
|
3913
3923
|
filePath: vite.filePath,
|
|
3914
3924
|
kit: vite.inlineArg,
|
|
3915
3925
|
created: false,
|
|
3916
|
-
originalText: vite.sourceFile.getFullText()
|
|
3926
|
+
originalText: vite.sourceFile.getFullText(),
|
|
3927
|
+
readOnly: false
|
|
3917
3928
|
};
|
|
3918
3929
|
}
|
|
3919
3930
|
if (vite?.sveltekitCall) {
|
|
@@ -3930,11 +3941,58 @@ Migrate it first:`,
|
|
|
3930
3941
|
filePath: vite.filePath,
|
|
3931
3942
|
kit,
|
|
3932
3943
|
created: true,
|
|
3933
|
-
originalText
|
|
3944
|
+
originalText,
|
|
3945
|
+
readOnly: false
|
|
3934
3946
|
};
|
|
3935
3947
|
}
|
|
3936
3948
|
throw new AdapterError(`No vite.config with a sveltekit() plugin found in ${root}.`);
|
|
3937
3949
|
}
|
|
3950
|
+
function resolveSvelteConfigTarget(filePath) {
|
|
3951
|
+
const name = path21.basename(filePath);
|
|
3952
|
+
const unreadable = () => new AdapterError(
|
|
3953
|
+
`${name}: vela cannot read the adapter from this config.
|
|
3954
|
+
|
|
3955
|
+
vela deploy runs the app as a Node server, which needs ${ADAPTER_NODE}:`
|
|
3956
|
+
);
|
|
3957
|
+
let sourceFile;
|
|
3958
|
+
try {
|
|
3959
|
+
const project = new Project3({
|
|
3960
|
+
compilerOptions: { allowJs: true },
|
|
3961
|
+
skipFileDependencyResolution: true
|
|
3962
|
+
});
|
|
3963
|
+
sourceFile = project.addSourceFileAtPath(filePath);
|
|
3964
|
+
} catch {
|
|
3965
|
+
throw unreadable();
|
|
3966
|
+
}
|
|
3967
|
+
const exported = sourceFile.getExportAssignment((a) => !a.isExportEquals());
|
|
3968
|
+
let value = unwrapExpression(exported?.getExpression());
|
|
3969
|
+
if (value && Node2.isIdentifier(value)) {
|
|
3970
|
+
value = unwrapExpression(sourceFile.getVariableDeclaration(value.getText())?.getInitializer());
|
|
3971
|
+
}
|
|
3972
|
+
if (!value || !Node2.isObjectLiteralExpression(value)) throw unreadable();
|
|
3973
|
+
const kitProp = value.getProperty("kit");
|
|
3974
|
+
let kit = null;
|
|
3975
|
+
if (kitProp) {
|
|
3976
|
+
const init = Node2.isPropertyAssignment(kitProp) ? unwrapExpression(kitProp.getInitializer()) : void 0;
|
|
3977
|
+
if (!init || !Node2.isObjectLiteralExpression(init)) throw unreadable();
|
|
3978
|
+
kit = init;
|
|
3979
|
+
}
|
|
3980
|
+
return {
|
|
3981
|
+
sourceFile,
|
|
3982
|
+
filePath,
|
|
3983
|
+
kit,
|
|
3984
|
+
created: false,
|
|
3985
|
+
originalText: sourceFile.getFullText(),
|
|
3986
|
+
readOnly: true
|
|
3987
|
+
};
|
|
3988
|
+
}
|
|
3989
|
+
function unwrapExpression(expr) {
|
|
3990
|
+
let current = expr;
|
|
3991
|
+
while (current && (Node2.isParenthesizedExpression(current) || Node2.isAsExpression(current) || Node2.isSatisfiesExpression(current))) {
|
|
3992
|
+
current = current.getExpression();
|
|
3993
|
+
}
|
|
3994
|
+
return current;
|
|
3995
|
+
}
|
|
3938
3996
|
function classify(specifier) {
|
|
3939
3997
|
if (specifier === ADAPTER_NODE) return "node";
|
|
3940
3998
|
if (specifier === ADAPTER_AUTO) return "auto";
|
|
@@ -3946,7 +4004,7 @@ function importOf(sourceFile, identifier) {
|
|
|
3946
4004
|
}
|
|
3947
4005
|
function inspectAdapter(target) {
|
|
3948
4006
|
const base2 = { file: target.filePath };
|
|
3949
|
-
const prop = target.kit
|
|
4007
|
+
const prop = target.kit?.getProperty("adapter");
|
|
3950
4008
|
if (!prop) return { info: { ...base2, kind: "none" } };
|
|
3951
4009
|
if (prop.getKind() !== SyntaxKind3.PropertyAssignment) {
|
|
3952
4010
|
return { info: { ...base2, kind: "other" } };
|
|
@@ -3976,6 +4034,17 @@ async function ensureNodeAdapter(root, { install: install2 = true } = {}) {
|
|
|
3976
4034
|
removedDeps: [],
|
|
3977
4035
|
packageJsonChanged: false
|
|
3978
4036
|
};
|
|
4037
|
+
if (target.readOnly) {
|
|
4038
|
+
if (info.kind === "node") return outcome;
|
|
4039
|
+
throw new AdapterError(
|
|
4040
|
+
`${name} found: this is a SvelteKit 2 project, and vela only changes the adapter
|
|
4041
|
+
of a SvelteKit 3 one. vela deploy runs the app as a Node server, which needs
|
|
4042
|
+
${ADAPTER_NODE}. Add it to ${name} yourself, or migrate the project with
|
|
4043
|
+
|
|
4044
|
+
${KIT3_MIGRATE_COMMAND}
|
|
4045
|
+
`
|
|
4046
|
+
);
|
|
4047
|
+
}
|
|
3979
4048
|
switch (info.kind) {
|
|
3980
4049
|
case "node":
|
|
3981
4050
|
break;
|
|
@@ -4039,16 +4108,21 @@ The config and package.json are already updated: run \`${agent} install\`, then
|
|
|
4039
4108
|
}
|
|
4040
4109
|
return agent;
|
|
4041
4110
|
}
|
|
4111
|
+
function editableKit(target) {
|
|
4112
|
+
if (target.readOnly || !target.kit)
|
|
4113
|
+
throw new AdapterError(`${path21.basename(target.filePath)} is not a config vela edits.`);
|
|
4114
|
+
return target.kit;
|
|
4115
|
+
}
|
|
4042
4116
|
function switchImport(target, importDecl) {
|
|
4043
4117
|
importDecl.setModuleSpecifier(ADAPTER_NODE);
|
|
4044
|
-
const prop = target.
|
|
4118
|
+
const prop = editableKit(target).getPropertyOrThrow("adapter").asKindOrThrow(SyntaxKind3.PropertyAssignment);
|
|
4045
4119
|
const call = prop.getInitializerIfKindOrThrow(SyntaxKind3.CallExpression);
|
|
4046
4120
|
for (let i = call.getArguments().length - 1; i >= 0; i--) call.removeArgument(i);
|
|
4047
4121
|
dropAdapterAutoComments(target);
|
|
4048
4122
|
}
|
|
4049
4123
|
var ADAPTER_AUTO_COMMENT = /adapter-auto|svelte\.dev\/docs\/kit\/adapters|switch out the adapter/;
|
|
4050
4124
|
function dropAdapterAutoComments(target) {
|
|
4051
|
-
const prop = target.
|
|
4125
|
+
const prop = editableKit(target).getPropertyOrThrow("adapter");
|
|
4052
4126
|
const ranges = prop.getLeadingCommentRanges();
|
|
4053
4127
|
if (ranges.length === 0 || !ranges.every((r) => ADAPTER_AUTO_COMMENT.test(r.getText()))) return;
|
|
4054
4128
|
const fullStart = prop.getFullStart();
|
|
@@ -4071,7 +4145,7 @@ function addAdapter(target) {
|
|
|
4071
4145
|
defaultImport: "adapter",
|
|
4072
4146
|
moduleSpecifier: ADAPTER_NODE
|
|
4073
4147
|
});
|
|
4074
|
-
target.
|
|
4148
|
+
editableKit(target).addPropertyAssignment({ name: "adapter", initializer: "adapter()" });
|
|
4075
4149
|
}
|
|
4076
4150
|
function saveTarget(target) {
|
|
4077
4151
|
if (target.created) formatLikeSource(target.sourceFile);
|
|
@@ -4117,7 +4191,7 @@ async function packageManager(root) {
|
|
|
4117
4191
|
import fs23 from "node:fs";
|
|
4118
4192
|
import path22 from "node:path";
|
|
4119
4193
|
import { isBuiltin } from "node:module";
|
|
4120
|
-
import { Node as
|
|
4194
|
+
import { Node as Node3, SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
4121
4195
|
function packageNameOf(specifier) {
|
|
4122
4196
|
const parts = specifier.split("/");
|
|
4123
4197
|
return specifier.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0];
|
|
@@ -4125,13 +4199,13 @@ function packageNameOf(specifier) {
|
|
|
4125
4199
|
function unwrap2(expr) {
|
|
4126
4200
|
let current = expr;
|
|
4127
4201
|
for (let i = 0; current && i < 10; i++) {
|
|
4128
|
-
if (
|
|
4202
|
+
if (Node3.isParenthesizedExpression(current) || Node3.isAsExpression(current)) {
|
|
4129
4203
|
current = current.getExpression();
|
|
4130
|
-
} else if (
|
|
4204
|
+
} else if (Node3.isSatisfiesExpression(current)) {
|
|
4131
4205
|
current = current.getExpression();
|
|
4132
|
-
} else if (
|
|
4206
|
+
} else if (Node3.isCallExpression(current) && current.getExpression().getText() === "defineConfig") {
|
|
4133
4207
|
current = current.getArguments()[0];
|
|
4134
|
-
} else if (
|
|
4208
|
+
} else if (Node3.isIdentifier(current)) {
|
|
4135
4209
|
const decl = current.getSourceFile().getVariableDeclaration(current.getText())?.getInitializer();
|
|
4136
4210
|
if (!decl) return current;
|
|
4137
4211
|
current = decl;
|
|
@@ -4144,8 +4218,8 @@ function unwrap2(expr) {
|
|
|
4144
4218
|
function exportedConfig(expr) {
|
|
4145
4219
|
const value = unwrap2(expr);
|
|
4146
4220
|
if (!value) return "it has no default export";
|
|
4147
|
-
if (
|
|
4148
|
-
if (
|
|
4221
|
+
if (Node3.isObjectLiteralExpression(value)) return value;
|
|
4222
|
+
if (Node3.isArrowFunction(value) || Node3.isFunctionExpression(value)) {
|
|
4149
4223
|
return "its config is a function";
|
|
4150
4224
|
}
|
|
4151
4225
|
return "its default export is not an object literal";
|
|
@@ -4166,25 +4240,25 @@ function ssrExternalNotInDependencies(root) {
|
|
|
4166
4240
|
if (typeof config === "string") return unknown2(config);
|
|
4167
4241
|
const ssrProp = config.getProperty("ssr");
|
|
4168
4242
|
if (!ssrProp) return { kind: "none" };
|
|
4169
|
-
if (!
|
|
4243
|
+
if (!Node3.isPropertyAssignment(ssrProp)) return unknown2("`ssr` is not a plain property");
|
|
4170
4244
|
const ssr = unwrap2(ssrProp.getInitializer());
|
|
4171
|
-
if (!ssr || !
|
|
4245
|
+
if (!ssr || !Node3.isObjectLiteralExpression(ssr)) {
|
|
4172
4246
|
return unknown2("`ssr` is not an object literal");
|
|
4173
4247
|
}
|
|
4174
4248
|
const externalProp = ssr.getProperty("external");
|
|
4175
4249
|
if (!externalProp) return { kind: "none" };
|
|
4176
|
-
if (!
|
|
4250
|
+
if (!Node3.isPropertyAssignment(externalProp)) {
|
|
4177
4251
|
return unknown2("`ssr.external` is not a plain property");
|
|
4178
4252
|
}
|
|
4179
4253
|
const external = unwrap2(externalProp.getInitializer());
|
|
4180
4254
|
if (!external) return unknown2("`ssr.external` has no value");
|
|
4181
4255
|
if (external.getKind() === SyntaxKind4.TrueKeyword) return { kind: "all", file };
|
|
4182
|
-
if (!
|
|
4256
|
+
if (!Node3.isArrayLiteralExpression(external)) {
|
|
4183
4257
|
return unknown2("`ssr.external` is not an array literal");
|
|
4184
4258
|
}
|
|
4185
4259
|
const entries = [];
|
|
4186
4260
|
for (const element of external.getElements()) {
|
|
4187
|
-
if (
|
|
4261
|
+
if (Node3.isStringLiteral(element) || Node3.isNoSubstitutionTemplateLiteral(element)) {
|
|
4188
4262
|
entries.push(element.getLiteralValue());
|
|
4189
4263
|
} else {
|
|
4190
4264
|
return unknown2(`\`ssr.external\` has an entry that is not a string: ${element.getText()}`);
|
|
@@ -4332,12 +4406,12 @@ async function findKit2Peers(root, pkg, skip, lookup = npmViewLookup) {
|
|
|
4332
4406
|
// src/lib/locales-alias.ts
|
|
4333
4407
|
import fs25 from "node:fs";
|
|
4334
4408
|
import path24 from "node:path";
|
|
4335
|
-
import { Node as
|
|
4409
|
+
import { Node as Node4, SyntaxKind as SyntaxKind5 } from "ts-morph";
|
|
4336
4410
|
import { ensurePackageImports } from "@velastack/patterns";
|
|
4337
4411
|
var LOCALES_IMPORTS = { "#locales/*": "./src/locales/*" };
|
|
4338
4412
|
var LOCALES_DIR = "src/locales";
|
|
4339
4413
|
function keyName(node) {
|
|
4340
|
-
if (!
|
|
4414
|
+
if (!Node4.isPropertyAssignment(node)) return void 0;
|
|
4341
4415
|
return node.getNameNode().getText().replace(/^['"`]|['"`]$/g, "");
|
|
4342
4416
|
}
|
|
4343
4417
|
function localesProperty(alias) {
|
|
@@ -4366,10 +4440,10 @@ async function migrateLocalesAlias(root) {
|
|
|
4366
4440
|
const outcome = { changed: false, details: [], warnings: [] };
|
|
4367
4441
|
const vite = inspectViteSveltekit(root);
|
|
4368
4442
|
const aliasProp = vite?.inlineArg?.getProperty("alias");
|
|
4369
|
-
if (!vite || !aliasProp || !
|
|
4443
|
+
if (!vite || !aliasProp || !Node4.isPropertyAssignment(aliasProp)) return outcome;
|
|
4370
4444
|
const alias = aliasProp.getInitializerIfKind(SyntaxKind5.ObjectLiteralExpression);
|
|
4371
4445
|
const entry = alias && localesProperty(alias);
|
|
4372
|
-
if (!alias || !entry || !
|
|
4446
|
+
if (!alias || !entry || !Node4.isPropertyAssignment(entry)) return outcome;
|
|
4373
4447
|
const target = entry.getInitializerIfKind(SyntaxKind5.StringLiteral)?.getLiteralValue();
|
|
4374
4448
|
const normalized = target?.replace(/^\.\//, "").replace(/\/$/, "");
|
|
4375
4449
|
if (normalized !== LOCALES_DIR) return outcome;
|
|
@@ -4408,7 +4482,7 @@ async function migrateLocalesAlias(root) {
|
|
|
4408
4482
|
// src/lib/params-native.ts
|
|
4409
4483
|
import fs26 from "node:fs";
|
|
4410
4484
|
import path25 from "node:path";
|
|
4411
|
-
import { Project as
|
|
4485
|
+
import { Project as Project4, QuoteKind as QuoteKind2 } from "ts-morph";
|
|
4412
4486
|
var PARAMS_FILES = ["src/params.ts", "src/params.js"];
|
|
4413
4487
|
var PARAMS_DIR = "src/params";
|
|
4414
4488
|
var IMPORT_SPECIFIERS = /import\s+(type\s+)?([^'";]*?)\s*from\s*(['"])([^'"]+)\3/g;
|
|
@@ -4467,7 +4541,7 @@ function fixParamsImports(root, typeNames = /* @__PURE__ */ new Set()) {
|
|
|
4467
4541
|
if (!rel) return { changes: [], viteOnly: [] };
|
|
4468
4542
|
const file = path25.join(root, rel);
|
|
4469
4543
|
const outcome = { file: rel, changes: [], viteOnly: [] };
|
|
4470
|
-
const project = new
|
|
4544
|
+
const project = new Project4({
|
|
4471
4545
|
compilerOptions: { allowJs: true },
|
|
4472
4546
|
manipulationSettings: { quoteKind: QuoteKind2.Single }
|
|
4473
4547
|
});
|
|
@@ -6106,7 +6180,7 @@ var create = new Command3("create").description("scaffold a new velastack projec
|
|
|
6106
6180
|
nextSteps.push("Run `vela ui add <component>` to add UI components.");
|
|
6107
6181
|
}
|
|
6108
6182
|
nextSteps.push(...linkNextSteps(link2));
|
|
6109
|
-
nextSteps.push("Stuck? Visit https://
|
|
6183
|
+
nextSteps.push("Stuck? Visit https://velastack.dev/docs");
|
|
6110
6184
|
reportResult({
|
|
6111
6185
|
summary: `Created ${name} at ${directory}.`,
|
|
6112
6186
|
nextSteps
|
|
@@ -6388,6 +6462,7 @@ import { Command as Command4 } from "commander";
|
|
|
6388
6462
|
import * as p17 from "@clack/prompts";
|
|
6389
6463
|
|
|
6390
6464
|
// src/lib/pattern-runner.ts
|
|
6465
|
+
import fs32 from "node:fs";
|
|
6391
6466
|
import path31 from "node:path";
|
|
6392
6467
|
import * as p12 from "@clack/prompts";
|
|
6393
6468
|
import { bySlug as bySlug2 } from "@velastack/patterns";
|
|
@@ -6410,6 +6485,24 @@ function toRelative(root, filePath) {
|
|
|
6410
6485
|
return path31.isAbsolute(filePath) ? path31.relative(root, filePath) : filePath;
|
|
6411
6486
|
}
|
|
6412
6487
|
var isSuccess = (f) => (f.status ?? "success") === "success";
|
|
6488
|
+
function listMigrations2(root) {
|
|
6489
|
+
try {
|
|
6490
|
+
return new Set(fs32.readdirSync(path31.join(root, MIGRATIONS_DIR)));
|
|
6491
|
+
} catch {
|
|
6492
|
+
return /* @__PURE__ */ new Set();
|
|
6493
|
+
}
|
|
6494
|
+
}
|
|
6495
|
+
function splitCreated(creates, modifies, root, migrationsBefore) {
|
|
6496
|
+
const isNewMigration = (f) => {
|
|
6497
|
+
const rel = path31.normalize(toRelative(root, f.path));
|
|
6498
|
+
return path31.dirname(rel) === MIGRATIONS_DIR && !migrationsBefore.has(path31.basename(rel));
|
|
6499
|
+
};
|
|
6500
|
+
const modified = modifies.filter(isSuccess);
|
|
6501
|
+
return {
|
|
6502
|
+
created: [...creates.filter(isSuccess), ...modified.filter(isNewMigration)],
|
|
6503
|
+
modified: modified.filter((f) => !isNewMigration(f))
|
|
6504
|
+
};
|
|
6505
|
+
}
|
|
6413
6506
|
async function runPattern(slug2, argv, input, report5, after) {
|
|
6414
6507
|
const pattern = bySlug2[slug2];
|
|
6415
6508
|
if (!pattern) {
|
|
@@ -6421,6 +6514,7 @@ async function runPattern(slug2, argv, input, report5, after) {
|
|
|
6421
6514
|
if (pattern.requires.ui === "shadcn" && features.ui !== "shadcn") {
|
|
6422
6515
|
assertShadcn(`vela ${pattern.command.base.replace(/^vela /, "")}`, workspaceRootDir);
|
|
6423
6516
|
}
|
|
6517
|
+
const migrationsBefore = listMigrations2(workspaceRootDir);
|
|
6424
6518
|
const log57 = p12.taskLog({ title: report5.task.title });
|
|
6425
6519
|
let result;
|
|
6426
6520
|
try {
|
|
@@ -6464,8 +6558,12 @@ async function runPattern(slug2, argv, input, report5, after) {
|
|
|
6464
6558
|
status: f.status === "not-found" ? "not-found" : "failed",
|
|
6465
6559
|
message: f.message
|
|
6466
6560
|
}));
|
|
6467
|
-
const created =
|
|
6468
|
-
|
|
6561
|
+
const { created, modified } = splitCreated(
|
|
6562
|
+
result.creates,
|
|
6563
|
+
result.modifies,
|
|
6564
|
+
workspaceRootDir,
|
|
6565
|
+
migrationsBefore
|
|
6566
|
+
);
|
|
6469
6567
|
const deleted = result.deletes.filter(isSuccess);
|
|
6470
6568
|
const totalChanges = created.length + modified.length + deleted.length + result.components.length + result.packages.length + result.collections.length;
|
|
6471
6569
|
if (totalChanges === 0 && failures.length === 0) {
|
|
@@ -6514,7 +6612,7 @@ function resolveFormInput(root, detectedUi, requested) {
|
|
|
6514
6612
|
}
|
|
6515
6613
|
|
|
6516
6614
|
// src/lib/ai-flow.ts
|
|
6517
|
-
import
|
|
6615
|
+
import fs33 from "node:fs";
|
|
6518
6616
|
import path33 from "node:path";
|
|
6519
6617
|
import * as p16 from "@clack/prompts";
|
|
6520
6618
|
import pc5 from "picocolors";
|
|
@@ -6762,9 +6860,9 @@ function writeLayoutSidecar(workspaceRootDir, modelName, layout) {
|
|
|
6762
6860
|
hasBackend(workspaceRootDir) ? DATA_DIR : ".vela",
|
|
6763
6861
|
"ai-form-layouts"
|
|
6764
6862
|
);
|
|
6765
|
-
|
|
6863
|
+
fs33.mkdirSync(dir, { recursive: true });
|
|
6766
6864
|
const file = path33.join(dir, `${modelName}.json`);
|
|
6767
|
-
|
|
6865
|
+
fs33.writeFileSync(file, JSON.stringify(layout, null, 2) + "\n");
|
|
6768
6866
|
return path33.relative(workspaceRootDir, file);
|
|
6769
6867
|
}
|
|
6770
6868
|
|
|
@@ -6778,7 +6876,7 @@ var form = new Command4("form").description("generate a form from a model").argu
|
|
|
6778
6876
|
).option(
|
|
6779
6877
|
"--ai <description>",
|
|
6780
6878
|
"design the form with AI from a natural-language description (two stages: schema \u2192 layout)"
|
|
6781
|
-
).
|
|
6879
|
+
).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
6782
6880
|
(model, fields, options) => runCommand(async () => {
|
|
6783
6881
|
let argv;
|
|
6784
6882
|
let modelName;
|
|
@@ -6842,7 +6940,7 @@ var form = new Command4("form").description("generate a form from a model").argu
|
|
|
6842
6940
|
// src/commands/generate/schema.ts
|
|
6843
6941
|
import { Command as Command5 } from "commander";
|
|
6844
6942
|
import * as p18 from "@clack/prompts";
|
|
6845
|
-
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").
|
|
6943
|
+
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").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
6846
6944
|
(model, fields, options) => runCommand(async () => {
|
|
6847
6945
|
let argv;
|
|
6848
6946
|
let modelName;
|
|
@@ -6886,7 +6984,7 @@ var schema = new Command5("schema").description("generate a schema from a model"
|
|
|
6886
6984
|
|
|
6887
6985
|
// src/commands/generate/resource.ts
|
|
6888
6986
|
import { Command as Command6 } from "commander";
|
|
6889
|
-
var resource = new Command6("resource").description("generate a resource (model + CRUD pages)").argument("<model>", "model name").argument("[fields...]", "field definitions").
|
|
6987
|
+
var resource = new Command6("resource").description("generate a resource (model + CRUD pages)").argument("<model>", "model name").argument("[fields...]", "field definitions").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
6890
6988
|
(model, fields) => runCommand(
|
|
6891
6989
|
() => runPattern(
|
|
6892
6990
|
"generate-resource",
|
|
@@ -6922,7 +7020,7 @@ var scaffold = new Command7("scaffold").description("generate a full CRUD scaffo
|
|
|
6922
7020
|
).option(
|
|
6923
7021
|
"--ai <description>",
|
|
6924
7022
|
"design the scaffold with AI from a natural-language description (two stages: schema \u2192 layout)"
|
|
6925
|
-
).
|
|
7023
|
+
).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
6926
7024
|
(model, fields, options) => runCommand(async () => {
|
|
6927
7025
|
if (options.remote) {
|
|
6928
7026
|
if (options.ui === "plain") {
|
|
@@ -6993,7 +7091,7 @@ var scaffold = new Command7("scaffold").description("generate a full CRUD scaffo
|
|
|
6993
7091
|
// src/commands/generate/migration.ts
|
|
6994
7092
|
import process16 from "node:process";
|
|
6995
7093
|
import { Command as Command8 } from "commander";
|
|
6996
|
-
var migration = new Command8("migration").description("generate a migration for an existing collection, or edit the schema in a browser").argument("[collection]", "collection name").argument("[op]", "operation (add, remove, rename, references)").argument("[args...]", 'operation arguments (e.g. "birthday:date")').option("--ai", "open the visual schema editor in a browser instead").option("--no-open", "with --ai: print the editor URL without opening a browser").
|
|
7094
|
+
var migration = new Command8("migration").description("generate a migration for an existing collection, or edit the schema in a browser").argument("[collection]", "collection name").argument("[op]", "operation (add, remove, rename, references)").argument("[args...]", 'operation arguments (e.g. "birthday:date")').option("--ai", "open the visual schema editor in a browser instead").option("--no-open", "with --ai: print the editor URL without opening a browser").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
6997
7095
|
(collection, op, args, opts) => runCommand(() => {
|
|
6998
7096
|
if (opts.ai) {
|
|
6999
7097
|
return runSchemaEditor({ cwd: process16.cwd(), noOpen: !opts.open });
|
|
@@ -7025,7 +7123,7 @@ var migration = new Command8("migration").description("generate a migration for
|
|
|
7025
7123
|
|
|
7026
7124
|
// src/commands/generate/workflow.ts
|
|
7027
7125
|
import { Command as Command9 } from "commander";
|
|
7028
|
-
var workflow = new Command9("workflow").description("generate a background workflow in src/lib/workflows").argument("<name>", "workflow name, e.g. send-welcome-email").option("--cron <schedule>", 'run on a schedule, e.g. "*/5 * * * *"').
|
|
7126
|
+
var workflow = new Command9("workflow").description("generate a background workflow in src/lib/workflows").argument("<name>", "workflow name, e.g. send-welcome-email").option("--cron <schedule>", 'run on a schedule, e.g. "*/5 * * * *"').allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7029
7127
|
(name, options, cmd) => runCommand(
|
|
7030
7128
|
() => runPattern(
|
|
7031
7129
|
"generate-workflow",
|
|
@@ -7053,11 +7151,11 @@ var workflow = new Command9("workflow").description("generate a background workf
|
|
|
7053
7151
|
var generate = new Command10("generate").description("generate scaffolding for database models and forms").configureHelp(helpConfig).addCommand(form).addCommand(schema).addCommand(resource).addCommand(scaffold).addCommand(migration).addCommand(workflow);
|
|
7054
7152
|
|
|
7055
7153
|
// src/commands/enable.ts
|
|
7056
|
-
import { Command as
|
|
7154
|
+
import { Command as Command27 } from "commander";
|
|
7057
7155
|
|
|
7058
7156
|
// src/commands/enable/ai.ts
|
|
7059
7157
|
import { Command as Command11 } from "commander";
|
|
7060
|
-
var ai = new Command11("ai").description("enable AI chat with the Vercel AI SDK (Vercel AI Gateway, OpenAI or Anthropic)").option("--provider <provider>", "AI provider: gateway, openai or anthropic").
|
|
7158
|
+
var ai = new Command11("ai").description("enable AI chat with the Vercel AI SDK (Vercel AI Gateway, OpenAI or Anthropic)").option("--provider <provider>", "AI provider: gateway, openai or anthropic").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7061
7159
|
(opts, cmd) => runCommand(async () => {
|
|
7062
7160
|
const provider = await resolveProvider("enable-ai", opts.provider);
|
|
7063
7161
|
const providerEnv = await collectProviderEnv(provider);
|
|
@@ -7090,7 +7188,7 @@ var ai = new Command11("ai").description("enable AI chat with the Vercel AI SDK
|
|
|
7090
7188
|
|
|
7091
7189
|
// src/commands/enable/analytics.ts
|
|
7092
7190
|
import { Command as Command12 } from "commander";
|
|
7093
|
-
var analytics = new Command12("analytics").description("enable web analytics (Plausible, Google Analytics or PostHog)").option("--provider <provider>", "analytics provider: plausible, google or posthog").
|
|
7191
|
+
var analytics = new Command12("analytics").description("enable web analytics (Plausible, Google Analytics or PostHog)").option("--provider <provider>", "analytics provider: plausible, google or posthog").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7094
7192
|
(opts, cmd) => runCommand(async () => {
|
|
7095
7193
|
const provider = await resolveProvider("enable-analytics", opts.provider);
|
|
7096
7194
|
const providerEnv = await collectProviderEnv(provider);
|
|
@@ -7121,25 +7219,32 @@ var analytics = new Command12("analytics").description("enable web analytics (Pl
|
|
|
7121
7219
|
|
|
7122
7220
|
// src/commands/enable/auth.ts
|
|
7123
7221
|
import { Command as Command13 } from "commander";
|
|
7124
|
-
var auth = new Command13("auth").description("enable authentication (email/password + OAuth scaffold)").
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7222
|
+
var auth = new Command13("auth").description("enable authentication (email/password + OAuth scaffold)").option(
|
|
7223
|
+
"--remote",
|
|
7224
|
+
"generate the auth forms with SvelteKit remote functions instead of form actions and superforms"
|
|
7225
|
+
).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7226
|
+
(options, cmd) => runCommand(
|
|
7227
|
+
() => (
|
|
7228
|
+
// Same pages and flows either way; `--remote` picks the variant whose
|
|
7229
|
+
// forms post to `form.remote.ts` files, like `generate form --remote`.
|
|
7230
|
+
runPattern(
|
|
7231
|
+
options.remote ? "enable-auth-remote" : "enable-auth",
|
|
7232
|
+
cmd.args,
|
|
7233
|
+
{},
|
|
7234
|
+
{
|
|
7235
|
+
summary: options.remote ? "Enabled authentication with remote functions." : "Enabled authentication.",
|
|
7236
|
+
nextSteps: [
|
|
7237
|
+
"Run `vela dev` and visit /login to try the new sign-in flow.",
|
|
7238
|
+
"Customize sign-in copy and providers in src/routes/(public)/(auth)/.",
|
|
7239
|
+
"Add OAuth providers in the PocketBase admin UI."
|
|
7240
|
+
],
|
|
7241
|
+
task: {
|
|
7242
|
+
title: "Enabling auth",
|
|
7243
|
+
success: "Enabled auth",
|
|
7244
|
+
error: "Failed to enable auth"
|
|
7245
|
+
}
|
|
7141
7246
|
}
|
|
7142
|
-
|
|
7247
|
+
)
|
|
7143
7248
|
),
|
|
7144
7249
|
"Failed to enable auth."
|
|
7145
7250
|
)
|
|
@@ -7147,7 +7252,7 @@ var auth = new Command13("auth").description("enable authentication (email/passw
|
|
|
7147
7252
|
|
|
7148
7253
|
// src/commands/enable/api.ts
|
|
7149
7254
|
import { Command as Command14 } from "commander";
|
|
7150
|
-
var api = new Command14("api").description("enable the PocketBase REST API").
|
|
7255
|
+
var api = new Command14("api").description("enable the PocketBase REST API").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7151
7256
|
(_opts, cmd) => runCommand(
|
|
7152
7257
|
() => runPattern(
|
|
7153
7258
|
"enable-api",
|
|
@@ -7173,7 +7278,7 @@ var api = new Command14("api").description("enable the PocketBase REST API").all
|
|
|
7173
7278
|
|
|
7174
7279
|
// src/commands/enable/api-keys.ts
|
|
7175
7280
|
import { Command as Command15 } from "commander";
|
|
7176
|
-
var apiKeys = new Command15("api-keys").description("enable API key management").
|
|
7281
|
+
var apiKeys = new Command15("api-keys").description("enable API key management").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7177
7282
|
(_opts, cmd) => runCommand(
|
|
7178
7283
|
() => runPattern(
|
|
7179
7284
|
"enable-api-keys",
|
|
@@ -7207,7 +7312,7 @@ var optionsSchema3 = v6.strictObject({
|
|
|
7207
7312
|
email: emailFlag,
|
|
7208
7313
|
password: passwordFlag
|
|
7209
7314
|
});
|
|
7210
|
-
var backend = new Command16("backend").description("enable the PocketBase backend").option("--email <email>", "email of the admin user").option("--password <password>", "password of the admin user").
|
|
7315
|
+
var backend = new Command16("backend").description("enable the PocketBase backend").option("--email <email>", "email of the admin user").option("--password <password>", "password of the admin user").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7211
7316
|
(rawOpts, cmd) => runCommand(async () => {
|
|
7212
7317
|
const options = parseOptions(optionsSchema3, rawOpts);
|
|
7213
7318
|
const { workspaceRootDir, features } = await getWorkspace();
|
|
@@ -7279,7 +7384,7 @@ async function resolveCredentials(options) {
|
|
|
7279
7384
|
|
|
7280
7385
|
// src/commands/enable/i18n.ts
|
|
7281
7386
|
import { Command as Command17 } from "commander";
|
|
7282
|
-
var i18n = new Command17("i18n").description("enable internationalization").
|
|
7387
|
+
var i18n = new Command17("i18n").description("enable internationalization").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7283
7388
|
(_opts, cmd) => runCommand(
|
|
7284
7389
|
() => runPattern(
|
|
7285
7390
|
"enable-i18n",
|
|
@@ -7305,7 +7410,7 @@ var i18n = new Command17("i18n").description("enable internationalization").allo
|
|
|
7305
7410
|
|
|
7306
7411
|
// src/commands/enable/teams.ts
|
|
7307
7412
|
import { Command as Command18 } from "commander";
|
|
7308
|
-
var teams = new Command18("teams").description("enable team / multi-tenant support").
|
|
7413
|
+
var teams = new Command18("teams").description("enable team / multi-tenant support").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7309
7414
|
(_opts, cmd) => runCommand(
|
|
7310
7415
|
() => runPattern(
|
|
7311
7416
|
"enable-teams",
|
|
@@ -7334,7 +7439,7 @@ import process18 from "node:process";
|
|
|
7334
7439
|
import { Command as Command19 } from "commander";
|
|
7335
7440
|
import * as p21 from "@clack/prompts";
|
|
7336
7441
|
var PROVIDERS = [{ value: "stripe", label: "Stripe" }];
|
|
7337
|
-
var payments = new Command19("payments").description("enable payments").option("--provider <provider>", "payment provider", "stripe").
|
|
7442
|
+
var payments = new Command19("payments").description("enable payments").option("--provider <provider>", "payment provider", "stripe").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7338
7443
|
(opts, cmd) => runCommand(async () => {
|
|
7339
7444
|
const provider = await resolveProvider2(opts.provider, cmd.getOptionValueSource("provider"));
|
|
7340
7445
|
const input = {
|
|
@@ -7432,7 +7537,7 @@ async function promptPassword(message) {
|
|
|
7432
7537
|
|
|
7433
7538
|
// src/commands/enable/subscriptions.ts
|
|
7434
7539
|
import { Command as Command20 } from "commander";
|
|
7435
|
-
var subscriptions = new Command20("subscriptions").description("enable Stripe subscriptions (requires auth and payments)").
|
|
7540
|
+
var subscriptions = new Command20("subscriptions").description("enable Stripe subscriptions (requires auth and payments)").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7436
7541
|
(_opts, cmd) => runCommand(
|
|
7437
7542
|
() => runPattern(
|
|
7438
7543
|
"enable-subscriptions",
|
|
@@ -7458,7 +7563,7 @@ var subscriptions = new Command20("subscriptions").description("enable Stripe su
|
|
|
7458
7563
|
|
|
7459
7564
|
// src/commands/enable/notifications.ts
|
|
7460
7565
|
import { Command as Command21 } from "commander";
|
|
7461
|
-
var notifications = new Command21("notifications").description("enable in-app notifications with a bell dropdown (requires auth)").
|
|
7566
|
+
var notifications = new Command21("notifications").description("enable in-app notifications with a bell dropdown (requires auth)").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7462
7567
|
(_opts, cmd) => runCommand(
|
|
7463
7568
|
() => runPattern(
|
|
7464
7569
|
"enable-notifications",
|
|
@@ -7498,15 +7603,14 @@ function resolveCmsBackend(facts) {
|
|
|
7498
7603
|
function adapterOf(root) {
|
|
7499
7604
|
try {
|
|
7500
7605
|
return detectAdapter(root).kind;
|
|
7501
|
-
} catch
|
|
7502
|
-
if (e instanceof AdapterError && e.snippet === KIT3_MIGRATE_COMMAND) throw e;
|
|
7606
|
+
} catch {
|
|
7503
7607
|
return "none";
|
|
7504
7608
|
}
|
|
7505
7609
|
}
|
|
7506
7610
|
var cms = new Command22("cms").description("enable an inline-editing CMS with an admin bar").option(
|
|
7507
7611
|
"--endpoint <url>",
|
|
7508
7612
|
"read from a hosted CMS at this URL instead of installing the backend in this app"
|
|
7509
|
-
).
|
|
7613
|
+
).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7510
7614
|
(opts, cmd) => runCommand(async () => {
|
|
7511
7615
|
const root = findWorkspaceRoot() ?? process19.cwd();
|
|
7512
7616
|
assertKit3(root, "vela enable cms");
|
|
@@ -7553,7 +7657,7 @@ Any one of these gives it one:
|
|
|
7553
7657
|
|
|
7554
7658
|
// src/commands/enable/blog.ts
|
|
7555
7659
|
import { Command as Command23 } from "commander";
|
|
7556
|
-
var blog = new Command23("blog").description("enable an mdsvex blog with posts, tags, and RSS").
|
|
7660
|
+
var blog = new Command23("blog").description("enable an mdsvex blog with posts, tags, and RSS").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7557
7661
|
(_opts, cmd) => runCommand(
|
|
7558
7662
|
() => runPattern(
|
|
7559
7663
|
"enable-blog",
|
|
@@ -7580,7 +7684,7 @@ var blog = new Command23("blog").description("enable an mdsvex blog with posts,
|
|
|
7580
7684
|
// src/commands/enable/content-negotiation.ts
|
|
7581
7685
|
import process20 from "node:process";
|
|
7582
7686
|
import { Command as Command24 } from "commander";
|
|
7583
|
-
var contentNegotiation = new Command24("content-negotiation").description("enable content negotiation (sveltekit-negotiate)").
|
|
7687
|
+
var contentNegotiation = new Command24("content-negotiation").description("enable content negotiation (sveltekit-negotiate)").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7584
7688
|
(_opts, cmd) => runCommand(
|
|
7585
7689
|
() => runPattern(
|
|
7586
7690
|
"enable-content-negotiation",
|
|
@@ -7607,7 +7711,7 @@ var contentNegotiation = new Command24("content-negotiation").description("enabl
|
|
|
7607
7711
|
|
|
7608
7712
|
// src/commands/enable/workflows.ts
|
|
7609
7713
|
import { Command as Command25 } from "commander";
|
|
7610
|
-
var workflows = new Command25("workflows").description("add background workflows to a project created before they were built in").
|
|
7714
|
+
var workflows = new Command25("workflows").description("add background workflows to a project created before they were built in").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7611
7715
|
(_opts, cmd) => runCommand(
|
|
7612
7716
|
() => runPattern(
|
|
7613
7717
|
"enable-workflows",
|
|
@@ -7631,14 +7735,40 @@ var workflows = new Command25("workflows").description("add background workflows
|
|
|
7631
7735
|
)
|
|
7632
7736
|
);
|
|
7633
7737
|
|
|
7738
|
+
// src/commands/enable/whatsapp.ts
|
|
7739
|
+
import { Command as Command26 } from "commander";
|
|
7740
|
+
var whatsapp = new Command26("whatsapp").description("enable WhatsApp sign-in on the login and signup pages (requires auth)").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7741
|
+
(_opts, cmd) => runCommand(
|
|
7742
|
+
() => runPattern(
|
|
7743
|
+
"enable-whatsapp",
|
|
7744
|
+
cmd.args,
|
|
7745
|
+
{},
|
|
7746
|
+
{
|
|
7747
|
+
summary: "Enabled WhatsApp sign-in. Email is optional on users now.",
|
|
7748
|
+
nextSteps: [
|
|
7749
|
+
"Run `vela dev` and sign up with a phone number on /signup: the code shows in the PocketBase logs.",
|
|
7750
|
+
// `vela env set` takes one key and prompts for its value.
|
|
7751
|
+
"Before deploying, set a sender: `vela env set VELASTACK_API_KEY` for the VelaStack relay, or `vela env set` each of WHATSAPP_PHONE_NUMBER_ID, WHATSAPP_ACCESS_TOKEN and WHATSAPP_TEMPLATE_NAME for the WhatsApp Cloud API."
|
|
7752
|
+
],
|
|
7753
|
+
task: {
|
|
7754
|
+
title: "Enabling WhatsApp sign-in",
|
|
7755
|
+
success: "Enabled WhatsApp sign-in",
|
|
7756
|
+
error: "Failed to enable WhatsApp sign-in"
|
|
7757
|
+
}
|
|
7758
|
+
}
|
|
7759
|
+
),
|
|
7760
|
+
"Failed to enable WhatsApp sign-in."
|
|
7761
|
+
)
|
|
7762
|
+
);
|
|
7763
|
+
|
|
7634
7764
|
// src/commands/enable.ts
|
|
7635
|
-
var enable = new
|
|
7765
|
+
var enable = new Command27("enable").description("enable features").configureHelp(helpConfig).addCommand(ai).addCommand(analytics).addCommand(auth).addCommand(api).addCommand(apiKeys).addCommand(backend).addCommand(contentNegotiation).addCommand(i18n).addCommand(teams).addCommand(payments).addCommand(subscriptions).addCommand(notifications).addCommand(cms).addCommand(blog).addCommand(workflows).addCommand(whatsapp);
|
|
7636
7766
|
|
|
7637
7767
|
// src/commands/disable.ts
|
|
7638
|
-
import { Command as
|
|
7768
|
+
import { Command as Command41 } from "commander";
|
|
7639
7769
|
|
|
7640
7770
|
// src/commands/disable/ai.ts
|
|
7641
|
-
import { Command as
|
|
7771
|
+
import { Command as Command28 } from "commander";
|
|
7642
7772
|
|
|
7643
7773
|
// src/commands/disable/_shared.ts
|
|
7644
7774
|
import process21 from "node:process";
|
|
@@ -7658,7 +7788,7 @@ async function runDisable(opts, flags, cmdArgs) {
|
|
|
7658
7788
|
}
|
|
7659
7789
|
|
|
7660
7790
|
// src/commands/disable/ai.ts
|
|
7661
|
-
var ai2 = new
|
|
7791
|
+
var ai2 = new Command28("ai").description("disable AI chat").option("-y, --yes", "skip confirmation prompt").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7662
7792
|
(opts, cmd) => runCommand(
|
|
7663
7793
|
() => runDisable(
|
|
7664
7794
|
{
|
|
@@ -7684,8 +7814,8 @@ var ai2 = new Command27("ai").description("disable AI chat").option("-y, --yes",
|
|
|
7684
7814
|
);
|
|
7685
7815
|
|
|
7686
7816
|
// src/commands/disable/analytics.ts
|
|
7687
|
-
import { Command as
|
|
7688
|
-
var analytics2 = new
|
|
7817
|
+
import { Command as Command29 } from "commander";
|
|
7818
|
+
var analytics2 = new Command29("analytics").description("disable web analytics").option("-y, --yes", "skip confirmation prompt").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7689
7819
|
(opts, cmd) => runCommand(
|
|
7690
7820
|
() => runDisable(
|
|
7691
7821
|
{
|
|
@@ -7711,8 +7841,8 @@ var analytics2 = new Command28("analytics").description("disable web analytics")
|
|
|
7711
7841
|
);
|
|
7712
7842
|
|
|
7713
7843
|
// src/commands/disable/auth.ts
|
|
7714
|
-
import { Command as
|
|
7715
|
-
var auth2 = new
|
|
7844
|
+
import { Command as Command30 } from "commander";
|
|
7845
|
+
var auth2 = new Command30("auth").description("disable authentication").option("-y, --yes", "skip confirmation prompt").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7716
7846
|
(opts, cmd) => runCommand(
|
|
7717
7847
|
() => runDisable(
|
|
7718
7848
|
{
|
|
@@ -7738,8 +7868,8 @@ var auth2 = new Command29("auth").description("disable authentication").option("
|
|
|
7738
7868
|
);
|
|
7739
7869
|
|
|
7740
7870
|
// src/commands/disable/api.ts
|
|
7741
|
-
import { Command as
|
|
7742
|
-
var api2 = new
|
|
7871
|
+
import { Command as Command31 } from "commander";
|
|
7872
|
+
var api2 = new Command31("api").description("disable the REST API").option("-y, --yes", "skip confirmation prompt").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7743
7873
|
(opts, cmd) => runCommand(
|
|
7744
7874
|
() => runDisable(
|
|
7745
7875
|
{
|
|
@@ -7762,8 +7892,8 @@ var api2 = new Command30("api").description("disable the REST API").option("-y,
|
|
|
7762
7892
|
);
|
|
7763
7893
|
|
|
7764
7894
|
// src/commands/disable/api-keys.ts
|
|
7765
|
-
import { Command as
|
|
7766
|
-
var apiKeys2 = new
|
|
7895
|
+
import { Command as Command32 } from "commander";
|
|
7896
|
+
var apiKeys2 = new Command32("api-keys").description("disable API key management").option("-y, --yes", "skip confirmation prompt").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7767
7897
|
(opts, cmd) => runCommand(
|
|
7768
7898
|
() => runDisable(
|
|
7769
7899
|
{
|
|
@@ -7786,8 +7916,8 @@ var apiKeys2 = new Command31("api-keys").description("disable API key management
|
|
|
7786
7916
|
);
|
|
7787
7917
|
|
|
7788
7918
|
// src/commands/disable/backend.ts
|
|
7789
|
-
import { Command as
|
|
7790
|
-
var backend2 = new
|
|
7919
|
+
import { Command as Command33 } from "commander";
|
|
7920
|
+
var backend2 = new Command33("backend").description("disable the PocketBase backend").option("-y, --yes", "skip confirmation prompt").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7791
7921
|
(opts, cmd) => runCommand(
|
|
7792
7922
|
() => runDisable(
|
|
7793
7923
|
{
|
|
@@ -7810,8 +7940,8 @@ var backend2 = new Command32("backend").description("disable the PocketBase back
|
|
|
7810
7940
|
);
|
|
7811
7941
|
|
|
7812
7942
|
// src/commands/disable/content-negotiation.ts
|
|
7813
|
-
import { Command as
|
|
7814
|
-
var contentNegotiation2 = new
|
|
7943
|
+
import { Command as Command34 } from "commander";
|
|
7944
|
+
var contentNegotiation2 = new Command34("content-negotiation").description("disable content negotiation").option("-y, --yes", "skip confirmation prompt").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7815
7945
|
(opts, cmd) => runCommand(
|
|
7816
7946
|
() => runDisable(
|
|
7817
7947
|
{
|
|
@@ -7834,8 +7964,8 @@ var contentNegotiation2 = new Command33("content-negotiation").description("disa
|
|
|
7834
7964
|
);
|
|
7835
7965
|
|
|
7836
7966
|
// src/commands/disable/i18n.ts
|
|
7837
|
-
import { Command as
|
|
7838
|
-
var i18n2 = new
|
|
7967
|
+
import { Command as Command35 } from "commander";
|
|
7968
|
+
var i18n2 = new Command35("i18n").description("disable internationalization").option("-y, --yes", "skip confirmation prompt").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7839
7969
|
(opts, cmd) => runCommand(
|
|
7840
7970
|
() => runDisable(
|
|
7841
7971
|
{
|
|
@@ -7859,8 +7989,8 @@ var i18n2 = new Command34("i18n").description("disable internationalization").op
|
|
|
7859
7989
|
);
|
|
7860
7990
|
|
|
7861
7991
|
// src/commands/disable/notifications.ts
|
|
7862
|
-
import { Command as
|
|
7863
|
-
var notifications2 = new
|
|
7992
|
+
import { Command as Command36 } from "commander";
|
|
7993
|
+
var notifications2 = new Command36("notifications").description("disable in-app notifications").option("-y, --yes", "skip confirmation prompt").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7864
7994
|
(opts, cmd) => runCommand(
|
|
7865
7995
|
() => runDisable(
|
|
7866
7996
|
{
|
|
@@ -7886,8 +8016,8 @@ var notifications2 = new Command35("notifications").description("disable in-app
|
|
|
7886
8016
|
);
|
|
7887
8017
|
|
|
7888
8018
|
// src/commands/disable/teams.ts
|
|
7889
|
-
import { Command as
|
|
7890
|
-
var teams2 = new
|
|
8019
|
+
import { Command as Command37 } from "commander";
|
|
8020
|
+
var teams2 = new Command37("teams").description("disable teams").option("-y, --yes", "skip confirmation prompt").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7891
8021
|
(opts, cmd) => runCommand(
|
|
7892
8022
|
() => runDisable(
|
|
7893
8023
|
{
|
|
@@ -7910,8 +8040,8 @@ var teams2 = new Command36("teams").description("disable teams").option("-y, --y
|
|
|
7910
8040
|
);
|
|
7911
8041
|
|
|
7912
8042
|
// src/commands/disable/payments.ts
|
|
7913
|
-
import { Command as
|
|
7914
|
-
var payments2 = new
|
|
8043
|
+
import { Command as Command38 } from "commander";
|
|
8044
|
+
var payments2 = new Command38("payments").description("disable payments").option("-y, --yes", "skip confirmation prompt").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7915
8045
|
(opts, cmd) => runCommand(
|
|
7916
8046
|
() => runDisable(
|
|
7917
8047
|
{
|
|
@@ -7938,8 +8068,8 @@ var payments2 = new Command37("payments").description("disable payments").option
|
|
|
7938
8068
|
);
|
|
7939
8069
|
|
|
7940
8070
|
// src/commands/disable/subscriptions.ts
|
|
7941
|
-
import { Command as
|
|
7942
|
-
var subscriptions2 = new
|
|
8071
|
+
import { Command as Command39 } from "commander";
|
|
8072
|
+
var subscriptions2 = new Command39("subscriptions").description("disable Stripe subscriptions").option("-y, --yes", "skip confirmation prompt").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7943
8073
|
(opts, cmd) => runCommand(
|
|
7944
8074
|
() => runDisable(
|
|
7945
8075
|
{
|
|
@@ -7965,14 +8095,43 @@ var subscriptions2 = new Command38("subscriptions").description("disable Stripe
|
|
|
7965
8095
|
)
|
|
7966
8096
|
);
|
|
7967
8097
|
|
|
8098
|
+
// src/commands/disable/whatsapp.ts
|
|
8099
|
+
import { Command as Command40 } from "commander";
|
|
8100
|
+
var whatsapp2 = new Command40("whatsapp").description("disable WhatsApp sign-in").option("-y, --yes", "skip confirmation prompt").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
8101
|
+
(opts, cmd) => runCommand(
|
|
8102
|
+
() => runDisable(
|
|
8103
|
+
{
|
|
8104
|
+
slug: "disable-whatsapp",
|
|
8105
|
+
confirmMessage: "Disable WhatsApp sign-in? Turns it off in PocketBase, removes the code page and puts the stock login and signup pages back. The phone fields on users and the optional email stay, since they hold user data.",
|
|
8106
|
+
report: {
|
|
8107
|
+
summary: "Disabled WhatsApp sign-in.",
|
|
8108
|
+
nextSteps: [
|
|
8109
|
+
"Users who signed up with a phone number can no longer log in until they have an email and password.",
|
|
8110
|
+
"The phone and phoneVerified fields stay on users, and email stays optional; remove them in the PocketBase dashboard if you no longer need them.",
|
|
8111
|
+
"The sender variables stay on your deploy targets: remove the WHATSAPP_* ones with `vela env unset`, and VELASTACK_API_KEY too if nothing else uses it."
|
|
8112
|
+
],
|
|
8113
|
+
task: {
|
|
8114
|
+
title: "Disabling WhatsApp sign-in",
|
|
8115
|
+
success: "Disabled WhatsApp sign-in",
|
|
8116
|
+
error: "Failed to disable WhatsApp sign-in"
|
|
8117
|
+
}
|
|
8118
|
+
}
|
|
8119
|
+
},
|
|
8120
|
+
opts,
|
|
8121
|
+
cmd.args
|
|
8122
|
+
),
|
|
8123
|
+
"Failed to disable WhatsApp sign-in."
|
|
8124
|
+
)
|
|
8125
|
+
);
|
|
8126
|
+
|
|
7968
8127
|
// src/commands/disable.ts
|
|
7969
|
-
var disable = new
|
|
8128
|
+
var disable = new Command41("disable").description("disable features").configureHelp(helpConfig).addCommand(ai2).addCommand(analytics2).addCommand(auth2).addCommand(api2).addCommand(apiKeys2).addCommand(backend2).addCommand(contentNegotiation2).addCommand(i18n2).addCommand(notifications2).addCommand(teams2).addCommand(payments2).addCommand(subscriptions2).addCommand(whatsapp2);
|
|
7970
8129
|
|
|
7971
8130
|
// src/commands/destroy.ts
|
|
7972
|
-
import { Command as
|
|
8131
|
+
import { Command as Command47 } from "commander";
|
|
7973
8132
|
|
|
7974
8133
|
// src/commands/destroy/form.ts
|
|
7975
|
-
import { Command as
|
|
8134
|
+
import { Command as Command42 } from "commander";
|
|
7976
8135
|
|
|
7977
8136
|
// src/commands/destroy/_shared.ts
|
|
7978
8137
|
import process22 from "node:process";
|
|
@@ -7989,10 +8148,10 @@ async function runDestroy(slug2, model, confirmMessage, report5, flags) {
|
|
|
7989
8148
|
}
|
|
7990
8149
|
|
|
7991
8150
|
// src/commands/destroy/form.ts
|
|
7992
|
-
var form2 = new
|
|
8151
|
+
var form2 = new Command42("form").description("destroy a form generated by `vela generate form`").argument("<model>", "model name used when the form was generated (e.g., contact, login)").option("-y, --yes", "skip confirmation prompt").option(
|
|
7993
8152
|
"--route <route>",
|
|
7994
8153
|
"custom route the form was generated at (must match the --route used at generation)"
|
|
7995
|
-
).
|
|
8154
|
+
).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
7996
8155
|
(model, opts) => runCommand(
|
|
7997
8156
|
() => runDestroy(
|
|
7998
8157
|
"destroy-form",
|
|
@@ -8013,8 +8172,8 @@ var form2 = new Command40("form").description("destroy a form generated by `vela
|
|
|
8013
8172
|
);
|
|
8014
8173
|
|
|
8015
8174
|
// src/commands/destroy/schema.ts
|
|
8016
|
-
import { Command as
|
|
8017
|
-
var schema2 = new
|
|
8175
|
+
import { Command as Command43 } from "commander";
|
|
8176
|
+
var schema2 = new Command43("schema").description("destroy a zod schema generated by `vela generate schema`").argument("<model>", "schema model name (e.g., contact, login)").option("-y, --yes", "skip confirmation prompt").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
8018
8177
|
(model, opts) => runCommand(
|
|
8019
8178
|
() => runDestroy(
|
|
8020
8179
|
"destroy-schema",
|
|
@@ -8035,8 +8194,8 @@ var schema2 = new Command41("schema").description("destroy a zod schema generate
|
|
|
8035
8194
|
);
|
|
8036
8195
|
|
|
8037
8196
|
// src/commands/destroy/resource.ts
|
|
8038
|
-
import { Command as
|
|
8039
|
-
var resource2 = new
|
|
8197
|
+
import { Command as Command44 } from "commander";
|
|
8198
|
+
var resource2 = new Command44("resource").description("destroy a resource generated by `vela generate resource`").argument("<model>", "model path used when the resource was generated (e.g., contacts, articles)").option("-y, --yes", "skip confirmation prompt").allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
8040
8199
|
(model, opts) => runCommand(
|
|
8041
8200
|
() => runDestroy(
|
|
8042
8201
|
"destroy-resource",
|
|
@@ -8057,11 +8216,11 @@ var resource2 = new Command42("resource").description("destroy a resource genera
|
|
|
8057
8216
|
);
|
|
8058
8217
|
|
|
8059
8218
|
// src/commands/destroy/scaffold.ts
|
|
8060
|
-
import { Command as
|
|
8061
|
-
var scaffold2 = new
|
|
8219
|
+
import { Command as Command45 } from "commander";
|
|
8220
|
+
var scaffold2 = new Command45("scaffold").description("destroy a scaffold generated by `vela generate scaffold`").argument("<model>", "model name used when the scaffold was generated (e.g., contact, todo)").option("-y, --yes", "skip confirmation prompt").option(
|
|
8062
8221
|
"--route <route>",
|
|
8063
8222
|
"custom route the scaffold was generated at (must match the --route used at generation)"
|
|
8064
|
-
).
|
|
8223
|
+
).allowExcessArguments(true).configureHelp(helpConfig).action(
|
|
8065
8224
|
(model, opts) => runCommand(
|
|
8066
8225
|
() => runDestroy(
|
|
8067
8226
|
"destroy-scaffold",
|
|
@@ -8086,7 +8245,7 @@ var scaffold2 = new Command43("scaffold").description("destroy a scaffold genera
|
|
|
8086
8245
|
|
|
8087
8246
|
// src/commands/destroy/deployment.ts
|
|
8088
8247
|
import process26 from "node:process";
|
|
8089
|
-
import { Command as
|
|
8248
|
+
import { Command as Command46 } from "commander";
|
|
8090
8249
|
import * as p28 from "@clack/prompts";
|
|
8091
8250
|
import pc11 from "picocolors";
|
|
8092
8251
|
|
|
@@ -8097,7 +8256,7 @@ import * as p25 from "@clack/prompts";
|
|
|
8097
8256
|
import pc8 from "picocolors";
|
|
8098
8257
|
|
|
8099
8258
|
// src/lib/deploy-config.ts
|
|
8100
|
-
import
|
|
8259
|
+
import fs34 from "node:fs";
|
|
8101
8260
|
import path34 from "node:path";
|
|
8102
8261
|
import crypto2 from "node:crypto";
|
|
8103
8262
|
function projectFilePath(workspaceRootDir) {
|
|
@@ -8105,17 +8264,17 @@ function projectFilePath(workspaceRootDir) {
|
|
|
8105
8264
|
}
|
|
8106
8265
|
function readProjectFile(workspaceRootDir) {
|
|
8107
8266
|
const file = projectFilePath(workspaceRootDir);
|
|
8108
|
-
if (!
|
|
8267
|
+
if (!fs34.existsSync(file)) return {};
|
|
8109
8268
|
try {
|
|
8110
|
-
return JSON.parse(
|
|
8269
|
+
return JSON.parse(fs34.readFileSync(file, "utf8"));
|
|
8111
8270
|
} catch {
|
|
8112
8271
|
return {};
|
|
8113
8272
|
}
|
|
8114
8273
|
}
|
|
8115
8274
|
function writeProjectFile(workspaceRootDir, data) {
|
|
8116
8275
|
const file = projectFilePath(workspaceRootDir);
|
|
8117
|
-
|
|
8118
|
-
|
|
8276
|
+
fs34.mkdirSync(path34.dirname(file), { recursive: true });
|
|
8277
|
+
fs34.writeFileSync(file, JSON.stringify(data, null, 2) + "\n");
|
|
8119
8278
|
}
|
|
8120
8279
|
function resolveAppIdentity(workspaceRootDir, projectName) {
|
|
8121
8280
|
const project = readProjectFile(workspaceRootDir);
|
|
@@ -8215,13 +8374,13 @@ function randomSuffix() {
|
|
|
8215
8374
|
}
|
|
8216
8375
|
|
|
8217
8376
|
// src/lib/artifact.ts
|
|
8218
|
-
import
|
|
8377
|
+
import fs36 from "node:fs";
|
|
8219
8378
|
import path36 from "node:path";
|
|
8220
8379
|
import { detect as detect6 } from "package-manager-detector";
|
|
8221
8380
|
import { resolveCommand as resolveCommand4 } from "package-manager-detector/commands";
|
|
8222
8381
|
|
|
8223
8382
|
// src/lib/ssh.ts
|
|
8224
|
-
import
|
|
8383
|
+
import fs35 from "node:fs";
|
|
8225
8384
|
import os5 from "node:os";
|
|
8226
8385
|
import path35 from "node:path";
|
|
8227
8386
|
import crypto4 from "node:crypto";
|
|
@@ -8267,7 +8426,7 @@ var SshSession = class {
|
|
|
8267
8426
|
async open() {
|
|
8268
8427
|
if (this.controlPath) return;
|
|
8269
8428
|
const dir = path35.join(os5.tmpdir(), "vela-ssh");
|
|
8270
|
-
|
|
8429
|
+
fs35.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
8271
8430
|
const socket = path35.join(dir, `${crypto4.randomBytes(6).toString("hex")}.sock`);
|
|
8272
8431
|
this.controlPath = socket;
|
|
8273
8432
|
const args = [
|
|
@@ -8559,10 +8718,10 @@ function collectArtifact(cwd) {
|
|
|
8559
8718
|
const entries = [];
|
|
8560
8719
|
const add2 = (rel, remoteDir = "") => {
|
|
8561
8720
|
const localPath = path36.join(cwd, rel);
|
|
8562
|
-
if (
|
|
8721
|
+
if (fs36.existsSync(localPath)) entries.push({ localPath, remoteDir });
|
|
8563
8722
|
};
|
|
8564
8723
|
const buildPath = path36.join(cwd, outputDir);
|
|
8565
|
-
if (!
|
|
8724
|
+
if (!fs36.existsSync(path36.join(buildPath, "index.js"))) {
|
|
8566
8725
|
throw new BuildError(
|
|
8567
8726
|
`No ${outputDir}/index.js to deploy.
|
|
8568
8727
|
|
|
@@ -8576,17 +8735,17 @@ build ran with it as the adapter, then deploy again.`
|
|
|
8576
8735
|
add2(".npmrc");
|
|
8577
8736
|
add2(MIGRATIONS_DIR);
|
|
8578
8737
|
const hooks = path36.join(cwd, DATA_DIR, "hooks");
|
|
8579
|
-
if (
|
|
8738
|
+
if (fs36.existsSync(hooks)) entries.push({ localPath: hooks, remoteDir: "hooks" });
|
|
8580
8739
|
return entries;
|
|
8581
8740
|
}
|
|
8582
8741
|
var NPM_LOCKFILE = "package-lock.json";
|
|
8583
8742
|
var FOREIGN_LOCKFILES = ["pnpm-lock.yaml", "yarn.lock", "bun.lock", "bun.lockb"];
|
|
8584
8743
|
function hasLockfile(cwd) {
|
|
8585
|
-
return
|
|
8744
|
+
return fs36.existsSync(path36.join(cwd, NPM_LOCKFILE));
|
|
8586
8745
|
}
|
|
8587
8746
|
function foreignLockfile(cwd) {
|
|
8588
8747
|
if (hasLockfile(cwd)) return void 0;
|
|
8589
|
-
return FOREIGN_LOCKFILES.find((name) =>
|
|
8748
|
+
return FOREIGN_LOCKFILES.find((name) => fs36.existsSync(path36.join(cwd, name)));
|
|
8590
8749
|
}
|
|
8591
8750
|
async function gitSha(cwd) {
|
|
8592
8751
|
const result = await spawnCapture("git", ["rev-parse", "HEAD"], { cwd });
|
|
@@ -8625,7 +8784,7 @@ function sshOptionsFrom(options) {
|
|
|
8625
8784
|
|
|
8626
8785
|
// src/lib/remote.ts
|
|
8627
8786
|
import crypto5 from "node:crypto";
|
|
8628
|
-
import
|
|
8787
|
+
import fs37 from "node:fs";
|
|
8629
8788
|
import path37 from "node:path";
|
|
8630
8789
|
import process24 from "node:process";
|
|
8631
8790
|
var VELA_ROOT = "/var/lib/vela";
|
|
@@ -8645,13 +8804,13 @@ var DIGEST_LENGTH = 12;
|
|
|
8645
8804
|
function serverScriptsDigest(dir = serverTemplatesDir()) {
|
|
8646
8805
|
const hash = crypto5.createHash("sha256");
|
|
8647
8806
|
for (const file of listFiles(dir).sort()) {
|
|
8648
|
-
hash.update(file).update("\0").update(
|
|
8807
|
+
hash.update(file).update("\0").update(fs37.readFileSync(path37.join(dir, file))).update("\0");
|
|
8649
8808
|
}
|
|
8650
8809
|
return hash.digest("hex").slice(0, DIGEST_LENGTH);
|
|
8651
8810
|
}
|
|
8652
8811
|
function listFiles(root, prefix = "") {
|
|
8653
8812
|
const files = [];
|
|
8654
|
-
for (const entry of
|
|
8813
|
+
for (const entry of fs37.readdirSync(path37.join(root, prefix), { withFileTypes: true })) {
|
|
8655
8814
|
const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
8656
8815
|
if (entry.isDirectory()) files.push(...listFiles(root, rel));
|
|
8657
8816
|
else if (entry.isFile()) files.push(rel);
|
|
@@ -8778,7 +8937,7 @@ var remotePaths = {
|
|
|
8778
8937
|
};
|
|
8779
8938
|
|
|
8780
8939
|
// src/lib/remote-env.ts
|
|
8781
|
-
import
|
|
8940
|
+
import fs38 from "node:fs";
|
|
8782
8941
|
import dotenv from "dotenv";
|
|
8783
8942
|
var KEY_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
8784
8943
|
function isValidKey(key) {
|
|
@@ -8826,7 +8985,7 @@ function quote(value) {
|
|
|
8826
8985
|
return `"${escaped}"`;
|
|
8827
8986
|
}
|
|
8828
8987
|
function readLocalEnvFile(file) {
|
|
8829
|
-
const parsed = dotenv.parse(
|
|
8988
|
+
const parsed = dotenv.parse(fs38.readFileSync(file));
|
|
8830
8989
|
const result = {};
|
|
8831
8990
|
for (const [key, value] of Object.entries(parsed)) {
|
|
8832
8991
|
if (isValidKey(key)) result[key] = value;
|
|
@@ -9309,7 +9468,7 @@ ${pc10.dim(err instanceof Error ? err.message : String(err))}`
|
|
|
9309
9468
|
// src/commands/destroy/deployment.ts
|
|
9310
9469
|
var deployment = addLockWaitOption(
|
|
9311
9470
|
addTargetOptions(
|
|
9312
|
-
new
|
|
9471
|
+
new Command46("deployment").description("remove a deployed environment from its server").configureHelp(helpConfig),
|
|
9313
9472
|
"production"
|
|
9314
9473
|
)
|
|
9315
9474
|
).option("--purge", "also delete the database and uploaded files").option("-y, --yes", "skip the confirmation prompt").option(
|
|
@@ -9393,13 +9552,13 @@ async function confirm6(appName, targetName, byName) {
|
|
|
9393
9552
|
}
|
|
9394
9553
|
|
|
9395
9554
|
// src/commands/destroy.ts
|
|
9396
|
-
var destroy = new
|
|
9555
|
+
var destroy = new Command47("destroy").description("destroy scaffolding, or a deployment").configureHelp(helpConfig).addCommand(form2).addCommand(schema2).addCommand(resource2).addCommand(scaffold2).addCommand(deployment);
|
|
9397
9556
|
|
|
9398
9557
|
// src/commands/ui.ts
|
|
9399
|
-
import { Command as
|
|
9558
|
+
import { Command as Command53 } from "commander";
|
|
9400
9559
|
|
|
9401
9560
|
// src/commands/ui/add.ts
|
|
9402
|
-
import { Command as
|
|
9561
|
+
import { Command as Command48 } from "commander";
|
|
9403
9562
|
import * as p29 from "@clack/prompts";
|
|
9404
9563
|
import { installComponents } from "@velastack/patterns";
|
|
9405
9564
|
|
|
@@ -9449,7 +9608,7 @@ function uiAddReport(requested, outcome) {
|
|
|
9449
9608
|
}
|
|
9450
9609
|
|
|
9451
9610
|
// src/commands/ui/add.ts
|
|
9452
|
-
var add = new
|
|
9611
|
+
var add = new Command48("add").description("add ui components (shadcn-svelte items and vela components such as data-table)").argument("<components...>", "the components to add").option("--overwrite", "replace components that already exist", false).configureHelp(helpConfig).action(
|
|
9453
9612
|
(components, options) => runCommand(async () => {
|
|
9454
9613
|
const { workspaceRootDir } = await getWorkspace();
|
|
9455
9614
|
assertShadcn("vela ui add", workspaceRootDir);
|
|
@@ -9472,10 +9631,10 @@ var add = new Command46("add").description("add ui components (shadcn-svelte ite
|
|
|
9472
9631
|
);
|
|
9473
9632
|
|
|
9474
9633
|
// src/commands/ui/base.ts
|
|
9475
|
-
import { Command as
|
|
9634
|
+
import { Command as Command49 } from "commander";
|
|
9476
9635
|
import * as p30 from "@clack/prompts";
|
|
9477
9636
|
import { applyBaseColor } from "@velastack/patterns";
|
|
9478
|
-
var base = new
|
|
9637
|
+
var base = new Command49("base").description("change the base (gray) palette").argument("<color>", `base color to use (${BASE_COLORS.join(", ")})`).configureHelp(helpConfig).action(
|
|
9479
9638
|
(color) => runCommand(async () => {
|
|
9480
9639
|
const { workspaceRootDir } = await getWorkspace();
|
|
9481
9640
|
assertShadcn("vela ui base", workspaceRootDir);
|
|
@@ -9501,7 +9660,7 @@ var base = new Command47("base").description("change the base (gray) palette").a
|
|
|
9501
9660
|
);
|
|
9502
9661
|
|
|
9503
9662
|
// src/commands/ui/list.ts
|
|
9504
|
-
import { Command as
|
|
9663
|
+
import { Command as Command50 } from "commander";
|
|
9505
9664
|
import * as p31 from "@clack/prompts";
|
|
9506
9665
|
import { listComponents } from "@velastack/patterns";
|
|
9507
9666
|
|
|
@@ -9533,7 +9692,7 @@ function uiListReport(result) {
|
|
|
9533
9692
|
}
|
|
9534
9693
|
|
|
9535
9694
|
// src/commands/ui/list.ts
|
|
9536
|
-
var list = new
|
|
9695
|
+
var list = new Command50("list").description("list installed ui components, vela components and the style registry").option("--json", "print the result as JSON", false).configureHelp(helpConfig).action(
|
|
9537
9696
|
(options) => runCommand(async () => {
|
|
9538
9697
|
const { workspaceRootDir } = await getWorkspace();
|
|
9539
9698
|
assertShadcn("vela ui list", workspaceRootDir);
|
|
@@ -9561,7 +9720,7 @@ Registry components are not listed.`);
|
|
|
9561
9720
|
);
|
|
9562
9721
|
|
|
9563
9722
|
// src/commands/ui/style.ts
|
|
9564
|
-
import { Command as
|
|
9723
|
+
import { Command as Command51 } from "commander";
|
|
9565
9724
|
import * as p32 from "@clack/prompts";
|
|
9566
9725
|
import { switchStyle } from "@velastack/patterns";
|
|
9567
9726
|
|
|
@@ -9588,7 +9747,7 @@ function uiStyleReport(result) {
|
|
|
9588
9747
|
}
|
|
9589
9748
|
|
|
9590
9749
|
// src/commands/ui/style.ts
|
|
9591
|
-
var style = new
|
|
9750
|
+
var style = new Command51("style").description("switch the shadcn-svelte style, re-adding its components").argument("<style>", `style to switch to (${STYLES.join(", ")})`).option("-y, --yes", "skip the confirmation prompt").option("--no-font", "keep the current font instead of applying the style's").configureHelp(helpConfig).action(
|
|
9592
9751
|
(name, options) => runCommand(async () => {
|
|
9593
9752
|
const { workspaceRootDir } = await getWorkspace();
|
|
9594
9753
|
assertShadcn("vela ui style", workspaceRootDir);
|
|
@@ -9642,10 +9801,10 @@ ${components.map((c) => `- ${c}`).join("\n")}`
|
|
|
9642
9801
|
);
|
|
9643
9802
|
|
|
9644
9803
|
// src/commands/ui/theme.ts
|
|
9645
|
-
import { Command as
|
|
9804
|
+
import { Command as Command52 } from "commander";
|
|
9646
9805
|
import * as p33 from "@clack/prompts";
|
|
9647
9806
|
import { applyTheme } from "@velastack/patterns";
|
|
9648
|
-
var theme = new
|
|
9807
|
+
var theme = new Command52("theme").description("change the accent color, keeping the base palette").argument("<accent>", `accent to use (${THEMES.join(", ")})`).configureHelp(helpConfig).action(
|
|
9649
9808
|
(accent) => runCommand(async () => {
|
|
9650
9809
|
const { workspaceRootDir } = await getWorkspace();
|
|
9651
9810
|
assertShadcn("vela ui theme", workspaceRootDir);
|
|
@@ -9671,19 +9830,19 @@ var theme = new Command50("theme").description("change the accent color, keeping
|
|
|
9671
9830
|
);
|
|
9672
9831
|
|
|
9673
9832
|
// src/commands/ui.ts
|
|
9674
|
-
var ui = new
|
|
9833
|
+
var ui = new Command53("ui").description("generate ui components").configureHelp(helpConfig).addCommand(add).addCommand(list).addCommand(style).addCommand(base).addCommand(theme);
|
|
9675
9834
|
|
|
9676
9835
|
// src/commands/legal.ts
|
|
9677
|
-
import { Command as
|
|
9836
|
+
import { Command as Command56 } from "commander";
|
|
9678
9837
|
|
|
9679
9838
|
// src/commands/legal/terms.ts
|
|
9680
9839
|
import path39 from "node:path";
|
|
9681
|
-
import { Command as
|
|
9840
|
+
import { Command as Command54 } from "commander";
|
|
9682
9841
|
import * as p35 from "@clack/prompts";
|
|
9683
9842
|
|
|
9684
9843
|
// src/commands/legal/shared.ts
|
|
9685
9844
|
import process27 from "node:process";
|
|
9686
|
-
import
|
|
9845
|
+
import fs39 from "node:fs";
|
|
9687
9846
|
import path38 from "node:path";
|
|
9688
9847
|
import * as p34 from "@clack/prompts";
|
|
9689
9848
|
function siteFields(site) {
|
|
@@ -9967,12 +10126,12 @@ function writeLegalPage(root, dir, page) {
|
|
|
9967
10126
|
${html}`;
|
|
9968
10127
|
}
|
|
9969
10128
|
const pagePath = path38.join(root, dir, "+page.svelte");
|
|
9970
|
-
|
|
9971
|
-
|
|
10129
|
+
fs39.mkdirSync(path38.dirname(pagePath), { recursive: true });
|
|
10130
|
+
fs39.writeFileSync(pagePath, html);
|
|
9972
10131
|
const written = [pagePath];
|
|
9973
10132
|
if (metaTags) {
|
|
9974
10133
|
const loaderPath = path38.join(root, dir, "+page.ts");
|
|
9975
|
-
|
|
10134
|
+
fs39.writeFileSync(loaderPath, pageMetaTagsLoader(page.title, page.description));
|
|
9976
10135
|
written.push(loaderPath);
|
|
9977
10136
|
}
|
|
9978
10137
|
return written.map((file) => path38.relative(root, file));
|
|
@@ -10389,11 +10548,11 @@ async function termsAction() {
|
|
|
10389
10548
|
]
|
|
10390
10549
|
});
|
|
10391
10550
|
}
|
|
10392
|
-
var terms = new
|
|
10551
|
+
var terms = new Command54("terms").description("generate placeholder terms and conditions").configureHelp(helpConfig).action(() => runCommand(termsAction, "Failed to generate terms and conditions."));
|
|
10393
10552
|
|
|
10394
10553
|
// src/commands/legal/privacy.ts
|
|
10395
10554
|
import path40 from "node:path";
|
|
10396
|
-
import { Command as
|
|
10555
|
+
import { Command as Command55 } from "commander";
|
|
10397
10556
|
import * as p36 from "@clack/prompts";
|
|
10398
10557
|
var mapLabels = {
|
|
10399
10558
|
personalInfo: {
|
|
@@ -11125,19 +11284,19 @@ async function privacyAction() {
|
|
|
11125
11284
|
]
|
|
11126
11285
|
});
|
|
11127
11286
|
}
|
|
11128
|
-
var privacy = new
|
|
11287
|
+
var privacy = new Command55("privacy").description("generate placeholder privacy policy").configureHelp(helpConfig).action(() => runCommand(privacyAction, "Failed to generate privacy policy."));
|
|
11129
11288
|
|
|
11130
11289
|
// src/commands/legal.ts
|
|
11131
|
-
var legal = new
|
|
11290
|
+
var legal = new Command56("legal").description("generate placeholder legal documents").configureHelp(helpConfig).addCommand(terms).addCommand(privacy);
|
|
11132
11291
|
|
|
11133
11292
|
// src/commands/fixtures.ts
|
|
11134
|
-
import { Command as
|
|
11293
|
+
import { Command as Command62 } from "commander";
|
|
11135
11294
|
|
|
11136
11295
|
// src/commands/fixtures/load.ts
|
|
11137
|
-
import { Command as
|
|
11296
|
+
import { Command as Command57 } from "commander";
|
|
11138
11297
|
|
|
11139
11298
|
// src/lib/data.ts
|
|
11140
|
-
import
|
|
11299
|
+
import fs40 from "node:fs";
|
|
11141
11300
|
import path41 from "node:path";
|
|
11142
11301
|
import { ClientResponseError } from "pocketbase";
|
|
11143
11302
|
|
|
@@ -11179,8 +11338,8 @@ function dataDir(cwd, kind) {
|
|
|
11179
11338
|
}
|
|
11180
11339
|
function getDataFiles(cwd, kind) {
|
|
11181
11340
|
const dir = dataDir(cwd, kind);
|
|
11182
|
-
if (!
|
|
11183
|
-
return
|
|
11341
|
+
if (!fs40.existsSync(dir)) return [];
|
|
11342
|
+
return fs40.readdirSync(dir).filter((file) => file.endsWith(".json")).sort((a, b) => a.localeCompare(b)).map((file) => ({
|
|
11184
11343
|
collectionName: file.replace(/\.json$/i, "").replace(/^\d+[-_]?/, ""),
|
|
11185
11344
|
filePath: path41.join(dir, file)
|
|
11186
11345
|
}));
|
|
@@ -11192,7 +11351,7 @@ function getFixtureFiles(cwd) {
|
|
|
11192
11351
|
return getDataFiles(cwd, "fixtures");
|
|
11193
11352
|
}
|
|
11194
11353
|
function readRecords(filePath) {
|
|
11195
|
-
return JSON.parse(
|
|
11354
|
+
return JSON.parse(fs40.readFileSync(filePath, "utf8"));
|
|
11196
11355
|
}
|
|
11197
11356
|
function readSeedIds(cwd) {
|
|
11198
11357
|
const ids = /* @__PURE__ */ new Map();
|
|
@@ -11324,7 +11483,7 @@ async function hasLoadedFixtures(pb) {
|
|
|
11324
11483
|
}
|
|
11325
11484
|
|
|
11326
11485
|
// src/commands/fixtures/load.ts
|
|
11327
|
-
var load = new
|
|
11486
|
+
var load = new Command57("load").description("load fixtures into the database").configureHelp(helpConfig).action(
|
|
11328
11487
|
() => runCommand(async () => {
|
|
11329
11488
|
const { workspaceRootDir } = await getWorkspace();
|
|
11330
11489
|
let loaded = [];
|
|
@@ -11350,8 +11509,8 @@ var load = new Command55("load").description("load fixtures into the database").
|
|
|
11350
11509
|
);
|
|
11351
11510
|
|
|
11352
11511
|
// src/commands/fixtures/clear.ts
|
|
11353
|
-
import { Command as
|
|
11354
|
-
var clear = new
|
|
11512
|
+
import { Command as Command58 } from "commander";
|
|
11513
|
+
var clear = new Command58("clear").description("clear loaded fixtures").configureHelp(helpConfig).action(
|
|
11355
11514
|
() => runCommand(async () => {
|
|
11356
11515
|
const { workspaceRootDir } = await getWorkspace();
|
|
11357
11516
|
let cleared = [];
|
|
@@ -11380,8 +11539,8 @@ var clear = new Command56("clear").description("clear loaded fixtures").configur
|
|
|
11380
11539
|
);
|
|
11381
11540
|
|
|
11382
11541
|
// src/commands/fixtures/reset.ts
|
|
11383
|
-
import { Command as
|
|
11384
|
-
var reset = new
|
|
11542
|
+
import { Command as Command59 } from "commander";
|
|
11543
|
+
var reset = new Command59("reset").description("clear and reload fixtures").configureHelp(helpConfig).action(
|
|
11385
11544
|
() => runCommand(async () => {
|
|
11386
11545
|
const { workspaceRootDir } = await getWorkspace();
|
|
11387
11546
|
let cleared = [];
|
|
@@ -11411,9 +11570,9 @@ var reset = new Command57("reset").description("clear and reload fixtures").conf
|
|
|
11411
11570
|
);
|
|
11412
11571
|
|
|
11413
11572
|
// src/commands/fixtures/generate.ts
|
|
11414
|
-
import
|
|
11573
|
+
import fs41 from "node:fs";
|
|
11415
11574
|
import path42 from "node:path";
|
|
11416
|
-
import { Command as
|
|
11575
|
+
import { Command as Command60, InvalidArgumentError } from "commander";
|
|
11417
11576
|
import * as p37 from "@clack/prompts";
|
|
11418
11577
|
import { annotate } from "annotate-json-schema";
|
|
11419
11578
|
import { createGenerator } from "json-schema-faker";
|
|
@@ -11449,9 +11608,9 @@ async function loadCollections(pb) {
|
|
|
11449
11608
|
}
|
|
11450
11609
|
async function generateFixtureFiles(pb, workspaceRootDir, opts) {
|
|
11451
11610
|
const fixturesDir = dataDir(workspaceRootDir, "fixtures");
|
|
11452
|
-
|
|
11453
|
-
for (const file of
|
|
11454
|
-
if (file.endsWith(".json"))
|
|
11611
|
+
fs41.mkdirSync(fixturesDir, { recursive: true });
|
|
11612
|
+
for (const file of fs41.readdirSync(fixturesDir)) {
|
|
11613
|
+
if (file.endsWith(".json")) fs41.unlinkSync(path42.join(fixturesDir, file));
|
|
11455
11614
|
}
|
|
11456
11615
|
if (opts.seed !== void 0) faker.seed(opts.seed);
|
|
11457
11616
|
const generator = createGenerator({
|
|
@@ -11518,13 +11677,13 @@ async function generateFixtureFiles(pb, workspaceRootDir, opts) {
|
|
|
11518
11677
|
items.push(record);
|
|
11519
11678
|
}
|
|
11520
11679
|
const filename = `${padZeros(fileIndex, 2)}-${collection.name}.json`;
|
|
11521
|
-
|
|
11680
|
+
fs41.writeFileSync(path42.join(fixturesDir, filename), JSON.stringify(items, null, 2));
|
|
11522
11681
|
writtenFiles.push(`${path42.join(DATA_DIR, "fixtures", filename)} (${items.length} records)`);
|
|
11523
11682
|
fileIndex++;
|
|
11524
11683
|
}
|
|
11525
11684
|
return { writtenFiles, warnings };
|
|
11526
11685
|
}
|
|
11527
|
-
var generate2 = new
|
|
11686
|
+
var generate2 = new Command60("generate").description("generate fixture data").option("-c, --count <count>", "number of records per collection", parseCount, 10).option("-s, --seed <seed>", "seed for deterministic output", parseSeed).option("-f, --force", "overwrite existing fixture files and clear loaded fixtures").configureHelp(helpConfig).action(
|
|
11528
11687
|
(opts) => runCommand(async () => {
|
|
11529
11688
|
const { workspaceRootDir } = await getWorkspace();
|
|
11530
11689
|
const existing = getFixtureFiles(workspaceRootDir);
|
|
@@ -11577,7 +11736,7 @@ var generate2 = new Command58("generate").description("generate fixture data").o
|
|
|
11577
11736
|
);
|
|
11578
11737
|
|
|
11579
11738
|
// src/commands/fixtures/regen.ts
|
|
11580
|
-
import { Command as
|
|
11739
|
+
import { Command as Command61, InvalidArgumentError as InvalidArgumentError2 } from "commander";
|
|
11581
11740
|
import * as p38 from "@clack/prompts";
|
|
11582
11741
|
function parseCount2(value) {
|
|
11583
11742
|
const n = parseInt(value, 10);
|
|
@@ -11593,7 +11752,7 @@ function parseSeed2(value) {
|
|
|
11593
11752
|
}
|
|
11594
11753
|
return n;
|
|
11595
11754
|
}
|
|
11596
|
-
var regen = new
|
|
11755
|
+
var regen = new Command61("regen").description("clear the database, regenerate fixture files, and reload them").option("-c, --count <count>", "number of records per collection", parseCount2, 10).option("-s, --seed <seed>", "seed for deterministic output", parseSeed2).configureHelp(helpConfig).action(
|
|
11597
11756
|
(opts) => runCommand(async () => {
|
|
11598
11757
|
const { workspaceRootDir } = await getWorkspace();
|
|
11599
11758
|
let cleared = [];
|
|
@@ -11622,14 +11781,14 @@ var regen = new Command59("regen").description("clear the database, regenerate f
|
|
|
11622
11781
|
);
|
|
11623
11782
|
|
|
11624
11783
|
// src/commands/fixtures.ts
|
|
11625
|
-
var fixtures = new
|
|
11784
|
+
var fixtures = new Command62("fixtures").description("manage fixture data").configureHelp(helpConfig).addCommand(generate2).addCommand(load).addCommand(clear).addCommand(reset).addCommand(regen);
|
|
11626
11785
|
|
|
11627
11786
|
// src/commands/seeds.ts
|
|
11628
|
-
import { Command as
|
|
11787
|
+
import { Command as Command66 } from "commander";
|
|
11629
11788
|
|
|
11630
11789
|
// src/commands/seeds/load.ts
|
|
11631
|
-
import { Command as
|
|
11632
|
-
var load2 = new
|
|
11790
|
+
import { Command as Command63 } from "commander";
|
|
11791
|
+
var load2 = new Command63("load").description("load seeds into the database").option("-f, --force", "load even if target collections already have records").configureHelp(helpConfig).action(
|
|
11633
11792
|
(opts) => runCommand(async () => {
|
|
11634
11793
|
const { workspaceRootDir } = await getWorkspace();
|
|
11635
11794
|
const seedFiles = getSeedFiles(workspaceRootDir);
|
|
@@ -11666,9 +11825,9 @@ var load2 = new Command61("load").description("load seeds into the database").op
|
|
|
11666
11825
|
);
|
|
11667
11826
|
|
|
11668
11827
|
// src/commands/seeds/save.ts
|
|
11669
|
-
import
|
|
11828
|
+
import fs42 from "node:fs";
|
|
11670
11829
|
import path43 from "node:path";
|
|
11671
|
-
import { Command as
|
|
11830
|
+
import { Command as Command64 } from "commander";
|
|
11672
11831
|
var padZeros2 = (num, length) => num.toString().padStart(length, "0");
|
|
11673
11832
|
function filterSystemFields(record, systemFieldNames) {
|
|
11674
11833
|
const out = {};
|
|
@@ -11679,7 +11838,7 @@ function filterSystemFields(record, systemFieldNames) {
|
|
|
11679
11838
|
}
|
|
11680
11839
|
return out;
|
|
11681
11840
|
}
|
|
11682
|
-
var save = new
|
|
11841
|
+
var save = new Command64("save").description("save the current data as seeds").option("-f, --force", "overwrite existing seed files").configureHelp(helpConfig).action(
|
|
11683
11842
|
(opts) => runCommand(async () => {
|
|
11684
11843
|
const { workspaceRootDir } = await getWorkspace();
|
|
11685
11844
|
const seedsPath = dataDir(workspaceRootDir, "seeds");
|
|
@@ -11687,10 +11846,10 @@ var save = new Command62("save").description("save the current data as seeds").o
|
|
|
11687
11846
|
if (existing.length > 0 && !opts.force) {
|
|
11688
11847
|
throw new Error("Existing seed files found in data/seeds. Pass --force to overwrite.");
|
|
11689
11848
|
}
|
|
11690
|
-
|
|
11849
|
+
fs42.mkdirSync(seedsPath, { recursive: true });
|
|
11691
11850
|
if (opts.force) {
|
|
11692
|
-
for (const file of
|
|
11693
|
-
if (file.endsWith(".json"))
|
|
11851
|
+
for (const file of fs42.readdirSync(seedsPath)) {
|
|
11852
|
+
if (file.endsWith(".json")) fs42.unlinkSync(path43.join(seedsPath, file));
|
|
11694
11853
|
}
|
|
11695
11854
|
}
|
|
11696
11855
|
const saved = [];
|
|
@@ -11725,7 +11884,7 @@ var save = new Command62("save").description("save the current data as seeds").o
|
|
|
11725
11884
|
`${padZeros2(count, 2)}-${collectionName}.json`
|
|
11726
11885
|
);
|
|
11727
11886
|
const seedPath = path43.join(workspaceRootDir, relativeSeedPath);
|
|
11728
|
-
|
|
11887
|
+
fs42.writeFileSync(seedPath, JSON.stringify(filtered, null, 2));
|
|
11729
11888
|
saved.push(`${relativeSeedPath} (${filtered.length} records)`);
|
|
11730
11889
|
count++;
|
|
11731
11890
|
}
|
|
@@ -11751,8 +11910,8 @@ var save = new Command62("save").description("save the current data as seeds").o
|
|
|
11751
11910
|
);
|
|
11752
11911
|
|
|
11753
11912
|
// src/commands/seeds/clear.ts
|
|
11754
|
-
import { Command as
|
|
11755
|
-
var clear2 = new
|
|
11913
|
+
import { Command as Command65 } from "commander";
|
|
11914
|
+
var clear2 = new Command65("clear").description("clear seeded records").configureHelp(helpConfig).action(
|
|
11756
11915
|
() => runCommand(async () => {
|
|
11757
11916
|
const { workspaceRootDir } = await getWorkspace();
|
|
11758
11917
|
const seedFiles = getSeedFiles(workspaceRootDir);
|
|
@@ -11783,13 +11942,13 @@ var clear2 = new Command63("clear").description("clear seeded records").configur
|
|
|
11783
11942
|
);
|
|
11784
11943
|
|
|
11785
11944
|
// src/commands/seeds.ts
|
|
11786
|
-
var seeds = new
|
|
11945
|
+
var seeds = new Command66("seeds").description("manage seed data").configureHelp(helpConfig).addCommand(load2).addCommand(save).addCommand(clear2);
|
|
11787
11946
|
|
|
11788
11947
|
// src/commands/signup.ts
|
|
11789
|
-
import { Command as
|
|
11948
|
+
import { Command as Command67 } from "commander";
|
|
11790
11949
|
import * as p39 from "@clack/prompts";
|
|
11791
11950
|
import makeFetchCookie2 from "fetch-cookie";
|
|
11792
|
-
var signup = new
|
|
11951
|
+
var signup = new Command67("signup").description("signup to velastack.dev").configureHelp(helpConfig).action(
|
|
11793
11952
|
() => runCommand(async () => {
|
|
11794
11953
|
const { email: email2, password: password9, passwordConfirm } = await p39.group({
|
|
11795
11954
|
email: () => p39.text({ message: "Email" }),
|
|
@@ -11824,9 +11983,9 @@ var signup = new Command65("signup").description("signup to velastack.dev").conf
|
|
|
11824
11983
|
);
|
|
11825
11984
|
|
|
11826
11985
|
// src/commands/logout.ts
|
|
11827
|
-
import { Command as
|
|
11986
|
+
import { Command as Command68 } from "commander";
|
|
11828
11987
|
import * as p40 from "@clack/prompts";
|
|
11829
|
-
var logout = new
|
|
11988
|
+
var logout = new Command68("logout").alias("signout").description("logout from velastack.dev").configureHelp(helpConfig).action(
|
|
11830
11989
|
() => runCommand(() => {
|
|
11831
11990
|
if (!readConfig()) {
|
|
11832
11991
|
p40.log.info("Not logged in");
|
|
@@ -11838,9 +11997,9 @@ var logout = new Command66("logout").alias("signout").description("logout from v
|
|
|
11838
11997
|
);
|
|
11839
11998
|
|
|
11840
11999
|
// src/commands/whoami.ts
|
|
11841
|
-
import { Command as
|
|
12000
|
+
import { Command as Command69 } from "commander";
|
|
11842
12001
|
import * as p41 from "@clack/prompts";
|
|
11843
|
-
var whoami = new
|
|
12002
|
+
var whoami = new Command69("whoami").description("show the current user").configureHelp(helpConfig).action(
|
|
11844
12003
|
() => runCommand(async () => {
|
|
11845
12004
|
const apiKey = readConfig()?.apiKey;
|
|
11846
12005
|
if (!apiKey) {
|
|
@@ -11857,10 +12016,10 @@ var whoami = new Command67("whoami").description("show the current user").config
|
|
|
11857
12016
|
);
|
|
11858
12017
|
|
|
11859
12018
|
// src/commands/migrate.ts
|
|
11860
|
-
import { Command as
|
|
12019
|
+
import { Command as Command76 } from "commander";
|
|
11861
12020
|
|
|
11862
12021
|
// src/commands/migrate/up.ts
|
|
11863
|
-
import { Command as
|
|
12022
|
+
import { Command as Command70 } from "commander";
|
|
11864
12023
|
|
|
11865
12024
|
// src/lib/migrate.ts
|
|
11866
12025
|
import path44 from "node:path";
|
|
@@ -11902,10 +12061,10 @@ async function runMigrateUp() {
|
|
|
11902
12061
|
]
|
|
11903
12062
|
});
|
|
11904
12063
|
}
|
|
11905
|
-
var up = new
|
|
12064
|
+
var up = new Command70("up").description("apply all pending migrations").configureHelp(helpConfig).action(() => runCommand(runMigrateUp, "Failed to run migrations."));
|
|
11906
12065
|
|
|
11907
12066
|
// src/commands/migrate/down.ts
|
|
11908
|
-
import { Command as
|
|
12067
|
+
import { Command as Command71, InvalidArgumentError as InvalidArgumentError3 } from "commander";
|
|
11909
12068
|
function parseSteps(value) {
|
|
11910
12069
|
const n = parseInt(value, 10);
|
|
11911
12070
|
if (!Number.isFinite(n) || n <= 0) {
|
|
@@ -11913,7 +12072,7 @@ function parseSteps(value) {
|
|
|
11913
12072
|
}
|
|
11914
12073
|
return n;
|
|
11915
12074
|
}
|
|
11916
|
-
var down = new
|
|
12075
|
+
var down = new Command71("down").alias("rollback").description("revert the last N applied migrations").argument("[number]", "how many migrations to revert", parseSteps, 1).configureHelp(helpConfig).action(
|
|
11917
12076
|
(n) => runCommand(async () => {
|
|
11918
12077
|
await runPocketbaseMigrate(["down", String(n)]);
|
|
11919
12078
|
reportResult({
|
|
@@ -11927,10 +12086,10 @@ var down = new Command69("down").alias("rollback").description("revert the last
|
|
|
11927
12086
|
);
|
|
11928
12087
|
|
|
11929
12088
|
// src/commands/migrate/create.ts
|
|
11930
|
-
import
|
|
12089
|
+
import fs43 from "node:fs";
|
|
11931
12090
|
import path45 from "node:path";
|
|
11932
|
-
import { Command as
|
|
11933
|
-
var create2 = new
|
|
12091
|
+
import { Command as Command72 } from "commander";
|
|
12092
|
+
var create2 = new Command72("create").alias("new").description("create a new blank migration").argument("<name>", "migration name (snake_case)").configureHelp(helpConfig).action(
|
|
11934
12093
|
(name) => runCommand(async () => {
|
|
11935
12094
|
const cwd = migrateRoot();
|
|
11936
12095
|
const before = listMigrationFiles(cwd);
|
|
@@ -11949,15 +12108,15 @@ var create2 = new Command70("create").alias("new").description("create a new bla
|
|
|
11949
12108
|
);
|
|
11950
12109
|
function listMigrationFiles(cwd) {
|
|
11951
12110
|
const dir = path45.join(cwd, MIGRATIONS_DIR);
|
|
11952
|
-
if (!
|
|
11953
|
-
return new Set(
|
|
12111
|
+
if (!fs43.existsSync(dir)) return /* @__PURE__ */ new Set();
|
|
12112
|
+
return new Set(fs43.readdirSync(dir).filter((f) => /\.[jt]s$/.test(f)));
|
|
11954
12113
|
}
|
|
11955
12114
|
|
|
11956
12115
|
// src/commands/migrate/collections.ts
|
|
11957
|
-
import
|
|
12116
|
+
import fs44 from "node:fs";
|
|
11958
12117
|
import path46 from "node:path";
|
|
11959
|
-
import { Command as
|
|
11960
|
-
var collections = new
|
|
12118
|
+
import { Command as Command73 } from "commander";
|
|
12119
|
+
var collections = new Command73("collections").alias("snapshot").description("snapshot local collections into a new migration").configureHelp(helpConfig).action(
|
|
11961
12120
|
() => runCommand(async () => {
|
|
11962
12121
|
const cwd = migrateRoot();
|
|
11963
12122
|
const before = listMigrationFiles2(cwd);
|
|
@@ -11983,13 +12142,13 @@ var collections = new Command71("collections").alias("snapshot").description("sn
|
|
|
11983
12142
|
);
|
|
11984
12143
|
function listMigrationFiles2(cwd) {
|
|
11985
12144
|
const dir = path46.join(cwd, MIGRATIONS_DIR);
|
|
11986
|
-
if (!
|
|
11987
|
-
return new Set(
|
|
12145
|
+
if (!fs44.existsSync(dir)) return /* @__PURE__ */ new Set();
|
|
12146
|
+
return new Set(fs44.readdirSync(dir).filter((f) => /\.[jt]s$/.test(f)));
|
|
11988
12147
|
}
|
|
11989
12148
|
|
|
11990
12149
|
// src/commands/migrate/history-sync.ts
|
|
11991
|
-
import { Command as
|
|
11992
|
-
var historySync = new
|
|
12150
|
+
import { Command as Command74 } from "commander";
|
|
12151
|
+
var historySync = new Command74("history-sync").description("drop _migrations rows whose files no longer exist").configureHelp(helpConfig).action(
|
|
11993
12152
|
() => runCommand(async () => {
|
|
11994
12153
|
await runPocketbaseMigrate(["history-sync"]);
|
|
11995
12154
|
reportResult({
|
|
@@ -12002,10 +12161,10 @@ var historySync = new Command72("history-sync").description("drop _migrations ro
|
|
|
12002
12161
|
// src/commands/migrate/sveltekit-3.ts
|
|
12003
12162
|
import path47 from "node:path";
|
|
12004
12163
|
import process29 from "node:process";
|
|
12005
|
-
import { Command as
|
|
12164
|
+
import { Command as Command75 } from "commander";
|
|
12006
12165
|
import * as p42 from "@clack/prompts";
|
|
12007
12166
|
import pc12 from "picocolors";
|
|
12008
|
-
var sveltekit3 = new
|
|
12167
|
+
var sveltekit3 = new Command75("sveltekit-3").description("upgrade a SvelteKit 2 project to SvelteKit 3 (sv migrate, then the vela steps)").option("--cwd <path>", "the project to migrate (default: the current project)").option("--no-install", "skip installing dependencies").option("--force", "run even when the git working tree has uncommitted changes").option("--skip-sv", "only run the vela steps (sv has already been run)").configureHelp(helpConfig).action(
|
|
12009
12168
|
(options) => runCommand(async () => {
|
|
12010
12169
|
const root = options.cwd ? path47.resolve(options.cwd) : findWorkspaceRoot() ?? process29.cwd();
|
|
12011
12170
|
p42.intro(pc12.bgCyan(pc12.black(" vela migrate sveltekit-3 ")));
|
|
@@ -12079,14 +12238,14 @@ function nextStepsFor(result) {
|
|
|
12079
12238
|
}
|
|
12080
12239
|
|
|
12081
12240
|
// src/commands/migrate.ts
|
|
12082
|
-
var migrate = new
|
|
12241
|
+
var migrate = new Command76("migrate").description("manage database migrations (and `migrate sveltekit-3` to upgrade SvelteKit)").configureHelp(helpConfig).action(() => runCommand(runMigrateUp, "Failed to run migrations.")).addCommand(up).addCommand(down).addCommand(create2).addCommand(collections).addCommand(historySync).addCommand(sveltekit3);
|
|
12083
12242
|
|
|
12084
12243
|
// src/commands/dev.ts
|
|
12085
|
-
import
|
|
12244
|
+
import fs45 from "node:fs";
|
|
12086
12245
|
import path49 from "node:path";
|
|
12087
12246
|
import process31 from "node:process";
|
|
12088
12247
|
import { performance } from "node:perf_hooks";
|
|
12089
|
-
import { Command as
|
|
12248
|
+
import { Command as Command77, InvalidArgumentError as InvalidArgumentError4 } from "commander";
|
|
12090
12249
|
import pc14 from "picocolors";
|
|
12091
12250
|
import PocketBase5 from "pocketbase";
|
|
12092
12251
|
|
|
@@ -12159,7 +12318,7 @@ function parsePort(value) {
|
|
|
12159
12318
|
}
|
|
12160
12319
|
return port;
|
|
12161
12320
|
}
|
|
12162
|
-
var dev = new
|
|
12321
|
+
var dev = new Command77("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").option("--all-sql", "also print the auth lookup PocketBase runs on every request").configureHelp(helpConfig).action(async (options) => {
|
|
12163
12322
|
const cwd = process31.cwd();
|
|
12164
12323
|
warnIfKit2(findWorkspaceRoot(cwd) ?? cwd, (m) => console.warn(pc14.yellow(`\u25B2 ${m}`)));
|
|
12165
12324
|
process31.env.VELA_DATA_DIR ??= localDataDir(cwd);
|
|
@@ -12182,7 +12341,7 @@ var dev = new Command75("dev").description("start the development server").optio
|
|
|
12182
12341
|
const needsStart = backend3 && !process31.env.POCKETBASE_URL;
|
|
12183
12342
|
const cleanup = () => {
|
|
12184
12343
|
if (pbProc?.pid) pbProc.kill();
|
|
12185
|
-
if (
|
|
12344
|
+
if (fs45.existsSync(viteMetadataFile)) fs45.rmSync(viteMetadataFile);
|
|
12186
12345
|
};
|
|
12187
12346
|
if (needsStart) {
|
|
12188
12347
|
const resolved = await resolveConfig(inlineConfig, "serve");
|
|
@@ -12226,8 +12385,8 @@ var dev = new Command75("dev").description("start the development server").optio
|
|
|
12226
12385
|
if (!backend3) return;
|
|
12227
12386
|
const { address, port: vitePort } = server.httpServer.address();
|
|
12228
12387
|
const viteHost = address === "::1" ? "localhost" : address;
|
|
12229
|
-
await
|
|
12230
|
-
await
|
|
12388
|
+
await fs45.promises.mkdir(viteMetadataDir, { recursive: true });
|
|
12389
|
+
await fs45.promises.writeFile(
|
|
12231
12390
|
viteMetadataFile,
|
|
12232
12391
|
JSON.stringify({
|
|
12233
12392
|
pocketbaseUrl: process31.env.POCKETBASE_URL,
|
|
@@ -12267,9 +12426,9 @@ async function startWatchingTypes(cwd, pb) {
|
|
|
12267
12426
|
void (async () => {
|
|
12268
12427
|
for (; ; ) {
|
|
12269
12428
|
try {
|
|
12270
|
-
await
|
|
12271
|
-
for await (const event of
|
|
12272
|
-
if (event.eventType === "rename" && event.filename === "$types.d.ts" && !
|
|
12429
|
+
await fs45.promises.mkdir(pocketbaseDir, { recursive: true });
|
|
12430
|
+
for await (const event of fs45.promises.watch(pocketbaseDir)) {
|
|
12431
|
+
if (event.eventType === "rename" && event.filename === "$types.d.ts" && !fs45.existsSync(pocketbaseTypes)) {
|
|
12273
12432
|
setTimeout(regenerate, 100);
|
|
12274
12433
|
}
|
|
12275
12434
|
}
|
|
@@ -12281,10 +12440,10 @@ async function startWatchingTypes(cwd, pb) {
|
|
|
12281
12440
|
}
|
|
12282
12441
|
|
|
12283
12442
|
// src/commands/build.ts
|
|
12284
|
-
import
|
|
12443
|
+
import fs46 from "node:fs";
|
|
12285
12444
|
import path50 from "node:path";
|
|
12286
12445
|
import process33 from "node:process";
|
|
12287
|
-
import { Command as
|
|
12446
|
+
import { Command as Command78 } from "commander";
|
|
12288
12447
|
import * as p43 from "@clack/prompts";
|
|
12289
12448
|
import pc15 from "picocolors";
|
|
12290
12449
|
import { x as x4 } from "tinyexec";
|
|
@@ -12325,7 +12484,7 @@ function splitHosts(value) {
|
|
|
12325
12484
|
|
|
12326
12485
|
// src/commands/build.ts
|
|
12327
12486
|
var PRERENDERED_DIR = path50.join(".svelte-kit", "output", "prerendered");
|
|
12328
|
-
var build = new
|
|
12487
|
+
var build = new Command78("build").description("build the app").configureHelp(helpConfig).option("-t, --target <target>", "which copy of the app to build for", PRODUCTION_TARGET).action(async (options) => {
|
|
12329
12488
|
const cwd = process33.cwd();
|
|
12330
12489
|
warnIfKit2(findWorkspaceRoot(cwd) ?? cwd, (m) => p43.log.warn(m));
|
|
12331
12490
|
warnIfSsrExternalMissing(findWorkspaceRoot(cwd) ?? cwd);
|
|
@@ -12369,6 +12528,8 @@ var build = new Command76("build").description("build the app").configureHelp(he
|
|
|
12369
12528
|
if (!origin) warnIfPrerendered(cwd);
|
|
12370
12529
|
});
|
|
12371
12530
|
function warnIfSsrExternalMissing(root) {
|
|
12531
|
+
const major = kitMajor(root);
|
|
12532
|
+
if (major !== null && major < 3) return;
|
|
12372
12533
|
try {
|
|
12373
12534
|
if (detectAdapter(root).kind !== "node") return;
|
|
12374
12535
|
} catch {
|
|
@@ -12392,7 +12553,7 @@ async function originForBuild(cwd, target) {
|
|
|
12392
12553
|
}
|
|
12393
12554
|
function warnIfPrerendered(cwd) {
|
|
12394
12555
|
const dir = path50.join(cwd, PRERENDERED_DIR);
|
|
12395
|
-
if (!
|
|
12556
|
+
if (!fs46.existsSync(dir) || fs46.readdirSync(dir).length === 0) return;
|
|
12396
12557
|
if (process33.env.VELA_ORIGIN === "") {
|
|
12397
12558
|
p43.log.warn(
|
|
12398
12559
|
`Prerendered pages were built with no origin, on purpose: this app is served on
|
|
@@ -12415,17 +12576,17 @@ Set one with ${pc15.cyan("vela deploy --domain example.com")}, or pass ${pc15.cy
|
|
|
12415
12576
|
}
|
|
12416
12577
|
|
|
12417
12578
|
// src/commands/preview.ts
|
|
12418
|
-
import
|
|
12579
|
+
import fs47 from "node:fs";
|
|
12419
12580
|
import path51 from "node:path";
|
|
12420
12581
|
import process34 from "node:process";
|
|
12421
|
-
import { Command as
|
|
12582
|
+
import { Command as Command79 } from "commander";
|
|
12422
12583
|
import * as p44 from "@clack/prompts";
|
|
12423
12584
|
import pc16 from "picocolors";
|
|
12424
12585
|
import { x as x5 } from "tinyexec";
|
|
12425
12586
|
import { detect as detect8 } from "package-manager-detector";
|
|
12426
12587
|
import { resolveCommand as resolveCommand6 } from "package-manager-detector/commands";
|
|
12427
12588
|
var ADAPTER_NODE_MODULE = path51.join("build", "adapter-node.js");
|
|
12428
|
-
var preview = new
|
|
12589
|
+
var preview = new Command79("preview").description("preview the built app").configureHelp(helpConfig).action(async () => {
|
|
12429
12590
|
const cwd = process34.cwd();
|
|
12430
12591
|
process34.env.VELA_DATA_DIR ??= localDataDir(cwd);
|
|
12431
12592
|
warnIfKit2(findWorkspaceRoot(cwd) ?? cwd, (m) => p44.log.warn(m));
|
|
@@ -12477,7 +12638,7 @@ function bakedOrigin(source) {
|
|
|
12477
12638
|
function warnIfOriginBaked(cwd) {
|
|
12478
12639
|
let source;
|
|
12479
12640
|
try {
|
|
12480
|
-
source =
|
|
12641
|
+
source = fs47.readFileSync(path51.join(cwd, ADAPTER_NODE_MODULE), "utf8");
|
|
12481
12642
|
} catch {
|
|
12482
12643
|
return;
|
|
12483
12644
|
}
|
|
@@ -12494,8 +12655,8 @@ set empty so no domain is baked in.`
|
|
|
12494
12655
|
|
|
12495
12656
|
// src/commands/sync.ts
|
|
12496
12657
|
import path52 from "node:path";
|
|
12497
|
-
import { Command as
|
|
12498
|
-
var sync = new
|
|
12658
|
+
import { Command as Command80 } from "commander";
|
|
12659
|
+
var sync = new Command80("sync").description("sync types from the database").configureHelp(helpConfig).action(
|
|
12499
12660
|
() => runCommand(async () => {
|
|
12500
12661
|
const { workspaceRootDir } = await getWorkspace();
|
|
12501
12662
|
const typesDir = path52.join(workspaceRootDir, ".svelte-kit", "types");
|
|
@@ -12508,7 +12669,7 @@ var sync = new Command78("sync").description("sync types from the database").con
|
|
|
12508
12669
|
);
|
|
12509
12670
|
|
|
12510
12671
|
// src/commands/provision.ts
|
|
12511
|
-
import { Command as
|
|
12672
|
+
import { Command as Command81 } from "commander";
|
|
12512
12673
|
import * as p45 from "@clack/prompts";
|
|
12513
12674
|
import pc17 from "picocolors";
|
|
12514
12675
|
import * as v9 from "valibot";
|
|
@@ -12523,7 +12684,7 @@ var OptionsSchema2 = v9.object({
|
|
|
12523
12684
|
)
|
|
12524
12685
|
});
|
|
12525
12686
|
var provision = addSshOptions(
|
|
12526
|
-
new
|
|
12687
|
+
new Command81("provision").description("prepare a server to host vela apps").argument("<target>", "SSH target \u2014 an alias from ~/.ssh/config, or user@host").configureHelp(helpConfig)
|
|
12527
12688
|
).option("--pb-version <version>", "PocketBase version to install").option(
|
|
12528
12689
|
"--node-major <version>",
|
|
12529
12690
|
"Node.js major version to bring the server up to (match the one you build with)",
|
|
@@ -12570,9 +12731,9 @@ var provision = addSshOptions(
|
|
|
12570
12731
|
|
|
12571
12732
|
// src/commands/deploy.ts
|
|
12572
12733
|
import path56 from "node:path";
|
|
12573
|
-
import
|
|
12734
|
+
import fs51 from "node:fs";
|
|
12574
12735
|
import process36 from "node:process";
|
|
12575
|
-
import { Command as
|
|
12736
|
+
import { Command as Command82, Option as Option2 } from "commander";
|
|
12576
12737
|
import * as p47 from "@clack/prompts";
|
|
12577
12738
|
import pc19 from "picocolors";
|
|
12578
12739
|
import * as v10 from "valibot";
|
|
@@ -12669,6 +12830,18 @@ async function resolveStack(session, appId, instance, preview2) {
|
|
|
12669
12830
|
}
|
|
12670
12831
|
return { values, secrets, entries };
|
|
12671
12832
|
}
|
|
12833
|
+
async function shadowedKeys(session, appId, state, layer, keys) {
|
|
12834
|
+
const stack = layersFor(appId, state.instance, state.preview === true);
|
|
12835
|
+
const above = stack.slice(stack.findIndex((entry) => entry.layer === layer) + 1);
|
|
12836
|
+
const shadowed = {};
|
|
12837
|
+
for (const entry of above) {
|
|
12838
|
+
const contents = await readLayer(session, entry.files);
|
|
12839
|
+
for (const key of keys) {
|
|
12840
|
+
if (key in contents.secret || key in contents.public) shadowed[key] = entry.layer;
|
|
12841
|
+
}
|
|
12842
|
+
}
|
|
12843
|
+
return shadowed;
|
|
12844
|
+
}
|
|
12672
12845
|
function reachedInstances(states, appId, layer) {
|
|
12673
12846
|
return states.filter(
|
|
12674
12847
|
(state) => state.appId === appId && (layer === "all" || state.preview === true)
|
|
@@ -12676,20 +12849,112 @@ function reachedInstances(states, appId, layer) {
|
|
|
12676
12849
|
}
|
|
12677
12850
|
|
|
12678
12851
|
// src/lib/build-stack.ts
|
|
12679
|
-
import
|
|
12852
|
+
import fs49 from "node:fs";
|
|
12680
12853
|
import path54 from "node:path";
|
|
12681
12854
|
|
|
12682
12855
|
// src/lib/static-env.ts
|
|
12683
|
-
import
|
|
12856
|
+
import fs48 from "node:fs";
|
|
12684
12857
|
import path53 from "node:path";
|
|
12858
|
+
import { ENV_DECL_CANDIDATES } from "@velastack/patterns";
|
|
12859
|
+
import { Node as Node5, Project as Project5, QuoteKind as QuoteKind3 } from "ts-morph";
|
|
12860
|
+
function staticEnv(root) {
|
|
12861
|
+
const major = kitMajor(root);
|
|
12862
|
+
if (major !== null && major < 3) {
|
|
12863
|
+
return {
|
|
12864
|
+
names: staticEnvImports(root),
|
|
12865
|
+
rule: "imports",
|
|
12866
|
+
how: "imported from $env/static",
|
|
12867
|
+
remedy: "remove the import"
|
|
12868
|
+
};
|
|
12869
|
+
}
|
|
12870
|
+
const file = findEnvDecl(root);
|
|
12871
|
+
const rel = file ? path53.relative(root, file).split(path53.sep).join("/") : ENV_DECL_CANDIDATES[0];
|
|
12872
|
+
return {
|
|
12873
|
+
names: file ? staticEnvDeclarations(file) : /* @__PURE__ */ new Set(),
|
|
12874
|
+
rule: "declarations",
|
|
12875
|
+
how: `declared static: true in ${rel}`,
|
|
12876
|
+
remedy: "drop static: true"
|
|
12877
|
+
};
|
|
12878
|
+
}
|
|
12879
|
+
function findEnvDecl(root) {
|
|
12880
|
+
for (const rel of ENV_DECL_CANDIDATES) {
|
|
12881
|
+
const abs = path53.join(root, rel);
|
|
12882
|
+
if (fs48.existsSync(abs)) return abs;
|
|
12883
|
+
}
|
|
12884
|
+
return null;
|
|
12885
|
+
}
|
|
12886
|
+
function staticEnvDeclarations(file) {
|
|
12887
|
+
const names = /* @__PURE__ */ new Set();
|
|
12888
|
+
let sf;
|
|
12889
|
+
try {
|
|
12890
|
+
const project = new Project5({
|
|
12891
|
+
compilerOptions: { allowJs: true },
|
|
12892
|
+
skipFileDependencyResolution: true,
|
|
12893
|
+
manipulationSettings: { quoteKind: QuoteKind3.Single }
|
|
12894
|
+
});
|
|
12895
|
+
sf = project.addSourceFileAtPath(file);
|
|
12896
|
+
} catch {
|
|
12897
|
+
return names;
|
|
12898
|
+
}
|
|
12899
|
+
const object8 = variablesObject(sf);
|
|
12900
|
+
if (!object8) return names;
|
|
12901
|
+
for (const prop of object8.getProperties()) {
|
|
12902
|
+
if (!Node5.isPropertyAssignment(prop)) continue;
|
|
12903
|
+
const name = literalName(prop.getNameNode());
|
|
12904
|
+
const entry = unwrap3(prop.getInitializer());
|
|
12905
|
+
if (!name || !entry || !Node5.isObjectLiteralExpression(entry)) continue;
|
|
12906
|
+
for (const field of entry.getProperties()) {
|
|
12907
|
+
if (!Node5.isPropertyAssignment(field)) continue;
|
|
12908
|
+
if (literalName(field.getNameNode()) !== "static") continue;
|
|
12909
|
+
const value = unwrap3(field.getInitializer());
|
|
12910
|
+
if (value && Node5.isTrueLiteral(value)) names.add(name);
|
|
12911
|
+
}
|
|
12912
|
+
}
|
|
12913
|
+
return names;
|
|
12914
|
+
}
|
|
12915
|
+
function variablesObject(sf) {
|
|
12916
|
+
let local = "variables";
|
|
12917
|
+
for (const decl of sf.getExportDeclarations()) {
|
|
12918
|
+
for (const spec of decl.getNamedExports()) {
|
|
12919
|
+
const exported = spec.getAliasNode()?.getText() ?? spec.getName();
|
|
12920
|
+
if (exported !== "variables") continue;
|
|
12921
|
+
if (decl.getModuleSpecifier()) return null;
|
|
12922
|
+
local = spec.getName();
|
|
12923
|
+
}
|
|
12924
|
+
}
|
|
12925
|
+
const init = unwrap3(sf.getVariableDeclaration(local)?.getInitializer());
|
|
12926
|
+
if (!init) return null;
|
|
12927
|
+
if (Node5.isObjectLiteralExpression(init)) return init;
|
|
12928
|
+
if (Node5.isCallExpression(init) && init.getExpression().getText() === "defineEnvVars") {
|
|
12929
|
+
const arg = unwrap3(init.getArguments()[0]);
|
|
12930
|
+
if (arg && Node5.isObjectLiteralExpression(arg)) return arg;
|
|
12931
|
+
}
|
|
12932
|
+
return null;
|
|
12933
|
+
}
|
|
12934
|
+
function literalName(node) {
|
|
12935
|
+
if (Node5.isComputedPropertyName(node)) {
|
|
12936
|
+
const inner = node.getExpression();
|
|
12937
|
+
return Node5.isStringLiteral(inner) || Node5.isNoSubstitutionTemplateLiteral(inner) ? inner.getLiteralText() : null;
|
|
12938
|
+
}
|
|
12939
|
+
if (Node5.isStringLiteral(node) || Node5.isNoSubstitutionTemplateLiteral(node))
|
|
12940
|
+
return node.getLiteralText();
|
|
12941
|
+
return Node5.isIdentifier(node) ? node.getText() : null;
|
|
12942
|
+
}
|
|
12943
|
+
function unwrap3(expr) {
|
|
12944
|
+
let current = expr;
|
|
12945
|
+
while (current && (Node5.isParenthesizedExpression(current) || Node5.isAsExpression(current) || Node5.isSatisfiesExpression(current))) {
|
|
12946
|
+
current = current.getExpression();
|
|
12947
|
+
}
|
|
12948
|
+
return current;
|
|
12949
|
+
}
|
|
12685
12950
|
var SOURCE_EXTENSIONS2 = /* @__PURE__ */ new Set([".ts", ".js", ".mts", ".mjs", ".svelte"]);
|
|
12686
12951
|
var STATIC_IMPORT = /import\s*(?:type\s*)?\{([^}]*)\}\s*from\s*['"]\$env\/static\/(?:private|public)['"]/g;
|
|
12687
12952
|
function staticEnvImports(root) {
|
|
12688
12953
|
const names = /* @__PURE__ */ new Set();
|
|
12689
12954
|
const src = path53.join(root, "src");
|
|
12690
|
-
if (!
|
|
12955
|
+
if (!fs48.existsSync(src)) return names;
|
|
12691
12956
|
for (const file of sourceFiles2(src)) {
|
|
12692
|
-
const content =
|
|
12957
|
+
const content = fs48.readFileSync(file, "utf8");
|
|
12693
12958
|
if (!content.includes("$env/static/")) continue;
|
|
12694
12959
|
for (const match of content.matchAll(STATIC_IMPORT)) {
|
|
12695
12960
|
for (const spec of match[1].split(",")) {
|
|
@@ -12701,7 +12966,7 @@ function staticEnvImports(root) {
|
|
|
12701
12966
|
return names;
|
|
12702
12967
|
}
|
|
12703
12968
|
function* sourceFiles2(dir) {
|
|
12704
|
-
for (const entry of
|
|
12969
|
+
for (const entry of fs48.readdirSync(dir, { withFileTypes: true })) {
|
|
12705
12970
|
if (entry.name === "node_modules" || entry.name.startsWith(".")) continue;
|
|
12706
12971
|
const full = path53.join(dir, entry.name);
|
|
12707
12972
|
if (entry.isDirectory()) yield* sourceFiles2(full);
|
|
@@ -12717,28 +12982,28 @@ function buildStack(root, input) {
|
|
|
12717
12982
|
const env2 = { ...input.stack, ...input.derived };
|
|
12718
12983
|
const blanked = [];
|
|
12719
12984
|
const file = path54.join(root, ".env");
|
|
12720
|
-
const local =
|
|
12985
|
+
const local = fs49.existsSync(file) ? readLocalEnvFile(file) : {};
|
|
12721
12986
|
for (const key of Object.keys(local)) {
|
|
12722
12987
|
if (key in env2) continue;
|
|
12723
12988
|
if (!input.tunnel && LOCAL_BUILD_KEYS.test(key)) continue;
|
|
12724
12989
|
env2[key] = "";
|
|
12725
12990
|
blanked.push(key);
|
|
12726
12991
|
}
|
|
12727
|
-
const
|
|
12728
|
-
const baked = blanked.filter((key) =>
|
|
12992
|
+
const fixed = staticEnv(root);
|
|
12993
|
+
const baked = blanked.filter((key) => fixed.names.has(key));
|
|
12729
12994
|
if (baked.length > 0) {
|
|
12730
12995
|
throw new DevOnlyEnvError(
|
|
12731
|
-
`${baked.join(", ")} ${baked.length === 1 ? "is" : "are"}
|
|
12996
|
+
`${baked.join(", ")} ${baked.length === 1 ? "is" : "are"} ${fixed.how} but set only in your .env.
|
|
12732
12997
|
|
|
12733
12998
|
The build would bake in your development value. Set ${baked.length === 1 ? "it" : "them"} for the target
|
|
12734
|
-
(vela env set KEY -t <target>) or
|
|
12999
|
+
(vela env set KEY -t <target>) or ${fixed.remedy}.`
|
|
12735
13000
|
);
|
|
12736
13001
|
}
|
|
12737
13002
|
return { env: env2, blanked: blanked.sort() };
|
|
12738
13003
|
}
|
|
12739
13004
|
|
|
12740
13005
|
// src/lib/env-nudge.ts
|
|
12741
|
-
import
|
|
13006
|
+
import fs50 from "node:fs";
|
|
12742
13007
|
import path55 from "node:path";
|
|
12743
13008
|
import process35 from "node:process";
|
|
12744
13009
|
import * as p46 from "@clack/prompts";
|
|
@@ -12747,7 +13012,7 @@ var ENV_EXAMPLE = ".env.example";
|
|
|
12747
13012
|
var SUPPLIED = /^(NODE_ENV|HOST|PORT|ORIGIN|PROTOCOL_HEADER|HOST_HEADER|ADDRESS_HEADER|XFF_DEPTH|PB_PORT|POCKETBASE_URL|POCKETBASE_SUPERUSER_EMAIL|POCKETBASE_SUPERUSER_PASSWORD|APP_NAME|VELA_)/;
|
|
12748
13013
|
function missingFromExample(root, present) {
|
|
12749
13014
|
const file = path55.join(root, ENV_EXAMPLE);
|
|
12750
|
-
if (!
|
|
13015
|
+
if (!fs50.existsSync(file)) return [];
|
|
12751
13016
|
const have = new Set(present);
|
|
12752
13017
|
return Object.keys(readLocalEnvFile(file)).filter((key) => !have.has(key) && !SUPPLIED.test(key)).sort();
|
|
12753
13018
|
}
|
|
@@ -12834,7 +13099,7 @@ var OptionsSchema3 = v10.object({
|
|
|
12834
13099
|
});
|
|
12835
13100
|
var deploy = addLockWaitOption(
|
|
12836
13101
|
addTargetOptions(
|
|
12837
|
-
new
|
|
13102
|
+
new Command82("deploy").description("deploy the app").configureHelp(helpConfig),
|
|
12838
13103
|
"production"
|
|
12839
13104
|
)
|
|
12840
13105
|
).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(
|
|
@@ -12851,7 +13116,6 @@ var deploy = addLockWaitOption(
|
|
|
12851
13116
|
const options = parseOptions(OptionsSchema3, raw);
|
|
12852
13117
|
const backend3 = hasBackend();
|
|
12853
13118
|
p47.intro(pc19.bgCyan(pc19.black(" vela deploy ")));
|
|
12854
|
-
assertKit3(findWorkspaceRoot() ?? process36.cwd(), "vela deploy");
|
|
12855
13119
|
if (options.build !== false) {
|
|
12856
13120
|
const { workspaceRootDir } = await getWorkspace();
|
|
12857
13121
|
await prepareAdapter(workspaceRootDir);
|
|
@@ -13097,7 +13361,8 @@ ${pc19.cyan(err.snippet)}` : err.message);
|
|
|
13097
13361
|
current = detectAdapter(workspaceRootDir);
|
|
13098
13362
|
} catch {
|
|
13099
13363
|
}
|
|
13100
|
-
|
|
13364
|
+
const editable = current !== void 0 && !/^svelte\.config\./.test(path56.basename(current.file));
|
|
13365
|
+
if (current && editable && (current.kind === "auto" || current.kind === "none") && isInteractive()) {
|
|
13101
13366
|
const has = current.kind === "auto" ? `is on ${ADAPTER_AUTO}` : "has no SvelteKit adapter configured";
|
|
13102
13367
|
const confirmed = await p47.confirm({
|
|
13103
13368
|
message: `This project ${has}, and vela deploy runs the app as a Node server.
|
|
@@ -13132,6 +13397,8 @@ Switch it to ${ADAPTER_NODE}? This edits ${path56.basename(current.file)} and pa
|
|
|
13132
13397
|
p47.log.warn(`Commit ${changed.join(", ")} so every deploy builds the same way.`);
|
|
13133
13398
|
}
|
|
13134
13399
|
function ssrExternalPreflight(root) {
|
|
13400
|
+
const major = kitMajor(root);
|
|
13401
|
+
if (major !== null && major < 3) return;
|
|
13135
13402
|
let adapter;
|
|
13136
13403
|
try {
|
|
13137
13404
|
adapter = detectAdapter(root);
|
|
@@ -13223,7 +13490,7 @@ async function uploadRelease(session, instance, release, entries) {
|
|
|
13223
13490
|
}
|
|
13224
13491
|
function isDirectory(target) {
|
|
13225
13492
|
try {
|
|
13226
|
-
return
|
|
13493
|
+
return fs51.statSync(target).isDirectory();
|
|
13227
13494
|
} catch {
|
|
13228
13495
|
return false;
|
|
13229
13496
|
}
|
|
@@ -13266,10 +13533,10 @@ async function serverTimeOrLocal(session) {
|
|
|
13266
13533
|
// src/commands/link.ts
|
|
13267
13534
|
import path57 from "node:path";
|
|
13268
13535
|
import process37 from "node:process";
|
|
13269
|
-
import { Command as
|
|
13536
|
+
import { Command as Command83 } from "commander";
|
|
13270
13537
|
import * as p48 from "@clack/prompts";
|
|
13271
13538
|
var CREATE_NEW = "__new__";
|
|
13272
|
-
var link = new
|
|
13539
|
+
var link = new Command83("link").description("link this project to a velastack.dev project").configureHelp(helpConfig).action(() => runCommand(linkProject, "Failed to link the project."));
|
|
13273
13540
|
async function linkProject() {
|
|
13274
13541
|
const { workspaceRootDir } = await getWorkspace();
|
|
13275
13542
|
const existing = readProjectConfig(workspaceRootDir);
|
|
@@ -13336,26 +13603,26 @@ function defaultProjectName2(workspaceRootDir) {
|
|
|
13336
13603
|
}
|
|
13337
13604
|
|
|
13338
13605
|
// src/commands/env.ts
|
|
13339
|
-
import { Command as
|
|
13606
|
+
import { Command as Command89 } from "commander";
|
|
13340
13607
|
|
|
13341
13608
|
// src/commands/env/list.ts
|
|
13342
|
-
import { Command as
|
|
13609
|
+
import { Command as Command84 } from "commander";
|
|
13343
13610
|
import * as v12 from "valibot";
|
|
13344
13611
|
import * as p51 from "@clack/prompts";
|
|
13345
13612
|
import pc22 from "picocolors";
|
|
13346
13613
|
|
|
13347
13614
|
// src/lib/local-env.ts
|
|
13348
|
-
import
|
|
13615
|
+
import fs52 from "node:fs";
|
|
13349
13616
|
import * as p49 from "@clack/prompts";
|
|
13350
13617
|
import pc20 from "picocolors";
|
|
13351
13618
|
function readLocalEnv(envFile) {
|
|
13352
|
-
if (!
|
|
13619
|
+
if (!fs52.existsSync(envFile)) return {};
|
|
13353
13620
|
return readLocalEnvFile(envFile);
|
|
13354
13621
|
}
|
|
13355
13622
|
function editLocalEnv(envFile, edit) {
|
|
13356
|
-
const before =
|
|
13623
|
+
const before = fs52.existsSync(envFile) ? fs52.readFileSync(envFile, "utf8") : "";
|
|
13357
13624
|
const after = edit(before);
|
|
13358
|
-
if (after !== before)
|
|
13625
|
+
if (after !== before) fs52.writeFileSync(envFile, after);
|
|
13359
13626
|
}
|
|
13360
13627
|
function setLocalEnv(envFile, key, value) {
|
|
13361
13628
|
editLocalEnv(envFile, (content) => upsertEnvVar(content, key, value));
|
|
@@ -13524,8 +13791,8 @@ async function promptScope(workspaceRootDir, label2) {
|
|
|
13524
13791
|
return parseEnvScope(choice);
|
|
13525
13792
|
}
|
|
13526
13793
|
function readAtBuildTime(workspaceRootDir, keys) {
|
|
13527
|
-
const
|
|
13528
|
-
return keys.filter((key) => names.has(key));
|
|
13794
|
+
const fixed = staticEnv(workspaceRootDir);
|
|
13795
|
+
return { baked: keys.filter((key) => fixed.names.has(key)), how: fixed.how };
|
|
13529
13796
|
}
|
|
13530
13797
|
async function applyLayerRestart(ctx, changed) {
|
|
13531
13798
|
if (touchesSuperuser(changed)) {
|
|
@@ -13542,6 +13809,13 @@ Run ${pc21.cyan("vela deploy")} for every target to push them in.`
|
|
|
13542
13809
|
return;
|
|
13543
13810
|
}
|
|
13544
13811
|
for (const state of ctx.reached) {
|
|
13812
|
+
const shadowed = await shadowedKeys(ctx.session, ctx.appId, state, ctx.layer, changed);
|
|
13813
|
+
const reach = changed.filter((key) => !(key in shadowed));
|
|
13814
|
+
if (Object.keys(shadowed).length > 0) p50.log.warn(shadowWarning(state, ctx.layer, shadowed));
|
|
13815
|
+
if (reach.length === 0) {
|
|
13816
|
+
p50.log.info(`${state.env} not restarted ${pc21.dim(`(${ctx.server})`)}`);
|
|
13817
|
+
continue;
|
|
13818
|
+
}
|
|
13545
13819
|
const outcome = await restartInstance(ctx.session, state.instance);
|
|
13546
13820
|
if (!outcome.deployed) continue;
|
|
13547
13821
|
if (outcome.restarted) p50.log.success(`${state.env} restarted ${pc21.dim(`(${ctx.server})`)}`);
|
|
@@ -13555,11 +13829,37 @@ ${pc21.dim(outcome.error ?? "")}`
|
|
|
13555
13829
|
}
|
|
13556
13830
|
}
|
|
13557
13831
|
}
|
|
13832
|
+
function shadowWarning(state, layer, shadowed) {
|
|
13833
|
+
const lines = [];
|
|
13834
|
+
const byLayer = /* @__PURE__ */ new Map();
|
|
13835
|
+
for (const [key, above] of Object.entries(shadowed)) {
|
|
13836
|
+
byLayer.set(above, [...byLayer.get(above) ?? [], key]);
|
|
13837
|
+
}
|
|
13838
|
+
for (const [above, keys] of byLayer) {
|
|
13839
|
+
const list3 = keys.join(", ");
|
|
13840
|
+
const plural = keys.length > 1;
|
|
13841
|
+
if (above === "preview") {
|
|
13842
|
+
lines.push(
|
|
13843
|
+
`The preview layer sets ${list3} too, and wins over ${layer} for ${state.env}.`,
|
|
13844
|
+
`To use the ${layer} value${plural ? "s" : ""} there: ${pc21.cyan(`vela env unset ${plural ? "<key>" : list3} -t preview`)}`
|
|
13845
|
+
);
|
|
13846
|
+
} else if (state.preview) {
|
|
13847
|
+
lines.push(`${state.env} sets ${list3} itself, which wins over ${layer}.`);
|
|
13848
|
+
} else {
|
|
13849
|
+
const target = state.env === PROD_ENV ? PRODUCTION_TARGET : state.env;
|
|
13850
|
+
lines.push(
|
|
13851
|
+
`${state.env} sets ${list3} itself, which wins over ${layer}.`,
|
|
13852
|
+
`To use the ${layer} value${plural ? "s" : ""} there: ${pc21.cyan(`vela env unset ${plural ? "<key>" : list3} -t ${target}`)}`
|
|
13853
|
+
);
|
|
13854
|
+
}
|
|
13855
|
+
}
|
|
13856
|
+
return lines.join("\n");
|
|
13857
|
+
}
|
|
13558
13858
|
async function applyChange(workspaceRootDir, ctx, changed) {
|
|
13559
|
-
const baked = readAtBuildTime(workspaceRootDir, changed);
|
|
13859
|
+
const { baked, how } = readAtBuildTime(workspaceRootDir, changed);
|
|
13560
13860
|
if (baked.length > 0) {
|
|
13561
13861
|
p50.log.info(
|
|
13562
|
-
`${baked.join(", ")} ${baked.length === 1 ? "is" : "are"} read at build time (${pc21.cyan(
|
|
13862
|
+
`${baked.join(", ")} ${baked.length === 1 ? "is" : "are"} read at build time (${pc21.cyan(how)}); redeploy to apply.`
|
|
13563
13863
|
);
|
|
13564
13864
|
const rest = changed.filter((key) => !baked.includes(key));
|
|
13565
13865
|
if (rest.length === 0) return;
|
|
@@ -13578,7 +13878,7 @@ var OptionsSchema5 = v12.object({
|
|
|
13578
13878
|
var HIDDEN = "\u2022\u2022\u2022\u2022";
|
|
13579
13879
|
var MAX_VALUE = 32;
|
|
13580
13880
|
var envList = addEnvTargetOptions(
|
|
13581
|
-
new
|
|
13881
|
+
new Command84("list").description("list environment variables \u2014 every scope at once without -t").configureHelp(helpConfig)
|
|
13582
13882
|
).action(
|
|
13583
13883
|
(raw) => runCommand(async () => {
|
|
13584
13884
|
const options = parseOptions(OptionsSchema5, raw);
|
|
@@ -13744,11 +14044,11 @@ function plain(text18) {
|
|
|
13744
14044
|
|
|
13745
14045
|
// src/commands/env/set.ts
|
|
13746
14046
|
import process39 from "node:process";
|
|
13747
|
-
import { Command as
|
|
14047
|
+
import { Command as Command85 } from "commander";
|
|
13748
14048
|
import * as p52 from "@clack/prompts";
|
|
13749
14049
|
import pc23 from "picocolors";
|
|
13750
14050
|
var envSet = addEnvTargetOptions(
|
|
13751
|
-
new
|
|
14051
|
+
new Command85("set").description("set an environment variable \u2014 the value is prompted for, never an argument").argument("<key>", "variable name").option(
|
|
13752
14052
|
"--public",
|
|
13753
14053
|
"readable back with `vela env list` and `vela env get`; PUBLIC_* keys are public regardless"
|
|
13754
14054
|
).configureHelp(helpConfig)
|
|
@@ -13806,11 +14106,11 @@ async function promptValue2(key, visibility) {
|
|
|
13806
14106
|
}
|
|
13807
14107
|
|
|
13808
14108
|
// src/commands/env/unset.ts
|
|
13809
|
-
import { Command as
|
|
14109
|
+
import { Command as Command86 } from "commander";
|
|
13810
14110
|
import * as p53 from "@clack/prompts";
|
|
13811
14111
|
import pc24 from "picocolors";
|
|
13812
14112
|
var envUnset = addEnvTargetOptions(
|
|
13813
|
-
new
|
|
14113
|
+
new Command86("unset").description("remove an environment variable").argument("<key>", "variable name").configureHelp(helpConfig)
|
|
13814
14114
|
).action(
|
|
13815
14115
|
(key, raw) => runCommand(
|
|
13816
14116
|
() => withEnvScope(
|
|
@@ -13851,14 +14151,14 @@ var envUnset = addEnvTargetOptions(
|
|
|
13851
14151
|
);
|
|
13852
14152
|
|
|
13853
14153
|
// src/commands/env/import.ts
|
|
13854
|
-
import
|
|
14154
|
+
import fs53 from "node:fs";
|
|
13855
14155
|
import path58 from "node:path";
|
|
13856
14156
|
import process40 from "node:process";
|
|
13857
|
-
import { Command as
|
|
14157
|
+
import { Command as Command87 } from "commander";
|
|
13858
14158
|
import * as p54 from "@clack/prompts";
|
|
13859
14159
|
import pc25 from "picocolors";
|
|
13860
14160
|
var envImport = addEnvTargetOptions(
|
|
13861
|
-
new
|
|
14161
|
+
new Command87("import").description("merge a dotenv file into the environment").argument("<file>", "dotenv file to read").option("--public", "import as readable values; PUBLIC_* keys are public regardless").configureHelp(helpConfig)
|
|
13862
14162
|
).action(
|
|
13863
14163
|
(file, raw) => runCommand(
|
|
13864
14164
|
() => withEnvScope(
|
|
@@ -13926,7 +14226,7 @@ function resolve(file) {
|
|
|
13926
14226
|
return path58.resolve(process40.cwd(), file);
|
|
13927
14227
|
}
|
|
13928
14228
|
function read(resolved, shown) {
|
|
13929
|
-
if (!
|
|
14229
|
+
if (!fs53.existsSync(resolved)) throw new Error(`${shown} does not exist.`);
|
|
13930
14230
|
const incoming = readLocalEnvFile(resolved);
|
|
13931
14231
|
if (Object.keys(incoming).length === 0) p54.log.info(`${shown} has no variables to import.`);
|
|
13932
14232
|
return incoming;
|
|
@@ -13934,11 +14234,11 @@ function read(resolved, shown) {
|
|
|
13934
14234
|
|
|
13935
14235
|
// src/commands/env/get.ts
|
|
13936
14236
|
import process41 from "node:process";
|
|
13937
|
-
import { Command as
|
|
14237
|
+
import { Command as Command88 } from "commander";
|
|
13938
14238
|
import * as p55 from "@clack/prompts";
|
|
13939
14239
|
import pc26 from "picocolors";
|
|
13940
14240
|
var envGet = addEnvTargetOptions(
|
|
13941
|
-
new
|
|
14241
|
+
new Command88("get").description("print a public environment variable").argument("<key>", "variable name").configureHelp(helpConfig)
|
|
13942
14242
|
).action(
|
|
13943
14243
|
(key, raw) => runCommand(
|
|
13944
14244
|
() => withEnvScope(
|
|
@@ -13986,14 +14286,14 @@ Set it again to change it: ${pc26.cyan(`vela env set ${key}`)}`
|
|
|
13986
14286
|
}
|
|
13987
14287
|
|
|
13988
14288
|
// src/commands/env.ts
|
|
13989
|
-
var env = new
|
|
14289
|
+
var env = new Command89("env").description("manage environment variables, locally or on a target").configureHelp(helpConfig).addCommand(envList).addCommand(envGet).addCommand(envSet).addCommand(envUnset).addCommand(envImport);
|
|
13990
14290
|
|
|
13991
14291
|
// src/commands/status.ts
|
|
13992
|
-
import { Command as
|
|
14292
|
+
import { Command as Command90 } from "commander";
|
|
13993
14293
|
import * as p56 from "@clack/prompts";
|
|
13994
14294
|
import pc27 from "picocolors";
|
|
13995
14295
|
var status = addTargetOptions(
|
|
13996
|
-
new
|
|
14296
|
+
new Command90("status").description("show what is deployed").configureHelp(helpConfig),
|
|
13997
14297
|
"production"
|
|
13998
14298
|
).option("--all", "show every app on the server, not just this project").option("--json", "print raw JSON").action(
|
|
13999
14299
|
(raw) => runCommand(async () => {
|
|
@@ -14052,12 +14352,12 @@ function describe2(state) {
|
|
|
14052
14352
|
}
|
|
14053
14353
|
|
|
14054
14354
|
// src/commands/rollback.ts
|
|
14055
|
-
import { Command as
|
|
14355
|
+
import { Command as Command91 } from "commander";
|
|
14056
14356
|
import * as p57 from "@clack/prompts";
|
|
14057
14357
|
import pc28 from "picocolors";
|
|
14058
14358
|
var rollback = addLockWaitOption(
|
|
14059
14359
|
addTargetOptions(
|
|
14060
|
-
new
|
|
14360
|
+
new Command91("rollback").description("put the previous release back").configureHelp(helpConfig),
|
|
14061
14361
|
"production"
|
|
14062
14362
|
)
|
|
14063
14363
|
).option("--to <release>", "roll back to a specific release instead of the previous one").action(
|
|
@@ -14096,7 +14396,7 @@ var rollback = addLockWaitOption(
|
|
|
14096
14396
|
);
|
|
14097
14397
|
|
|
14098
14398
|
// src/commands/logs.ts
|
|
14099
|
-
import { Command as
|
|
14399
|
+
import { Command as Command92 } from "commander";
|
|
14100
14400
|
|
|
14101
14401
|
// src/lib/remote-pocketbase.ts
|
|
14102
14402
|
import PocketBase6 from "pocketbase";
|
|
@@ -14147,7 +14447,7 @@ async function withRemotePocketbase(session, instance, fn) {
|
|
|
14147
14447
|
|
|
14148
14448
|
// src/commands/logs.ts
|
|
14149
14449
|
var logs = addTargetOptions(
|
|
14150
|
-
new
|
|
14450
|
+
new Command92("logs").description("tail the logs of a deployed app").configureHelp(helpConfig),
|
|
14151
14451
|
"production"
|
|
14152
14452
|
).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(
|
|
14153
14453
|
(raw) => runCommand(async () => {
|
|
@@ -14182,16 +14482,16 @@ var logs = addTargetOptions(
|
|
|
14182
14482
|
);
|
|
14183
14483
|
|
|
14184
14484
|
// src/commands/admin.ts
|
|
14185
|
-
import { Command as
|
|
14485
|
+
import { Command as Command94 } from "commander";
|
|
14186
14486
|
|
|
14187
14487
|
// src/commands/admin/create.ts
|
|
14188
14488
|
import process42 from "node:process";
|
|
14189
|
-
import { Command as
|
|
14489
|
+
import { Command as Command93 } from "commander";
|
|
14190
14490
|
import * as p58 from "@clack/prompts";
|
|
14191
14491
|
import pc29 from "picocolors";
|
|
14192
14492
|
var MIN_PASSWORD = 10;
|
|
14193
14493
|
var adminCreate = addTargetOptions(
|
|
14194
|
-
new
|
|
14494
|
+
new Command93("create").description("create a login for the admin panel").argument("[email]", "email to sign in with \u2014 prompted for when omitted").configureHelp(helpConfig),
|
|
14195
14495
|
"local"
|
|
14196
14496
|
).action(
|
|
14197
14497
|
(email2, raw) => runCommand(
|
|
@@ -14309,15 +14609,15 @@ async function promptPassword2() {
|
|
|
14309
14609
|
}
|
|
14310
14610
|
|
|
14311
14611
|
// src/commands/admin.ts
|
|
14312
|
-
var admin = new
|
|
14612
|
+
var admin = new Command94("admin").description("manage admin panel logins").configureHelp(helpConfig).addCommand(adminCreate);
|
|
14313
14613
|
|
|
14314
14614
|
// src/commands/backup.ts
|
|
14315
|
-
import { Command as
|
|
14615
|
+
import { Command as Command100 } from "commander";
|
|
14316
14616
|
|
|
14317
14617
|
// src/commands/backup/create.ts
|
|
14318
|
-
import
|
|
14618
|
+
import fs54 from "node:fs";
|
|
14319
14619
|
import path59 from "node:path";
|
|
14320
|
-
import { Command as
|
|
14620
|
+
import { Command as Command95 } from "commander";
|
|
14321
14621
|
import * as p59 from "@clack/prompts";
|
|
14322
14622
|
import pc31 from "picocolors";
|
|
14323
14623
|
|
|
@@ -14466,7 +14766,7 @@ async function writeSchedule(pb, cron, maxKeep) {
|
|
|
14466
14766
|
// src/commands/backup/create.ts
|
|
14467
14767
|
var DEFAULT_BACKUP_DIR = "backups";
|
|
14468
14768
|
var backupCreate = addTargetOptions(
|
|
14469
|
-
new
|
|
14769
|
+
new Command95("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),
|
|
14470
14770
|
"production"
|
|
14471
14771
|
).action(
|
|
14472
14772
|
(name, raw) => runCommand(() => {
|
|
@@ -14531,10 +14831,10 @@ Your bucket's own versioning is what protects the uploaded files.`
|
|
|
14531
14831
|
);
|
|
14532
14832
|
async function download(ctx, key, outputDir) {
|
|
14533
14833
|
const dir = path59.resolve(ctx.workspaceRootDir, outputDir);
|
|
14534
|
-
|
|
14834
|
+
fs54.mkdirSync(dir, { recursive: true });
|
|
14535
14835
|
const destination = path59.join(dir, key);
|
|
14536
14836
|
if (!ctx.session) {
|
|
14537
|
-
|
|
14837
|
+
fs54.copyFileSync(path59.join(ctx.workspaceRootDir, "data", "backups", key), destination);
|
|
14538
14838
|
return path59.relative(ctx.workspaceRootDir, destination);
|
|
14539
14839
|
}
|
|
14540
14840
|
const spinner9 = p59.spinner();
|
|
@@ -14550,11 +14850,11 @@ async function download(ctx, key, outputDir) {
|
|
|
14550
14850
|
}
|
|
14551
14851
|
|
|
14552
14852
|
// src/commands/backup/list.ts
|
|
14553
|
-
import { Command as
|
|
14853
|
+
import { Command as Command96 } from "commander";
|
|
14554
14854
|
import * as p60 from "@clack/prompts";
|
|
14555
14855
|
import pc32 from "picocolors";
|
|
14556
14856
|
var backupList = addTargetOptions(
|
|
14557
|
-
new
|
|
14857
|
+
new Command96("list").description("list the backups on a target").configureHelp(helpConfig),
|
|
14558
14858
|
"production"
|
|
14559
14859
|
).action(
|
|
14560
14860
|
(raw) => runCommand(
|
|
@@ -14580,13 +14880,13 @@ Take one with ${pc32.cyan("vela backup create")}.`
|
|
|
14580
14880
|
);
|
|
14581
14881
|
|
|
14582
14882
|
// src/commands/backup/download.ts
|
|
14583
|
-
import
|
|
14883
|
+
import fs55 from "node:fs";
|
|
14584
14884
|
import path60 from "node:path";
|
|
14585
|
-
import { Command as
|
|
14885
|
+
import { Command as Command97 } from "commander";
|
|
14586
14886
|
import * as p61 from "@clack/prompts";
|
|
14587
14887
|
import pc33 from "picocolors";
|
|
14588
14888
|
var backupDownload = addTargetOptions(
|
|
14589
|
-
new
|
|
14889
|
+
new Command97("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),
|
|
14590
14890
|
"production"
|
|
14591
14891
|
).action(
|
|
14592
14892
|
(key, raw) => runCommand(() => {
|
|
@@ -14609,10 +14909,10 @@ Fetch it from the bucket directly \u2014 vela does not hold its credentials.`
|
|
|
14609
14909
|
);
|
|
14610
14910
|
}
|
|
14611
14911
|
const dir = path60.resolve(ctx.workspaceRootDir, options.output);
|
|
14612
|
-
|
|
14912
|
+
fs55.mkdirSync(dir, { recursive: true });
|
|
14613
14913
|
const destination = path60.join(dir, key);
|
|
14614
14914
|
if (!ctx.session) {
|
|
14615
|
-
|
|
14915
|
+
fs55.copyFileSync(path60.join(ctx.workspaceRootDir, "data", "backups", key), destination);
|
|
14616
14916
|
} else {
|
|
14617
14917
|
const spinner9 = p61.spinner();
|
|
14618
14918
|
spinner9.start(`Downloading ${key} (${formatBytes(found.size)})`);
|
|
@@ -14634,11 +14934,11 @@ Fetch it from the bucket directly \u2014 vela does not hold its credentials.`
|
|
|
14634
14934
|
|
|
14635
14935
|
// src/commands/backup/delete.ts
|
|
14636
14936
|
import process43 from "node:process";
|
|
14637
|
-
import { Command as
|
|
14937
|
+
import { Command as Command98 } from "commander";
|
|
14638
14938
|
import * as p62 from "@clack/prompts";
|
|
14639
14939
|
import pc34 from "picocolors";
|
|
14640
14940
|
var backupDelete = addTargetOptions(
|
|
14641
|
-
new
|
|
14941
|
+
new Command98("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),
|
|
14642
14942
|
"production"
|
|
14643
14943
|
).action(
|
|
14644
14944
|
(key, raw) => runCommand(() => {
|
|
@@ -14669,12 +14969,12 @@ Run ${pc34.cyan("vela backup list")} to see what it does have.`
|
|
|
14669
14969
|
);
|
|
14670
14970
|
|
|
14671
14971
|
// src/commands/backup/schedule.ts
|
|
14672
|
-
import { Command as
|
|
14972
|
+
import { Command as Command99 } from "commander";
|
|
14673
14973
|
import * as p63 from "@clack/prompts";
|
|
14674
14974
|
import pc35 from "picocolors";
|
|
14675
14975
|
var DEFAULT_KEEP = 7;
|
|
14676
14976
|
var backupSchedule = addTargetOptions(
|
|
14677
|
-
new
|
|
14977
|
+
new Command99("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),
|
|
14678
14978
|
"production"
|
|
14679
14979
|
).action(
|
|
14680
14980
|
(cron, raw) => runCommand(() => {
|
|
@@ -14718,18 +15018,18 @@ Set one with ${pc35.cyan('vela backup schedule "0 3 * * *"')}.`
|
|
|
14718
15018
|
);
|
|
14719
15019
|
|
|
14720
15020
|
// src/commands/backup.ts
|
|
14721
|
-
var backup = new
|
|
15021
|
+
var backup = new Command100("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);
|
|
14722
15022
|
|
|
14723
15023
|
// src/commands/restore.ts
|
|
14724
|
-
import
|
|
15024
|
+
import fs56 from "node:fs";
|
|
14725
15025
|
import path61 from "node:path";
|
|
14726
15026
|
import process44 from "node:process";
|
|
14727
|
-
import { Command as
|
|
15027
|
+
import { Command as Command101 } from "commander";
|
|
14728
15028
|
import * as p64 from "@clack/prompts";
|
|
14729
15029
|
import pc36 from "picocolors";
|
|
14730
15030
|
var restore = addLockWaitOption(
|
|
14731
15031
|
addTargetOptions(
|
|
14732
|
-
new
|
|
15032
|
+
new Command101("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),
|
|
14733
15033
|
"production"
|
|
14734
15034
|
)
|
|
14735
15035
|
).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(
|
|
@@ -14752,7 +15052,7 @@ Run \`vela deploy\` first, then restore.`
|
|
|
14752
15052
|
`${ctx.targetName} was deployed without a database, so there is nothing to restore.`
|
|
14753
15053
|
);
|
|
14754
15054
|
}
|
|
14755
|
-
const local = source &&
|
|
15055
|
+
const local = source && fs56.existsSync(source) ? source : void 0;
|
|
14756
15056
|
const key = local ? void 0 : await resolveKey(ctx, source);
|
|
14757
15057
|
if (!options.yes) {
|
|
14758
15058
|
await confirm13(ctx.appName, ctx.targetName, ctx.envTag, local ?? key);
|
|
@@ -14878,7 +15178,7 @@ async function confirm13(appName, targetName, envTag, from) {
|
|
|
14878
15178
|
}
|
|
14879
15179
|
|
|
14880
15180
|
// src/commands/targets.ts
|
|
14881
|
-
import { Command as
|
|
15181
|
+
import { Command as Command102 } from "commander";
|
|
14882
15182
|
import * as p65 from "@clack/prompts";
|
|
14883
15183
|
import pc37 from "picocolors";
|
|
14884
15184
|
import * as v13 from "valibot";
|
|
@@ -14888,7 +15188,7 @@ var OptionsSchema6 = v13.object({
|
|
|
14888
15188
|
offline: v13.optional(v13.boolean())
|
|
14889
15189
|
});
|
|
14890
15190
|
var targets = addSshOptions(
|
|
14891
|
-
new
|
|
15191
|
+
new Command102("targets").description("list the targets this project can deploy to").configureHelp(helpConfig)
|
|
14892
15192
|
).option("--json", "print raw JSON").option("--offline", "skip connecting to servers").action(
|
|
14893
15193
|
(raw) => runCommand(async () => {
|
|
14894
15194
|
const options = parseOptions(OptionsSchema6, raw);
|
|
@@ -14967,20 +15267,20 @@ Release and domain are shown from what this project recorded.`
|
|
|
14967
15267
|
// src/commands/test.ts
|
|
14968
15268
|
import path62 from "node:path";
|
|
14969
15269
|
import process45 from "node:process";
|
|
14970
|
-
import { Command as
|
|
15270
|
+
import { Command as Command103 } from "commander";
|
|
14971
15271
|
import PocketBase7 from "pocketbase";
|
|
14972
15272
|
import pc38 from "picocolors";
|
|
14973
15273
|
import { x as x6 } from "tinyexec";
|
|
14974
15274
|
import { detect as detect9 } from "package-manager-detector";
|
|
14975
15275
|
import { resolveCommand as resolveCommand7 } from "package-manager-detector/commands";
|
|
14976
|
-
import
|
|
14977
|
-
var testServer = new
|
|
15276
|
+
import fs57 from "node:fs";
|
|
15277
|
+
var testServer = new Command103("test:server").description("run server tests").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(async (_opts, cmd) => {
|
|
14978
15278
|
const cwd = process45.cwd();
|
|
14979
15279
|
warnIfKit2(cwd, (m) => console.warn(pc38.yellow(`\u25B2 ${m}`)));
|
|
14980
15280
|
const email2 = `test-${Math.random().toString(36).slice(2)}@example.com`;
|
|
14981
15281
|
const password9 = "password";
|
|
14982
15282
|
const testDataDir = path62.join(cwd, "test-data");
|
|
14983
|
-
|
|
15283
|
+
fs57.rmSync(testDataDir, { recursive: true, force: true });
|
|
14984
15284
|
const { stop, url } = await launchPocketbase(cwd, {
|
|
14985
15285
|
dir: testDataDir,
|
|
14986
15286
|
migrationsDir: path62.join(cwd, MIGRATIONS_DIR),
|
|
@@ -15003,7 +15303,7 @@ var testServer = new Command101("test:server").description("run server tests").a
|
|
|
15003
15303
|
if (cleanedUp) return;
|
|
15004
15304
|
cleanedUp = true;
|
|
15005
15305
|
stop();
|
|
15006
|
-
|
|
15306
|
+
fs57.rmSync(testDataDir, { recursive: true, force: true });
|
|
15007
15307
|
};
|
|
15008
15308
|
const cleanup = async () => {
|
|
15009
15309
|
if (cleanedUp) return;
|
|
@@ -15116,9 +15416,9 @@ function stubPagesPlugin() {
|
|
|
15116
15416
|
}
|
|
15117
15417
|
|
|
15118
15418
|
// src/commands/routes.ts
|
|
15119
|
-
import
|
|
15419
|
+
import fs58 from "node:fs";
|
|
15120
15420
|
import path63 from "node:path";
|
|
15121
|
-
import { Command as
|
|
15421
|
+
import { Command as Command104 } from "commander";
|
|
15122
15422
|
var HTTP_METHODS = /* @__PURE__ */ new Set([
|
|
15123
15423
|
"GET",
|
|
15124
15424
|
"POST",
|
|
@@ -15129,7 +15429,7 @@ var HTTP_METHODS = /* @__PURE__ */ new Set([
|
|
|
15129
15429
|
"HEAD",
|
|
15130
15430
|
"fallback"
|
|
15131
15431
|
]);
|
|
15132
|
-
var routes = new
|
|
15432
|
+
var routes = new Command104("routes").description("list routes").configureHelp(helpConfig).action(async () => {
|
|
15133
15433
|
const { workspaceRootDir, routesDir } = await getWorkspace();
|
|
15134
15434
|
const routesRoot = path63.join(workspaceRootDir, routesDir);
|
|
15135
15435
|
const found = walk(routesRoot, routesRoot).filter((r) => r.methods.length > 0);
|
|
@@ -15137,7 +15437,7 @@ var routes = new Command102("routes").description("list routes").configureHelp(h
|
|
|
15137
15437
|
printTable(found);
|
|
15138
15438
|
});
|
|
15139
15439
|
function walk(root, dir) {
|
|
15140
|
-
const entries =
|
|
15440
|
+
const entries = fs58.readdirSync(dir, { withFileTypes: true });
|
|
15141
15441
|
const routes2 = [];
|
|
15142
15442
|
const hasLeaf = entries.some((e) => e.isFile() && isRouteFile(e.name));
|
|
15143
15443
|
if (hasLeaf) {
|
|
@@ -15163,7 +15463,7 @@ function isRouteFile(name) {
|
|
|
15163
15463
|
}
|
|
15164
15464
|
function extractMethods(file) {
|
|
15165
15465
|
try {
|
|
15166
|
-
const content =
|
|
15466
|
+
const content = fs58.readFileSync(file, "utf8");
|
|
15167
15467
|
const methods = [];
|
|
15168
15468
|
const exportRegex = /export\s+(?:const|async\s+function|function)\s+(\w+)/g;
|
|
15169
15469
|
let match;
|
|
@@ -15204,17 +15504,17 @@ function printTable(routes2) {
|
|
|
15204
15504
|
}
|
|
15205
15505
|
|
|
15206
15506
|
// src/commands/i18n.ts
|
|
15207
|
-
import
|
|
15507
|
+
import fs59 from "node:fs";
|
|
15208
15508
|
import path64 from "node:path";
|
|
15209
15509
|
import process46 from "node:process";
|
|
15210
|
-
import { Command as
|
|
15510
|
+
import { Command as Command105 } from "commander";
|
|
15211
15511
|
import { x as x7 } from "tinyexec";
|
|
15212
15512
|
import { detect as detect10 } from "package-manager-detector";
|
|
15213
15513
|
import { resolveCommand as resolveCommand8 } from "package-manager-detector/commands";
|
|
15214
15514
|
var WUCHALE_CONFIG_NAMES = ["js", "mjs", "ts", "mts"].map((ext) => `wuchale.config.${ext}`);
|
|
15215
15515
|
async function runWuchale(extraArgs) {
|
|
15216
15516
|
const cwd = findWorkspaceRoot() ?? process46.cwd();
|
|
15217
|
-
if (!WUCHALE_CONFIG_NAMES.some((name) =>
|
|
15517
|
+
if (!WUCHALE_CONFIG_NAMES.some((name) => fs59.existsSync(path64.join(cwd, name)))) {
|
|
15218
15518
|
throw new Error("No wuchale config found. Run `vela enable i18n` to set up i18n.");
|
|
15219
15519
|
}
|
|
15220
15520
|
const pm = (await detect10({ cwd }))?.name ?? "npm";
|
|
@@ -15226,24 +15526,24 @@ async function runWuchale(extraArgs) {
|
|
|
15226
15526
|
throwOnError: true
|
|
15227
15527
|
});
|
|
15228
15528
|
}
|
|
15229
|
-
var extract2 = new
|
|
15230
|
-
var watch = new
|
|
15231
|
-
var status2 = new
|
|
15232
|
-
var clean = new
|
|
15233
|
-
var i18n3 = new
|
|
15529
|
+
var extract2 = new Command105("extract").description("extract translatable strings").configureHelp(helpConfig).action(() => runCommand(() => runWuchale([])));
|
|
15530
|
+
var watch = new Command105("watch").description("watch and extract translatable strings").configureHelp(helpConfig).action(() => runCommand(() => runWuchale(["--watch"])));
|
|
15531
|
+
var status2 = new Command105("status").description("show i18n status").configureHelp(helpConfig).action(() => runCommand(() => runWuchale(["status"])));
|
|
15532
|
+
var clean = new Command105("clean").description("clean unused translatable strings").configureHelp(helpConfig).action(() => runCommand(() => runWuchale(["--clean"])));
|
|
15533
|
+
var i18n3 = new Command105("i18n").description("i18n utilities").configureHelp(helpConfig).addCommand(extract2, { isDefault: true }).addCommand(watch).addCommand(status2).addCommand(clean);
|
|
15234
15534
|
|
|
15235
15535
|
// src/commands/cms.ts
|
|
15236
|
-
import { Command as
|
|
15536
|
+
import { Command as Command111 } from "commander";
|
|
15237
15537
|
|
|
15238
15538
|
// src/commands/cms/deploy.ts
|
|
15239
15539
|
import process47 from "node:process";
|
|
15240
|
-
import { Command as
|
|
15540
|
+
import { Command as Command106 } from "commander";
|
|
15241
15541
|
import * as p66 from "@clack/prompts";
|
|
15242
15542
|
import pc39 from "picocolors";
|
|
15243
15543
|
var POLL_INTERVAL2 = 5e3;
|
|
15244
15544
|
var POLL_TIMEOUT = 30 * 6e4;
|
|
15245
15545
|
var inFlight = (run) => run?.status === "pending" || run?.status === "building";
|
|
15246
|
-
var deploy2 = new
|
|
15546
|
+
var deploy2 = new Command106("deploy").description("rebuild the hosted site with the latest published content").option(
|
|
15247
15547
|
"--project <id>",
|
|
15248
15548
|
"velastack.dev project whose site to rebuild, instead of the linked one"
|
|
15249
15549
|
).option("--no-wait", "return once the build has started instead of waiting for it").configureHelp(helpConfig).action(
|
|
@@ -15332,11 +15632,11 @@ async function waitForRun(apiKey, projectId, runId) {
|
|
|
15332
15632
|
}
|
|
15333
15633
|
|
|
15334
15634
|
// src/commands/cms/editor.ts
|
|
15335
|
-
import { Command as
|
|
15635
|
+
import { Command as Command110 } from "commander";
|
|
15336
15636
|
|
|
15337
15637
|
// src/commands/cms/editor/add.ts
|
|
15338
15638
|
import { randomBytes } from "node:crypto";
|
|
15339
|
-
import { Command as
|
|
15639
|
+
import { Command as Command107 } from "commander";
|
|
15340
15640
|
import * as p67 from "@clack/prompts";
|
|
15341
15641
|
import pc41 from "picocolors";
|
|
15342
15642
|
|
|
@@ -15379,7 +15679,7 @@ async function withCmsBackend(fn, cwd = process48.cwd()) {
|
|
|
15379
15679
|
}
|
|
15380
15680
|
|
|
15381
15681
|
// src/commands/cms/editor/add.ts
|
|
15382
|
-
var editorAdd = new
|
|
15682
|
+
var editorAdd = new Command107("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(
|
|
15383
15683
|
(email2, options) => runCommand(async () => {
|
|
15384
15684
|
const generated = options.password === void 0;
|
|
15385
15685
|
const password9 = options.password ?? randomBytes(12).toString("base64url");
|
|
@@ -15398,10 +15698,10 @@ var editorAdd = new Command105("add").description("create an editor who can sign
|
|
|
15398
15698
|
);
|
|
15399
15699
|
|
|
15400
15700
|
// src/commands/cms/editor/password.ts
|
|
15401
|
-
import { Command as
|
|
15701
|
+
import { Command as Command108 } from "commander";
|
|
15402
15702
|
import * as p68 from "@clack/prompts";
|
|
15403
15703
|
import pc42 from "picocolors";
|
|
15404
|
-
var editorPassword = new
|
|
15704
|
+
var editorPassword = new Command108("password").description("set an editor's password").argument("<email>", "email of the editor").argument("<password>", "new password").configureHelp(helpConfig).action(
|
|
15405
15705
|
(email2, password9) => runCommand(async () => {
|
|
15406
15706
|
await withCmsBackend((cms3) => cms3.editors.setPassword(email2, password9));
|
|
15407
15707
|
p68.log.success(
|
|
@@ -15411,10 +15711,10 @@ var editorPassword = new Command106("password").description("set an editor's pas
|
|
|
15411
15711
|
);
|
|
15412
15712
|
|
|
15413
15713
|
// src/commands/cms/editor/list.ts
|
|
15414
|
-
import { Command as
|
|
15714
|
+
import { Command as Command109 } from "commander";
|
|
15415
15715
|
import * as p69 from "@clack/prompts";
|
|
15416
15716
|
import pc43 from "picocolors";
|
|
15417
|
-
var editorList = new
|
|
15717
|
+
var editorList = new Command109("list").description("list editors and the projects they may edit").configureHelp(helpConfig).action(
|
|
15418
15718
|
() => runCommand(async () => {
|
|
15419
15719
|
const rows = await withCmsBackend(
|
|
15420
15720
|
async (cms3) => cms3.editors.list().map((editor2) => ({
|
|
@@ -15438,17 +15738,17 @@ var editorList = new Command107("list").description("list editors and the projec
|
|
|
15438
15738
|
);
|
|
15439
15739
|
|
|
15440
15740
|
// src/commands/cms/editor.ts
|
|
15441
|
-
var editor = new
|
|
15741
|
+
var editor = new Command110("editor").description("manage who can sign in to the admin bar").configureHelp(helpConfig).addCommand(editorAdd).addCommand(editorPassword).addCommand(editorList);
|
|
15442
15742
|
|
|
15443
15743
|
// src/commands/cms.ts
|
|
15444
|
-
var cms2 = new
|
|
15744
|
+
var cms2 = new Command111("cms").description("manage the CMS").configureHelp(helpConfig).addCommand(editor).addCommand(deploy2);
|
|
15445
15745
|
|
|
15446
15746
|
// src/commands/workflows.ts
|
|
15447
|
-
import { Command as
|
|
15747
|
+
import { Command as Command115 } from "commander";
|
|
15448
15748
|
|
|
15449
15749
|
// src/commands/workflows/list.ts
|
|
15450
15750
|
import process49 from "node:process";
|
|
15451
|
-
import { Command as
|
|
15751
|
+
import { Command as Command112, InvalidArgumentError as InvalidArgumentError5 } from "commander";
|
|
15452
15752
|
import * as p70 from "@clack/prompts";
|
|
15453
15753
|
import pc44 from "picocolors";
|
|
15454
15754
|
|
|
@@ -15523,7 +15823,7 @@ function formatRun(run, nameWidth) {
|
|
|
15523
15823
|
const error = run.status === "failed" && run.error?.message ? pc44.red(` ${run.error.message}`) : "";
|
|
15524
15824
|
return `${run.id} ${run.workflowName.padEnd(nameWidth)} ${status3}${attempts} ${when}${error}`;
|
|
15525
15825
|
}
|
|
15526
|
-
var workflowsList = new
|
|
15826
|
+
var workflowsList = new Command112("list").description("list recent workflow runs").option("--status <status>", `only runs in this state (${STATUSES.join(", ")})`, parseStatus).option("--name <workflow>", "only runs of this workflow").option("--limit <n>", "how many to show", parseLimit, 50).configureHelp(helpConfig).action(
|
|
15527
15827
|
(options) => runCommand(async () => {
|
|
15528
15828
|
await withPocketbase(process49.cwd(), async (pb) => {
|
|
15529
15829
|
const runs = await listRuns(pb, {
|
|
@@ -15547,7 +15847,7 @@ Start one from server code with ${pc44.cyan("<workflow>.run(input)")}, or with $
|
|
|
15547
15847
|
|
|
15548
15848
|
// src/commands/workflows/run.ts
|
|
15549
15849
|
import process50 from "node:process";
|
|
15550
|
-
import { Command as
|
|
15850
|
+
import { Command as Command113, InvalidArgumentError as InvalidArgumentError6 } from "commander";
|
|
15551
15851
|
import * as p71 from "@clack/prompts";
|
|
15552
15852
|
import pc45 from "picocolors";
|
|
15553
15853
|
function parseInput(value) {
|
|
@@ -15557,7 +15857,7 @@ function parseInput(value) {
|
|
|
15557
15857
|
throw new InvalidArgumentError6(`must be JSON, e.g. '{"userId":"abc"}'.`);
|
|
15558
15858
|
}
|
|
15559
15859
|
}
|
|
15560
|
-
var workflowsRun = new
|
|
15860
|
+
var workflowsRun = new Command113("run").description("start a run of a workflow; the running app picks it up").argument("<name>", "the workflow name, as in its defineWorkflow spec").argument("[input]", "the run input as JSON", parseInput).configureHelp(helpConfig).action(
|
|
15561
15861
|
(name, input) => runCommand(async () => {
|
|
15562
15862
|
await withPocketbase(process50.cwd(), async (pb) => {
|
|
15563
15863
|
const run = await createRun(pb, name, input);
|
|
@@ -15572,10 +15872,10 @@ It runs once the app is up (${pc45.cyan("vela dev")}); ${pc45.cyan("vela workflo
|
|
|
15572
15872
|
|
|
15573
15873
|
// src/commands/workflows/cancel.ts
|
|
15574
15874
|
import process51 from "node:process";
|
|
15575
|
-
import { Command as
|
|
15875
|
+
import { Command as Command114 } from "commander";
|
|
15576
15876
|
import * as p72 from "@clack/prompts";
|
|
15577
15877
|
import pc46 from "picocolors";
|
|
15578
|
-
var workflowsCancel = new
|
|
15878
|
+
var workflowsCancel = new Command114("cancel").description("cancel a pending or running workflow run").argument("<run-id>", "the run id from `vela workflows list`").configureHelp(helpConfig).action(
|
|
15579
15879
|
(id) => runCommand(async () => {
|
|
15580
15880
|
await withPocketbase(process51.cwd(), async (pb) => {
|
|
15581
15881
|
const run = await cancelRun(pb, id);
|
|
@@ -15585,7 +15885,7 @@ var workflowsCancel = new Command112("cancel").description("cancel a pending or
|
|
|
15585
15885
|
);
|
|
15586
15886
|
|
|
15587
15887
|
// src/commands/workflows.ts
|
|
15588
|
-
var workflows2 = new
|
|
15888
|
+
var workflows2 = new Command115("workflows").description("list, start and cancel background workflow runs").configureHelp(helpConfig).addCommand(workflowsList).addCommand(workflowsRun).addCommand(workflowsCancel);
|
|
15589
15889
|
|
|
15590
15890
|
// src/program.ts
|
|
15591
15891
|
var NO_BACKEND_COMMMANDS = /* @__PURE__ */ new Set([
|
|
@@ -15647,7 +15947,7 @@ var NO_BACKEND_COMMMANDS = /* @__PURE__ */ new Set([
|
|
|
15647
15947
|
]);
|
|
15648
15948
|
var BACKEND_OPTIONAL_COMMANDS = /* @__PURE__ */ new Set(["dev", "build", "preview", "deploy"]);
|
|
15649
15949
|
var SELF_CREDENTIALED_COMMANDS = /* @__PURE__ */ new Set(["test:server"]);
|
|
15650
|
-
var program = new
|
|
15950
|
+
var program = new Command116().name(package_default.name).description(package_default.description).version(package_default.version, "-v, --version").configureHelp(helpConfig);
|
|
15651
15951
|
program.hook("preAction", (_thisCommand, actionCommand) => {
|
|
15652
15952
|
const envRoot = findWorkspaceRoot() ?? process52.cwd();
|
|
15653
15953
|
dotenv2.config({ path: nodePath.join(envRoot, ".env"), quiet: true });
|