UNPKG

saget-auth-middleware

Version:

A comprehensive authentication middleware for Node.js applications with SSO integration, JWT validation, and role-based access control

33 lines (27 loc) 1.11 kB
#!/usr/bin/env node /** * SAGET Auth Middleware CLI * Generate middleware files for JavaScript and TypeScript projects */ import { program } from 'commander'; import { initCommand } from '../cli/commands/init.js'; import { readFileSync } from 'fs'; import { fileURLToPath } from 'url'; import { dirname, join } from 'path'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf8')); const { version } = packageJson; program .name('saget-auth-middleware') .description('Generate authentication middleware files directly in your project root') .version(version); program .command('init') .description('Generate middleware files in current directory (default) or specified path') .option('-t, --type <type>', 'Project type (js|ts)', 'js') .option('-f, --framework <framework>', 'Framework (next|express)', 'next') .option('-o, --output <path>', 'Output directory', '.') .option('--interactive', 'Use interactive mode', false) .action(initCommand); program.parse();