vela 0.13.4 → 0.13.5

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 pc42 from "picocolors";
21
21
  // package.json
22
22
  var package_default = {
23
23
  name: "vela",
24
- version: "0.13.4",
24
+ version: "0.13.5",
25
25
  type: "module",
26
26
  description: "A CLI for creating and updating SvelteKit projects",
27
27
  license: "MIT",
@@ -57,7 +57,7 @@ var package_default = {
57
57
  dependencies: {
58
58
  "@clack/prompts": "^1.7.0",
59
59
  "@faker-js/faker": "^10.6.0",
60
- "@velastack/patterns": "^0.2.11",
60
+ "@velastack/patterns": "^0.2.12",
61
61
  "@velastack/pocketbase-codegen": "^0.1.0",
62
62
  "annotate-json-schema": "^0.1.0",
63
63
  commander: "^13.1.0",
@@ -343,8 +343,8 @@ function dropTemplateAdapters(user, template) {
343
343
  }
344
344
  return copy;
345
345
  }
346
- function readPackageJson(path48) {
347
- return JSON.parse(fs2.readFileSync(path48, "utf8"));
346
+ function readPackageJson(path49) {
347
+ return JSON.parse(fs2.readFileSync(path49, "utf8"));
348
348
  }
349
349
  var PACKAGE_NAME_PLACEHOLDER = /~TODO~/g;
350
350
  var APP_NAME_PLACEHOLDER = /~APP_NAME~/g;
@@ -362,12 +362,12 @@ function fillTemplatePlaceholders(raw, values) {
362
362
  function escapeSingleQuoted(value) {
363
363
  return value.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
364
364
  }
365
- function readTemplatePackageJson(path48, values) {
366
- const raw = fillTemplatePlaceholders(fs2.readFileSync(path48, "utf8"), values);
365
+ function readTemplatePackageJson(path49, values) {
366
+ const raw = fillTemplatePlaceholders(fs2.readFileSync(path49, "utf8"), values);
367
367
  return JSON.parse(raw);
368
368
  }
369
- function writePackageJson(path48, pkg) {
370
- fs2.writeFileSync(path48, JSON.stringify(pkg, null, " ") + "\n");
369
+ function writePackageJson(path49, pkg) {
370
+ fs2.writeFileSync(path49, JSON.stringify(pkg, null, " ") + "\n");
371
371
  }
372
372
  function toValidPackageName(name) {
373
373
  return name.trim().toLowerCase().replace(/\s+/g, "-").replace(/^[._]/, "").replace(/[^a-z0-9~.-]+/g, "-");
@@ -5355,7 +5355,7 @@ var backend2 = new Command32("backend").description("disable the PocketBase back
5355
5355
  () => runDisable(
5356
5356
  {
5357
5357
  slug: "disable-backend",
5358
- confirmMessage: "Disable the PocketBase backend? Removes hooks.server.ts, the data/ scaffold, and reverts the SvelteKit adapter. The @velastack/pocketbase and pocketbase-sveltekit packages stay installed.",
5358
+ confirmMessage: "Disable the PocketBase backend? Takes the PocketBase handle and workflow worker out of hooks.server.ts (deleting it if nothing else is left), removes the data/ scaffold, and reverts the SvelteKit adapter. The @velastack/pocketbase and pocketbase-sveltekit packages stay installed.",
5359
5359
  report: {
5360
5360
  summary: "Disabled the PocketBase backend.",
5361
5361
  task: {
@@ -10988,13 +10988,19 @@ function printTable(routes2) {
10988
10988
  }
10989
10989
 
10990
10990
  // src/commands/i18n.ts
10991
+ import fs44 from "node:fs";
10992
+ import path47 from "node:path";
10991
10993
  import process39 from "node:process";
10992
10994
  import { Command as Command103 } from "commander";
10993
10995
  import { x as x6 } from "tinyexec";
10994
10996
  import { detect as detect9 } from "package-manager-detector";
10995
10997
  import { resolveCommand as resolveCommand8 } from "package-manager-detector/commands";
10998
+ var WUCHALE_CONFIG_NAMES = ["js", "mjs", "ts", "mts"].map((ext) => `wuchale.config.${ext}`);
10996
10999
  async function runWuchale(extraArgs) {
10997
- const cwd = process39.cwd();
11000
+ const cwd = findWorkspaceRoot() ?? process39.cwd();
11001
+ if (!WUCHALE_CONFIG_NAMES.some((name) => fs44.existsSync(path47.join(cwd, name)))) {
11002
+ throw new Error("No wuchale config found. Run `vela enable i18n` to set up i18n.");
11003
+ }
10998
11004
  const pm = (await detect9({ cwd }))?.name ?? "npm";
10999
11005
  const resolved = resolveCommand8(pm, "execute", ["wuchale", ...extraArgs]);
11000
11006
  const args = resolved.args.slice();
@@ -11004,10 +11010,10 @@ async function runWuchale(extraArgs) {
11004
11010
  throwOnError: true
11005
11011
  });
11006
11012
  }
11007
- var extract2 = new Command103("extract").description("extract translatable strings").configureHelp(helpConfig).action(() => runWuchale([]));
11008
- var watch = new Command103("watch").description("watch and extract translatable strings").configureHelp(helpConfig).action(() => runWuchale(["--watch"]));
11009
- var status2 = new Command103("status").description("show i18n status").configureHelp(helpConfig).action(() => runWuchale(["status"]));
11010
- var clean = new Command103("clean").description("clean unused translatable strings").configureHelp(helpConfig).action(() => runWuchale(["--clean"]));
11013
+ var extract2 = new Command103("extract").description("extract translatable strings").configureHelp(helpConfig).action(() => runCommand(() => runWuchale([])));
11014
+ var watch = new Command103("watch").description("watch and extract translatable strings").configureHelp(helpConfig).action(() => runCommand(() => runWuchale(["--watch"])));
11015
+ var status2 = new Command103("status").description("show i18n status").configureHelp(helpConfig).action(() => runCommand(() => runWuchale(["status"])));
11016
+ var clean = new Command103("clean").description("clean unused translatable strings").configureHelp(helpConfig).action(() => runCommand(() => runWuchale(["--clean"])));
11011
11017
  var i18n3 = new Command103("i18n").description("i18n utilities").configureHelp(helpConfig).addCommand(extract2, { isDefault: true }).addCommand(watch).addCommand(status2).addCommand(clean);
11012
11018
 
11013
11019
  // src/commands/oauth.ts
@@ -11126,7 +11132,7 @@ import pc36 from "picocolors";
11126
11132
 
11127
11133
  // src/lib/cms-backend.ts
11128
11134
  import { createRequire as createRequire3 } from "node:module";
11129
- import path47 from "node:path";
11135
+ import path48 from "node:path";
11130
11136
  import process41 from "node:process";
11131
11137
  import { pathToFileURL as pathToFileURL3 } from "node:url";
11132
11138
  import pc35 from "picocolors";
@@ -11134,7 +11140,7 @@ var DEFAULT_PROJECT = "default";
11134
11140
  async function loadBackendModule(root) {
11135
11141
  let entry;
11136
11142
  try {
11137
- entry = createRequire3(path47.join(root, "package.json")).resolve("@velastack/cms/backend");
11143
+ entry = createRequire3(path48.join(root, "package.json")).resolve("@velastack/cms/backend");
11138
11144
  } catch {
11139
11145
  throw new Error(
11140
11146
  `@velastack/cms is not installed in this project.
@@ -11152,8 +11158,8 @@ async function withCmsBackend(fn, cwd = process41.cwd()) {
11152
11158
  const { createCmsBackend } = await loadBackendModule(root);
11153
11159
  const dataDir2 = localDataDir(root);
11154
11160
  const backend3 = createCmsBackend({
11155
- dbPath: path47.join(dataDir2, "cms.sqlite"),
11156
- uploadDir: path47.join(dataDir2, "uploads")
11161
+ dbPath: path48.join(dataDir2, "cms.sqlite"),
11162
+ uploadDir: path48.join(dataDir2, "uploads")
11157
11163
  });
11158
11164
  try {
11159
11165
  return await fn(backend3);
@@ -11385,10 +11391,22 @@ var NO_BACKEND_COMMMANDS = /* @__PURE__ */ new Set([
11385
11391
  "i18n",
11386
11392
  "generate schema",
11387
11393
  "generate form",
11394
+ // Only delete the files their generators wrote, so they must work wherever
11395
+ // those generators do.
11396
+ "destroy schema",
11397
+ "destroy form",
11388
11398
  // The CMS keeps its own SQLite database and editors; PocketBase is never involved.
11389
11399
  "enable cms",
11390
11400
  // Analytics only touches the root layout and .env; it must work on static sites.
11391
11401
  "enable analytics",
11402
+ // Only wires hooks, reroute and the root layout; no collections involved.
11403
+ "enable content-negotiation",
11404
+ "disable content-negotiation",
11405
+ // Posts are mdsvex files on disk.
11406
+ "enable blog",
11407
+ // Translations live in wuchale catalogs.
11408
+ "enable i18n",
11409
+ "disable i18n",
11392
11410
  "cms",
11393
11411
  // Server commands talk to a VPS over SSH, never to the local database.
11394
11412
  "provision",
@@ -11403,8 +11421,8 @@ var NO_BACKEND_COMMMANDS = /* @__PURE__ */ new Set([
11403
11421
  // own credentials rather than requiring them in this process.
11404
11422
  "backup",
11405
11423
  "restore",
11406
- // Removes a copy from its server; the other `destroy` subcommands edit the
11407
- // local schema and stay gated.
11424
+ // Removes a copy from its server. `destroy resource` and `destroy scaffold`
11425
+ // drop collections and stay gated.
11408
11426
  "destroy deployment"
11409
11427
  ]);
11410
11428
  var BACKEND_OPTIONAL_COMMANDS = /* @__PURE__ */ new Set(["dev", "build", "preview", "deploy"]);
@@ -11414,14 +11432,14 @@ program.hook("preAction", (_thisCommand, actionCommand) => {
11414
11432
  if (isStub(actionCommand)) return;
11415
11433
  const envRoot = findWorkspaceRoot() ?? process45.cwd();
11416
11434
  dotenv2.config({ path: nodePath.join(envRoot, ".env"), quiet: true });
11417
- const path48 = getCommandPath(actionCommand);
11418
- if (NO_BACKEND_COMMMANDS.has(path48)) return;
11419
- const top = path48.split(" ", 1)[0];
11435
+ const path49 = getCommandPath(actionCommand);
11436
+ if (NO_BACKEND_COMMMANDS.has(path49)) return;
11437
+ const top = path49.split(" ", 1)[0];
11420
11438
  if (NO_BACKEND_COMMMANDS.has(top)) return;
11421
11439
  if (!hasBackend()) {
11422
11440
  if (BACKEND_OPTIONAL_COMMANDS.has(top)) return;
11423
11441
  p67.log.error(
11424
- `${pc42.cyan(`vela ${path48}`)} needs a backend, and this project does not have one.
11442
+ `${pc42.cyan(`vela ${path49}`)} needs a backend, and this project does not have one.
11425
11443
 
11426
11444
  Static projects have no database to talk to.
11427
11445
 
@@ -11431,7 +11449,7 @@ To add a backend to this project, run ${pc42.cyan("vela bless")}.`
11431
11449
  p67.cancel("Operation failed.");
11432
11450
  process45.exit(1);
11433
11451
  }
11434
- if (SELF_CREDENTIALED_COMMANDS.has(path48)) return;
11452
+ if (SELF_CREDENTIALED_COMMANDS.has(path49)) return;
11435
11453
  if (!process45.env.POCKETBASE_SUPERUSER_EMAIL || !process45.env.POCKETBASE_SUPERUSER_PASSWORD) {
11436
11454
  p67.log.error(
11437
11455
  `PocketBase superuser credentials are required.