vela 0.15.9 → 0.15.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -21,7 +21,7 @@ import pc46 from "picocolors";
21
21
  // package.json
22
22
  var package_default = {
23
23
  name: "vela",
24
- version: "0.15.9",
24
+ version: "0.15.11",
25
25
  type: "module",
26
26
  description: "A CLI for creating and updating SvelteKit projects",
27
27
  license: "MIT",
@@ -71,7 +71,7 @@ var package_default = {
71
71
  "package-manager-detector": "^1.8.0",
72
72
  picocolors: "^1.1.1",
73
73
  pocketbase: "^0.28.0",
74
- "pocketbase-server": "^0.40.6-beta.3",
74
+ "pocketbase-server": "^0.40.6-beta.4",
75
75
  stripe: "^22.6.2",
76
76
  sv: "~1.1.1",
77
77
  svelte: "^5.56.10",
@@ -787,6 +787,25 @@ var INDEX_CACHE_FILE = "index.json";
787
787
  var TARBALL_CACHE_DIR = "cache";
788
788
  var INDEX_CACHE_TTL_MS = 60 * 60 * 1e3;
789
789
  var DEFAULT_TIMEOUT_MS = 5e3;
790
+ var formFieldSchema = v2.object({
791
+ name: v2.pipe(v2.string(), v2.regex(/^[a-z][a-z0-9_]{0,39}$/)),
792
+ type: v2.picklist(["text", "email", "tel", "textarea"]),
793
+ required: v2.optional(v2.boolean())
794
+ });
795
+ var formSchema = v2.object({
796
+ key: v2.pipe(v2.string(), v2.regex(/^[a-z][a-z0-9-]{0,39}$/)),
797
+ name: v2.string(),
798
+ fields: v2.array(formFieldSchema)
799
+ });
800
+ var formsSchema = v2.pipe(
801
+ v2.array(v2.unknown()),
802
+ v2.transform(
803
+ (items) => items.flatMap((item) => {
804
+ const form3 = v2.safeParse(formSchema, item);
805
+ return form3.success ? [form3.output] : [];
806
+ })
807
+ )
808
+ );
790
809
  var entrySchema = v2.object({
791
810
  name: v2.pipe(v2.string(), v2.regex(/^[a-z0-9][a-z0-9-]*$/)),
792
811
  description: v2.string(),
@@ -801,6 +820,17 @@ var entrySchema = v2.object({
801
820
  cms: v2.optional(v2.boolean()),
802
821
  /** A prebuilt static build is published for velastack.dev's instant deploys. */
803
822
  instantDeploy: v2.optional(v2.boolean()),
823
+ /** Hosted forms velastack.dev creates, by `key`, in a project made from this template. */
824
+ forms: v2.optional(formsSchema),
825
+ /** The locales its published content ships, the default first; the seed enables them all. */
826
+ locales: v2.optional(
827
+ v2.pipe(
828
+ v2.array(v2.unknown()),
829
+ v2.transform((items) => items.filter((item) => typeof item === "string"))
830
+ )
831
+ ),
832
+ /** The schema.org type its JSON-LD describes (`ProfessionalService`, `Restaurant`, …). */
833
+ schemaType: v2.optional(v2.string()),
804
834
  /** Tarball location, relative to the index URL. */
805
835
  file: v2.string(),
806
836
  sha256: v2.pipe(v2.string(), v2.regex(/^[0-9a-f]{64}$/)),
@@ -3058,6 +3088,14 @@ function cmsEndpointFor(projectId) {
3058
3088
  function normalizeCmsUrl(url) {
3059
3089
  return url.trim().replace(/\/+$/, "");
3060
3090
  }
3091
+ function createdForms(seed) {
3092
+ return seed && "forms" in seed ? seed.forms?.created ?? [] : [];
3093
+ }
3094
+ function formsCreatedMessage(seed) {
3095
+ const keys = createdForms(seed);
3096
+ if (keys.length === 0) return void 0;
3097
+ return `${keys.length === 1 ? "Hosted form" : "Hosted forms"} created: ${keys.join(", ")}`;
3098
+ }
3061
3099
  function linkNextSteps(outcome) {
3062
3100
  const steps = [];
3063
3101
  const { linked, cmsEndpoint, cmsSource, templateCms, loggedIn, interactive, seed } = outcome;
@@ -3071,6 +3109,9 @@ function linkNextSteps(outcome) {
3071
3109
  `Loading the template's content into the CMS failed (${seed.error}). Retry with "Load template content" at ${linked.dashboardUrl}/cms/settings; until then the site shows the copy built into its components.`
3072
3110
  );
3073
3111
  }
3112
+ if (createdForms(seed).length > 0) {
3113
+ steps.push(`Form submissions arrive at ${linked.dashboardUrl}/forms.`);
3114
+ }
3074
3115
  steps.push(
3075
3116
  `Add an editor at ${linked.dashboardUrl}/cms/editors, then open any page with \`?edit\` and sign in from the admin bar.`
3076
3117
  );
@@ -5862,6 +5903,8 @@ async function seedCms(apiKey, linked, template) {
5862
5903
  } else if (seed.status === "failed") {
5863
5904
  p10.log.warn(`Could not load the template's content into the CMS: ${seed.error}`);
5864
5905
  }
5906
+ const forms = formsCreatedMessage(seed);
5907
+ if (forms) p10.log.success(forms);
5865
5908
  return seed;
5866
5909
  }
5867
5910
  async function promptCms(onCancel2) {
@@ -12072,13 +12115,17 @@ var NODE_MAJOR = "24";
12072
12115
  var OptionsSchema2 = v9.object({
12073
12116
  ...SSH_OPTION_SCHEMA,
12074
12117
  pbVersion: v9.optional(v9.string()),
12075
- nodeMajor: v9.optional(v9.string())
12118
+ // A number: provision.sh compares it with the server's major, so a line
12119
+ // name like `lts` would never count as reached.
12120
+ nodeMajor: v9.optional(
12121
+ v9.pipe(v9.string(), v9.regex(/^\d+$/, "must be a major version number, like 24"))
12122
+ )
12076
12123
  });
12077
12124
  var provision = addSshOptions(
12078
12125
  new Command79("provision").description("prepare a server to host vela apps").argument("<target>", "SSH target \u2014 an alias from ~/.ssh/config, or user@host").configureHelp(helpConfig)
12079
12126
  ).option("--pb-version <version>", "PocketBase version to install").option(
12080
12127
  "--node-major <version>",
12081
- "Node.js major version to install on a server with none, or one older than 22",
12128
+ "Node.js major version to bring the server up to (match the one you build with)",
12082
12129
  NODE_MAJOR
12083
12130
  ).action(
12084
12131
  (target, raw) => runCommand(async () => {
@@ -12425,7 +12472,14 @@ ${pc18.cyan("package-lock.json")} (${pc18.dim("npm install --package-lock-only")
12425
12472
  p46.log.info(
12426
12473
  `${pc18.cyan(ctx.appName)} ${pc18.dim("\u2192")} ${pc18.cyan(ctx.targetName)} ${pc18.dim(`(${ctx.server})`)}`
12427
12474
  );
12428
- await requireServerNode(session, ctx.server);
12475
+ const serverNode = await requireServerNode(session, ctx.server);
12476
+ const drift = nodeMajorDrift(serverNode, process34.version);
12477
+ if (drift) {
12478
+ p46.log.warn(
12479
+ `${ctx.server} runs Node ${drift.server}, but this deploy runs Node ${drift.build}. The server's npm can reject a lockfile this one accepts.
12480
+ Run ${pc18.cyan(`vela provision ${ctx.server}`)} to bring it up to ${drift.build}.`
12481
+ );
12482
+ }
12429
12483
  const [existing] = await readInstanceStates(session, instance);
12430
12484
  const release = releaseId(await serverTimeOrLocal(session));
12431
12485
  const isPreview2 = ctx.target.kind === "preview";
@@ -12785,13 +12839,20 @@ async function requireServerNode(session, server) {
12785
12839
  const { major, minor } = SERVER_NODE_FLOOR;
12786
12840
  const result = await session.script("node -v 2>/dev/null || true", { check: false });
12787
12841
  const version = result.stdout.trim();
12788
- if (nodeVersionAtLeast(version, major, minor)) return;
12842
+ if (nodeVersionAtLeast(version, major, minor)) return version;
12789
12843
  throw new Error(
12790
12844
  `${server} ${version ? `runs Node ${version}` : "has no Node"}, and this app needs ${major}.${minor} or later.
12791
12845
 
12792
12846
  Run ${pc18.cyan(`vela provision ${server}`)} to upgrade it, then deploy again.`
12793
12847
  );
12794
12848
  }
12849
+ function nodeMajorDrift(serverVersion, buildVersion) {
12850
+ const major = (version) => Number(/^v?(\d+)\./.exec(version.trim())?.[1] ?? NaN);
12851
+ const server = major(serverVersion);
12852
+ const build2 = major(buildVersion);
12853
+ if (Number.isNaN(server) || Number.isNaN(build2) || server >= build2) return null;
12854
+ return { server, build: build2 };
12855
+ }
12795
12856
  async function serverTimeOrLocal(session) {
12796
12857
  try {
12797
12858
  return await serverTime(session);