vela 0.10.6 → 0.10.7

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
@@ -7,7 +7,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
7
7
  // package.json
8
8
  var package_default = {
9
9
  name: "vela",
10
- version: "0.10.6",
10
+ version: "0.10.7",
11
11
  type: "module",
12
12
  description: "A CLI for creating and updating SvelteKit projects",
13
13
  license: "MIT",
@@ -393,6 +393,9 @@ function hasBackend(from = process3.cwd()) {
393
393
  const root = findWorkspaceRoot(from);
394
394
  return root !== null && fs3.existsSync(path2.join(root, DATA_DIR));
395
395
  }
396
+ function localDataDir(from = process3.cwd()) {
397
+ return path2.join(findWorkspaceRoot(from) ?? from, DATA_DIR);
398
+ }
396
399
  async function getWorkspace() {
397
400
  const workspaceRootDir = findWorkspaceRoot();
398
401
  if (!workspaceRootDir) {
@@ -3150,6 +3153,7 @@ function spawnCapture(command, args, opts = {}) {
3150
3153
  import path19 from "node:path";
3151
3154
  var VELA_ROOT = "/var/lib/vela";
3152
3155
  var VELA_ETC = "/etc/vela";
3156
+ var VELA_USER = "vela";
3153
3157
  var SCRIPTS_DIR = `${VELA_ROOT}/scripts`;
3154
3158
  var PROVISIONED_MARKER = `${VELA_ETC}/provisioned`;
3155
3159
  function serverTemplatesDir() {
@@ -6937,6 +6941,7 @@ function parsePort(value) {
6937
6941
  }
6938
6942
  var dev = new Command66("dev").description("start the development server").option("--open [path]", "open the app in a browser once the server is ready").option("--host [host]", "expose the server on the network").option("--port <port>", "port to listen on", parsePort).option("--strictPort", "exit if the port is already in use instead of taking the next one").option("--cors", "enable CORS").option("--force", "re-bundle dependencies, ignoring the optimizer cache").configureHelp(helpConfig).action(async (options) => {
6939
6943
  const cwd = process21.cwd();
6944
+ process21.env.VELA_DATA_DIR ??= localDataDir(cwd);
6940
6945
  const startTime = performance.now();
6941
6946
  const { createServer, version } = await loadVite(cwd);
6942
6947
  const viteMetadataDir = path34.join(cwd, "node_modules", ".vite");
@@ -7073,6 +7078,7 @@ function normalizeOrigin(value) {
7073
7078
  var PRERENDERED_DIR = path35.join(".svelte-kit", "output", "prerendered");
7074
7079
  var build = new Command67("build").description("build the app").configureHelp(helpConfig).option("-t, --target <target>", "which copy of the app to build for", PRODUCTION_TARGET).action(async (options) => {
7075
7080
  const cwd = process23.cwd();
7081
+ process23.env.VELA_DATA_DIR ??= localDataDir(cwd);
7076
7082
  const origin = await originForBuild(cwd, options.target);
7077
7083
  if (origin) process23.env.VELA_ORIGIN = origin;
7078
7084
  let pbProc;
@@ -7143,6 +7149,7 @@ import { detect as detect6 } from "package-manager-detector";
7143
7149
  import { resolveCommand as resolveCommand6 } from "package-manager-detector/commands";
7144
7150
  var preview = new Command68("preview").description("preview the built app").configureHelp(helpConfig).action(async () => {
7145
7151
  const cwd = process24.cwd();
7152
+ process24.env.VELA_DATA_DIR ??= localDataDir(cwd);
7146
7153
  let pbProc;
7147
7154
  const needsStart = hasBackend(cwd) && !process24.env.POCKETBASE_URL;
7148
7155
  const cleanup = () => {
@@ -8271,6 +8278,16 @@ async function createBackup(pb, key, { pollTimeout = 30 * 6e4 } = {}) {
8271
8278
  PocketBase may still be working on it \u2014 check \`vela logs\` and \`vela backup list\` before trying again.`
8272
8279
  );
8273
8280
  }
8281
+ async function checkpointAppDatabases(session, instance) {
8282
+ await session.script(
8283
+ `command -v sqlite3 >/dev/null 2>&1 || exit 0
8284
+ for db in "$1"/*.db "$1"/*.sqlite; do
8285
+ [ -f "$db-wal" ] || continue
8286
+ runuser -u "$2" -- sqlite3 "$db" 'PRAGMA busy_timeout=5000; PRAGMA wal_checkpoint(TRUNCATE);' >/dev/null 2>&1 || true
8287
+ done`,
8288
+ { args: [remotePaths.pbData(instance), VELA_USER], check: false }
8289
+ );
8290
+ }
8274
8291
  function formatBytes(bytes) {
8275
8292
  const units = ["B", "KB", "MB", "GB", "TB"];
8276
8293
  let value = bytes;
@@ -8318,6 +8335,7 @@ PocketBase leaves ${pc23.cyan("storage/")} out of a backup whenever S3 is on.
8318
8335
  Your bucket's own versioning is what protects the uploaded files.`
8319
8336
  );
8320
8337
  }
8338
+ if (ctx.session) await checkpointAppDatabases(ctx.session, ctx.instance);
8321
8339
  const spinner5 = p43.spinner();
8322
8340
  spinner5.start(`Backing up ${ctx.targetName}`);
8323
8341
  try {
@@ -8808,6 +8826,7 @@ var testServer = new Command91("test:server").description("run server tests").al
8808
8826
  process32.env.POCKETBASE_URL = url;
8809
8827
  process32.env.POCKETBASE_SUPERUSER_EMAIL = email3;
8810
8828
  process32.env.POCKETBASE_SUPERUSER_PASSWORD = password11;
8829
+ process32.env.VELA_DATA_DIR = testDataDir;
8811
8830
  process32.env.TEST = "true";
8812
8831
  console.log(`${pc30.greenBright("\u2713")} Created test database`);
8813
8832
  const { createServer } = await loadVite(cwd);