vela 0.14.1 → 0.14.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vela",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
4
4
  "type": "module",
5
5
  "description": "A CLI for creating and updating SvelteKit projects",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "@clack/prompts": "^1.7.0",
38
38
  "@faker-js/faker": "^10.6.0",
39
- "@velastack/patterns": "^0.3.1",
39
+ "@velastack/patterns": "^0.3.2",
40
40
  "@velastack/pocketbase-codegen": "^0.1.0",
41
41
  "annotate-json-schema": "^0.1.0",
42
42
  "commander": "^13.1.0",
@@ -209,7 +209,7 @@ fi
209
209
 
210
210
  install_deps() {
211
211
  local lock="$RELEASE_DIR/package-lock.json"
212
- local key
212
+ local key foreign="" name
213
213
  local -a install_cmd
214
214
  # `--no-engine-strict`: vela projects set engine-strict for development, but a
215
215
  # production install takes only `dependencies` - a dev tool that wants a newer
@@ -219,7 +219,13 @@ install_deps() {
219
219
  key=$(sha256sum "$lock" | cut -c1-16)
220
220
  install_cmd=(npm ci "${flags[@]}")
221
221
  elif [ -f "$RELEASE_DIR/package.json" ]; then
222
- key=$(sha256sum "$RELEASE_DIR/package.json" | cut -c1-16)
222
+ # A project pinned by pnpm, yarn or bun: npm cannot replay the lockfile, so
223
+ # this resolves afresh, but the key still follows it - a dependency bump
224
+ # that only touched the lockfile must not reuse the old tree.
225
+ for name in pnpm-lock.yaml yarn.lock bun.lock bun.lockb; do
226
+ if [ -f "$RELEASE_DIR/$name" ]; then foreign="$RELEASE_DIR/$name"; break; fi
227
+ done
228
+ key=$(cat "$RELEASE_DIR/package.json" ${foreign:+"$foreign"} | sha256sum | cut -c1-16)
223
229
  install_cmd=(npm install "${flags[@]}")
224
230
  else
225
231
  log "no package.json in release - skipping dependency install"
@@ -233,6 +239,20 @@ install_deps() {
233
239
  mkdir -p "$deps"
234
240
  cp "$RELEASE_DIR/package.json" "$deps/"
235
241
  if [ -f "$lock" ]; then cp "$lock" "$deps/"; fi
242
+ # npm reads a yarn.lock beside package.json for resolution hints.
243
+ if [ "${foreign##*/}" = "yarn.lock" ]; then cp "$foreign" "$deps/"; fi
244
+ # `prepare` is a development hook (`svelte-kit sync`, husky) whose tools
245
+ # are devDependencies, which are not installed here: it can only print
246
+ # "svelte-kit: not found". Dependencies' own install scripts still run.
247
+ node -e '
248
+ const fs = require("fs");
249
+ const file = process.argv[1];
250
+ const pkg = JSON.parse(fs.readFileSync(file, "utf8"));
251
+ if (pkg.scripts && pkg.scripts.prepare) {
252
+ delete pkg.scripts.prepare;
253
+ fs.writeFileSync(file, JSON.stringify(pkg, null, 2) + "\n");
254
+ }
255
+ ' "$deps/package.json" || die "could not read package.json"
236
256
  if [ -f "$RELEASE_DIR/.npmrc" ]; then cp "$RELEASE_DIR/.npmrc" "$deps/"; fi
237
257
  chown -R "$VELA_USER:$VELA_USER" "$deps"
238
258
  # npm needs a writable HOME and cache; $VELA_ROOT itself stays root-owned
@@ -3,6 +3,14 @@ import tailwindcss from '@tailwindcss/vite';
3
3
  import { sveltekit } from '@sveltejs/kit/vite';
4
4
  import adapter from '@sveltejs/adapter-static';
5
5
 
6
+ /**
7
+ * The footer links to these before they exist; `vela legal privacy` and
8
+ * `vela legal terms` generate them. Prerendering crawls every link and fails
9
+ * the build on a 404, so a project would not build until both were written.
10
+ * Once generated they prerender like any other page.
11
+ */
12
+ const PENDING_LEGAL_ROUTES = ['/privacy', '/terms'];
13
+
6
14
  export default defineConfig({
7
15
  plugins: [
8
16
  tailwindcss(),
@@ -14,7 +22,14 @@ export default defineConfig({
14
22
  adapter: adapter({
15
23
  fallback: '200.html'
16
24
  }),
17
- ...(process.env.VELA_ORIGIN ? { prerender: { origin: process.env.VELA_ORIGIN } } : {})
25
+ prerender: {
26
+ // Every other broken link still fails the build.
27
+ handleHttpError: ({ path, status, message }) => {
28
+ if (status === 404 && PENDING_LEGAL_ROUTES.includes(path)) return;
29
+ throw new Error(message);
30
+ },
31
+ ...(process.env.VELA_ORIGIN ? { origin: process.env.VELA_ORIGIN } : {})
32
+ }
18
33
  })
19
34
  ]
20
35
  });