kawkab-frontend
Version:
Kawkab frontend is a frontend library for the Kawkab framework
14 lines (13 loc) • 546 B
JavaScript
import { generateFile } from '../utils/stub.js';
export function makeContextCommand(program) {
program
.command('make:context <name> [module]')
.description('Create a new React Context with Provider and custom hook')
.action((name, module = 'main') => {
const contextName = name.charAt(0).toUpperCase() + name.slice(1);
const targetPath = `app/${module}/contexts/${contextName}Context.tsx`;
generateFile('context.stub', targetPath, {
ContextName: contextName,
});
});
}