🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

generate-react-cli

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

generate-react-cli

A simple React CLI to generate components instantly and more.

1.5.6
Source
npm
Version published
Weekly downloads
7.4K
-4.94%
Maintainers
1
Weekly downloads
 
Created
Source

Generate React CLI

dependencies License

Why?

To help speed up productivity in React projects and stop copying, pasting, and renaming files each time you want to create a new component.

Few notes:

  • The CLI assumes that your project uses jest & enzyme for testing (This will be customizable in the future).
  • The CLI also has an opinion on how files are structured within the project. We follow "grouping by features."

Install

npm i -g generate-react-cli

Config File

When you run generate-react-cli within your project the first time, it will ask you a series of questions to customize the cli for your project needs (this will create a "generate-react-cli.json" config file).

e.g. generate-react-cli.json

{
  "component": {
    "path": "src/components",
    "css": {
      "preprocessor": "scss",
      "module": true
    },
    "withTest": true,
    "withStory": true,
    "withLazy": true
  }
}

Commands

Generate Component

generate-react component <ComponentName>

Shorthand

g-r c <ComponentName>

This command will create a folder with your component name within your default (e.g. src/components) directory, and its corresponding files.

Options

ParameterDescriptionDefault Value
-p or
--path
Value of the path where you want the component to be generated in (e.g. src/pages).src/components
-t or
--withTest
Create a corresponding test file with this component?Boolean value selected in "generate-react-cli.json" config file
-s or
--withStory
Create a corresponding story file with this component?Boolean value selected in "generate-react-cli.json" config file
-l or
--withLazy
Create a corresponding lazy file (a file that lazy-loads your component out of the box and enables code splitting) with this component?Boolean value selected in "generate-react-cli.json" config file

Have fun!

Keywords

cli

FAQs

Package last updated on 18 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts