cr-components

Script to simple creation of React components

Usage no npm install needed!

<script type="module">
  import crComponents from 'https://cdn.skypack.dev/cr-components';
</script>

README

Create React Components

This package created to simplify React components structure creation in new React project.

Warning

Don't use this module in your old React projects, module can cause damage. You are free to use this in new React project.

How to use it?

  1. Create new React project. Read a official CRA docs to know how to do this.
  2. Create config with name components.yml. It can looks like:
    # components.yml
    app: # it is the folder
      components: # it is the folder
        - App # it is the component
    client:
      Header:
        components:
          - Header
          - Navbar
          - NavbarMenu
    shared:
      components:
        - Button
        - Logo
    
  3. Run npx cr-components create-all to parse and create components from a config.

Every component`s folder will be created with next files: Component.jsx, Component.css, index.js.

Example folder tree:

├───app
│   └───components
│       └───App
├───client
│   └───Header
│       └───components
│           ├───Header
│           ├───Navbar
│           └───NavbarMenu
└───shared
    └───components
        ├───Button
        └───Logo

Advice

Run cr-components create-all -h to see more options.

To be continued...