feat(auth): pnpm admin:grant <email> CLI to flip user role to admin

Tiny tsx script that flips user.role to "admin" via BetterAuth's admin
plugin convention (role column on the existing user table, not a custom
isAdmin boolean).

Wired through packages/auth → root package.json with the same env-sourcing
pattern as auth:seed.

Usage:
  pnpm admin:grant me@example.com
This commit is contained in:
Alejandro Gutiérrez
2026-04-04 22:47:34 +01:00
parent 30928cd71d
commit 76c32b2345
3 changed files with 46 additions and 0 deletions

View File

@@ -13,6 +13,7 @@
"lint:ws": "pnpm dlx sherif@latest -r packages-without-package-json",
"prepare": "husky",
"auth:seed": "set -a && source apps/web/.env.local && set +a && pnpm --filter @turbostarter/auth db:seed",
"admin:grant": "set -a && source apps/web/.env.local && set +a && pnpm --filter @turbostarter/auth admin:grant",
"services:logs": "docker compose logs -f",
"services:setup": "pnpm services:start && pnpm with-env turbo setup",
"services:start": "docker compose up -d --wait",