Skip to content

Jushiro012623/infy-react-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Infy React CLI

A lightweight and flexible command-line tool to scaffold React components, hooks, pages, and providers with ease.


Features

  • Generate ready-to-use React components, hooks, pages, and providers
  • Supports nested folder paths (e.g., ui/Button)
  • Choose between JS, JSX, TS, TSX file extensions

Installation

🔹 Global Installation

npm install -g infy-react-cli

Or using yarn:

yarn global add infy-react-cli

Then you can run commands directly:

infy g component Button

🔹 Local Installation (Recommended for Teams)

If you prefer to install it locally (inside your project):

npm install infy-react-cli --save-dev

Then use npx to run commands:

npx infy g component Button

💡 Note: When installed locally, always prefix commands with npx (e.g., npx infy info, npx infy init).


Usage

Generate a React Component

infy g component Button

Creates:

src/components/Button.jsx

Other Generators

Type Example Command Output Path
component infy g component Card src/components/Card.jsx
hook infy g hook useCounter src/hooks/useCounter.js
page infy g page Home src/pages/Home.jsx
provider infy g provider AppProvider src/provider/AppProvider.jsx

Configuration (.infyrc.json)

You can customize where files are generated by creating a .infyrc.json file in your project root.

🪄 Generate the config file automatically

Run:

infy init

This command creates a .infyrc.json file with default paths:

{
  "paths": {
    "component": "src/components",
    "hook": "src/hooks",
    "page": "src/pages",
    "provider": "src/provider"
  },
  "extension": "jsx"
}

You can edit these paths anytime. For example:

{
  "paths": {
    "component": "app/ui",
    "hook": "app/hooks",
    "page": "app/pages",
    "provider": "app/providers"
  },
  "extension": "tsx"
}

Now, all generated files will follow your custom folder structure


Future Enhancements

  • Add template customization (user-defined blueprints)
  • Interactive prompts for config setup
  • TypeScript CLI generation
  • Integration with React frameworks (Next.js, Vite)

Author

Ivan Dev

Built for fast React development.


🪪 License

This project is licensed under the MIT License.

About

A lightweight CLI to generate React components, hooks, pages, and providers instantly.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors