@carpediem23/ra-cli
v1.4.1
Published
CLI tool to generate React component templates
Maintainers
Readme
ra-cli
A CLI tool for React and TypeScript developers to quickly generate components, types, interfaces, and hooks.
Need Contirbutors 📢📢📢
🪲 Please create a issue if you want to contribute to this project.
https://github.com/carpediem23/ra-cli/issues
Installation
npm install -g @carpediem23/ra-cliUsage
Generate a React Component
npx ra create --component --name ComponentSampleThis will create:
- A file
ComponentSample.tsxwith a default exported component
Generate a TypeScript Type
npx ra create --type --name TTypeSampleThis will create a type definition in TTypeSample.ts that is exported as a named export.
Generate a TypeScript Interface
npx ra create --interface --name TInterfaceSampleThis will create an interface definition in TInterfaceSample.ts that is exported as the default export.
Generate a React Hook
npx ra create --hook --name HookSampleThis will create a React hook in HookSample.ts that is exported as the default export.
Generate a React Context
npx ra create --context --name ContextSampleThis will create a React context in ContextSample.tsx that includes a context component named ContextSample and a custom hook named useContextSample to use the context.
Specifying a Path
You can specify where to create the files using the --path option:
npx ra create --component --name Button --path src/componentsThis will create Button.tsx in the src/components directory. If the directory doesn't exist, it will be created automatically.
The path option works with all creation commands (component, type, interface, hook, context).
