From 5d8237386dd905ec38e2701391262637609e2187 Mon Sep 17 00:00:00 2001 From: urania Date: Fri, 26 Jun 2026 13:57:00 +0200 Subject: [PATCH] feat: bootstrap admin user on first run --- release.sh | 4 ++++ src/hooks.server.ts | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/release.sh b/release.sh index 2343726..6a7673f 100755 --- a/release.sh +++ b/release.sh @@ -8,6 +8,10 @@ cd "$(dirname "$0")" BUMP="${1:-patch}" [ -z "$(git status --porcelain)" ] || { echo "working tree dirty, commit first"; exit 1; } +# verify we can push BEFORE bumping — otherwise a failed push leaves the +# version advanced locally with nothing on the remote. +git push --dry-run >/dev/null 2>&1 || { echo "git push auth failed — fix your remote/credentials before bumping"; exit 1; } + # bumps version in package.json AND creates commit + tag vX.Y.Z bun pm version "$BUMP" git push --follow-tags diff --git a/src/hooks.server.ts b/src/hooks.server.ts index aa26e55..6135772 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -4,8 +4,8 @@ import { building, dev } from '$app/environment'; import { getAuth } from '$lib/auth/server'; import { getTextDirection } from '$lib/paraglide/runtime'; import { paraglideMiddleware } from '$lib/paraglide/server'; -import { db } from '$lib/server/db'; import { getConfig } from '$lib/server/config'; +import { db } from '$lib/server/db'; import { svelteKitHandler } from 'better-auth/svelte-kit'; import { randomBytes } from 'node:crypto'; @@ -34,11 +34,11 @@ export const init: ServerInit = async () => { await getAuth().api.createUser({ body: { + data: { displayUsername: username, emailVerified: true, username }, email, name: username, password, - role: 'admin', - data: { username, displayUsername: username, emailVerified: true } + role: 'admin' } });