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 +67 -6
- package/dist/bin.js.map +3 -3
- package/package.json +2 -2
- package/templates/server/apply.sh +18 -4
- package/templates/server/provision.sh +25 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vela",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A CLI for creating and updating SvelteKit projects",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"package-manager-detector": "^1.8.0",
|
|
51
51
|
"picocolors": "^1.1.1",
|
|
52
52
|
"pocketbase": "^0.28.0",
|
|
53
|
-
"pocketbase-server": "^0.40.6-beta.
|
|
53
|
+
"pocketbase-server": "^0.40.6-beta.4",
|
|
54
54
|
"stripe": "^22.6.2",
|
|
55
55
|
"sv": "~1.1.1",
|
|
56
56
|
"svelte": "^5.56.10",
|
|
@@ -253,17 +253,25 @@ fi
|
|
|
253
253
|
# pin the same dependencies: redeploys of unchanged dependencies skip the
|
|
254
254
|
# install entirely, and a rollback still finds the tree its own lockfile
|
|
255
255
|
# described.
|
|
256
|
+
#
|
|
257
|
+
# The key also carries the Node ABI and npm's major. Native modules
|
|
258
|
+
# (better-sqlite3, argon2) are compiled for one ABI, so a tree installed before
|
|
259
|
+
# `vela provision` moved Node to a new major would fail to load after it; and
|
|
260
|
+
# npm majors disagree on what a lockfile has to contain. Either change installs
|
|
261
|
+
# afresh.
|
|
256
262
|
|
|
257
263
|
install_deps() {
|
|
258
264
|
local lock="$RELEASE_DIR/package-lock.json"
|
|
259
|
-
local key foreign="" name
|
|
265
|
+
local key foreign="" name runtime
|
|
260
266
|
local -a install_cmd
|
|
267
|
+
runtime="abi$(node -p process.versions.modules 2>/dev/null)-npm$(npm -v 2>/dev/null | cut -d. -f1)"
|
|
268
|
+
[[ $runtime =~ ^abi[0-9]+-npm[0-9]+$ ]] || die "could not read the Node and npm versions ($runtime)"
|
|
261
269
|
# `--no-engine-strict`: vela projects set engine-strict for development, but a
|
|
262
270
|
# production install takes only `dependencies` - a dev tool that wants a newer
|
|
263
271
|
# Node than the server runs is not a reason to refuse the deploy.
|
|
264
272
|
local -a flags=(--omit=dev --no-audit --no-fund --no-engine-strict --loglevel=error)
|
|
265
273
|
if [ -f "$lock" ]; then
|
|
266
|
-
key=$(
|
|
274
|
+
key=$({ printf '%s\n' "$runtime"; cat "$lock"; } | sha256sum | cut -c1-16)
|
|
267
275
|
install_cmd=(npm ci "${flags[@]}")
|
|
268
276
|
elif [ -f "$RELEASE_DIR/package.json" ]; then
|
|
269
277
|
# A project pinned by pnpm, yarn or bun: npm cannot replay the lockfile, so
|
|
@@ -272,7 +280,8 @@ install_deps() {
|
|
|
272
280
|
for name in pnpm-lock.yaml yarn.lock bun.lock bun.lockb; do
|
|
273
281
|
if [ -f "$RELEASE_DIR/$name" ]; then foreign="$RELEASE_DIR/$name"; break; fi
|
|
274
282
|
done
|
|
275
|
-
key=$(cat "$RELEASE_DIR/package.json" ${foreign:+"$foreign"}
|
|
283
|
+
key=$({ printf '%s\n' "$runtime"; cat "$RELEASE_DIR/package.json" ${foreign:+"$foreign"}; } \
|
|
284
|
+
| sha256sum | cut -c1-16)
|
|
276
285
|
install_cmd=(npm install "${flags[@]}")
|
|
277
286
|
else
|
|
278
287
|
log "no package.json in release - skipping dependency install"
|
|
@@ -280,7 +289,11 @@ install_deps() {
|
|
|
280
289
|
fi
|
|
281
290
|
|
|
282
291
|
local deps="$APP/deps/$key"
|
|
283
|
-
|
|
292
|
+
# Written only once npm has finished: an install that died part-way leaves a
|
|
293
|
+
# node_modules behind, and the next deploy with the same key must not take
|
|
294
|
+
# it for a complete tree.
|
|
295
|
+
local done_marker="$deps/.vela-installed"
|
|
296
|
+
if [ ! -f "$done_marker" ]; then
|
|
284
297
|
log "installing dependencies ($key)"
|
|
285
298
|
rm -rf "$deps"
|
|
286
299
|
mkdir -p "$deps"
|
|
@@ -311,6 +324,7 @@ install_deps() {
|
|
|
311
324
|
( cd "$deps" && runuser -u "$VELA_USER" -- env \
|
|
312
325
|
HOME="$deps" npm_config_cache="$VELA_ROOT/cache/npm" \
|
|
313
326
|
"${install_cmd[@]}" >&2 8>&- ) || die "dependency install failed"
|
|
327
|
+
: > "$done_marker"
|
|
314
328
|
else
|
|
315
329
|
log "dependencies already installed ($key)"
|
|
316
330
|
fi
|
|
@@ -12,8 +12,8 @@ SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
12
12
|
. "$SCRIPT_DIR/lib.sh"
|
|
13
13
|
|
|
14
14
|
PB_VERSION=""
|
|
15
|
-
# The Node line a server
|
|
16
|
-
#
|
|
15
|
+
# The Node line a server is brought up to: the one releases are built with. A
|
|
16
|
+
# server already on a later major keeps it; see install_node.
|
|
17
17
|
NODE_MAJOR=24
|
|
18
18
|
CLI_VERSION="unknown"
|
|
19
19
|
LAYOUT_VERSION=1
|
|
@@ -98,21 +98,31 @@ ensure_packages ca-certificates curl gnupg rsync unzip tar sqlite3 jq git
|
|
|
98
98
|
# prebuild is unavailable, so the toolchain has to be here.
|
|
99
99
|
ensure_packages build-essential python3
|
|
100
100
|
|
|
101
|
-
#
|
|
102
|
-
#
|
|
103
|
-
#
|
|
104
|
-
#
|
|
105
|
-
#
|
|
101
|
+
# The server runs the Node major that releases are built with (NODE_MAJOR, the
|
|
102
|
+
# action's default too), not merely one new enough to start them: npm ships with
|
|
103
|
+
# Node, and the server's `npm ci` has to accept the lockfile the build's npm
|
|
104
|
+
# wrote. npm 10 (Node 22) rejects some that npm 11 (Node 24) writes, as
|
|
105
|
+
# "Missing: ... from lock file". SvelteKit 3 and adapter-node 6 also need 22.17,
|
|
106
|
+
# which an explicit `--node-major 22` still has to reach within its line. A
|
|
107
|
+
# server already on a later major than NODE_MAJOR is left alone.
|
|
108
|
+
#
|
|
109
|
+
# Moving a major leaves the hosted apps on dependencies compiled for the old
|
|
110
|
+
# one. Their running processes keep working, but each needs a redeploy (which
|
|
111
|
+
# installs afresh for the new ABI, see apply.sh) before it next restarts.
|
|
106
112
|
install_node() {
|
|
107
113
|
local current=0 line=$NODE_MAJOR
|
|
108
|
-
if
|
|
114
|
+
if command -v node >/dev/null 2>&1; then
|
|
115
|
+
current=$(node -p 'process.versions.node.split(".")[0]' 2>/dev/null || echo 0)
|
|
116
|
+
fi
|
|
117
|
+
if [ "$current" -ge "$line" ] 2>/dev/null && node_at_least 22 17; then
|
|
109
118
|
log "node $(node -v) already installed"
|
|
110
119
|
return 0
|
|
111
120
|
fi
|
|
112
|
-
if
|
|
113
|
-
|
|
114
|
-
if [ "$current" -
|
|
115
|
-
|
|
121
|
+
if [ "$current" -gt 0 ] 2>/dev/null; then
|
|
122
|
+
log "upgrading Node.js $(node -v) to the latest $line.x - builds use $line"
|
|
123
|
+
if [ "$current" -lt "$line" ]; then
|
|
124
|
+
log "redeploy every app on this server now: their dependencies were installed for Node $current"
|
|
125
|
+
fi
|
|
116
126
|
else
|
|
117
127
|
log "installing Node.js $line"
|
|
118
128
|
fi
|
|
@@ -126,8 +136,9 @@ install_node() {
|
|
|
126
136
|
# A held package or another repository pinned above nodesource can leave the
|
|
127
137
|
# old version in place with apt reporting success. Caught here, it names the
|
|
128
138
|
# problem; caught by the next deploy, it would only name the symptom.
|
|
129
|
-
|
|
130
|
-
|
|
139
|
+
current=$(node -p 'process.versions.node.split(".")[0]' 2>/dev/null || echo 0)
|
|
140
|
+
{ [ "$current" -ge "$line" ] 2>/dev/null && node_at_least 22 17; } \
|
|
141
|
+
|| die "Node.js is $(node -v 2>/dev/null || echo 'missing') after installing $line.x - check for a held nodejs package or another repository pinned above nodesource"
|
|
131
142
|
}
|
|
132
143
|
install_node
|
|
133
144
|
|