UNPKG

kawkab-frontend

Version:

Kawkab frontend is a frontend library for the Kawkab framework

14 lines (13 loc) 549 B
import { generateFile } from '../utils/stub.js'; export function makeHookCommand(program) { program .command('make:hook <name> [module]') .description('Create a new custom React hook in a specific module') .action((name, module = 'main') => { const hookName = name.startsWith('use') ? name : `use${name.charAt(0).toUpperCase() + name.slice(1)}`; const targetPath = `app/${module}/hooks/${hookName}.ts`; generateFile('hook.stub', targetPath, { HookName: hookName, }); }); }