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 @@
"clean": "git clean -xdf .cache .turbo dist node_modules",
"db:generate": "cross-env SKIP_ENV_VALIDATION=1 pnpm dlx @better-auth/cli@1.4.3 generate --config src/server.ts --output ../db/src/schema/auth.ts --y",
"db:seed": "cross-env SKIP_ENV_VALIDATION=1 pnpm dlx tsx ./src/scripts/seed.ts",
"admin:grant": "cross-env SKIP_ENV_VALIDATION=1 pnpm dlx tsx ./src/scripts/grant-admin.ts",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"test": "vitest run",