Skip to content

alchemmist/react-comps-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Favicon Preview react-comps-generator

Repo GitHub Release Last commit Stars Forks License Contributors Rust Colored

About: Blazingly fast command line utility for generating React components faster.

Motivation: Imagine you're writing on React. You need to create new component, or new page, or new module, etc. What you need to do is:

  1. go to directory
  2. make directory like your-component
  3. in this directory create two empty files: YourComponent.jsx and YourComponent.css
  4. in the .jsx file you need to write the basic skeleton:
import "./YourComponent.css";

const YourComponent = () => {
    return (
        <>
            <some elements>
        </>
    );
}

export default YourComponent;

And then finally, only then can you write a business logic. In this pipeline at every stop you can make a type or a mistake. Then you have to spend time looking through all the titles. Culmination: 👎

Usage

With this utility pipeline the pipeline becomes a single command to start writing business logic:

rgc # if you have useful alias

Then you need to select what you want to create:

Which folder should we put the component in?
c — components, p — pages, m - modules:

Set the name:

What do we call the component? pages/

Accept changes:

So I'm creating the files:

        ./pages/Test.jsx
        ./pages/Test.scss

Ok? [y]/n:

Done!

Demo

Demo GIF

Installation

After cloning repo run:

cd react-comps-generator
cargo build --release

Then add to $PATH this directory:

/path/to/repo/react-comps-generator/target/release

To use shorter rgc command you can add alias to your shell:

alias rgc="react-comps-generator"

Or make alias to release folder, to avoid editing $PATH.

Questions | Contribute

If you have questions about this repo or you want to contribute, text me!

License

Licensed under of The MIT License.

Contributors

About

Lab work — fast utility for generate react component

Resources

License

Stars

Watchers

Forks

Languages