@rccpr/auth-gate
v0.3.1
Published
A library for conditional rendering components based on authentication/authorization
Readme
auth-gate
A JSR-compliant React library for protecting views in your application with authentication gates.
Partially inspired by the Clerk Protect component.
Installation
From JSR (recommended)
# Deno
deno add @rccpr/auth-gate
# npm
npx jsr add @rccpr/auth-gate
# Yarn
yarn dlx jsr add @rccpr/auth-gate
# pnpm
pnpm dlx jsr add @rccpr/auth-gate
# Bun
bunx jsr add @rccpr/auth-gateFrom npm
# npm
npm install @rccpr/auth-gate
# Yarn
yarn add @rccpr/auth-gate
# pnpm
pnpm add @rccpr/auth-gate
# Bun
bun add @rccpr/auth-gateDevelopment
Prerequisites
- Bun (for development)
Setup
bun installAvailable Scripts
# Build for npm
bun run build
# Type checking
bun run typecheck
# Lint with Biome
bun run lint
# Fix linting issues
bun run lint:fix
# Format code
bun run formatJSR Compliance
This library follows JSR's "no slow types" policy:
- ✅ All exported functions have explicit return types
- ✅ All exported types are properly declared
- ✅
isolatedDeclarations: truein TypeScript config - ✅ No destructuring in exports
- ✅ No global or module augmentation
License
MIT
