npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-comp-gen

v1.0.8

Published

CLI for generating react component boilerplate

Downloads

10

Readme

react-comp-gen

Generate React component boilerplate quickly with minimal typing.

Installation

From npm:

npm i -g react-comp-gen

Usage

$ react-comp-gen generate <type> <name> # generate a component
                                        # Default command
$ react-comp-gen generate function "a-component" --dir "./src/containers"
# Generate/gen/g can be omitted
$ rcg fn a-component -d "./src/containers"

Creating Stateless Functional Component AComponent in ~/Desktop/my-sweet-project/src/containers...

Configuration

By default, react-comp-gen will check for config files (.reactgenrc) in the working directory, then your home directory. These configs are not merged, and the local config wins if both are present. If you want to run rcg without checking config files, pass -N or --no-config. If you want to pass in the relative path to a config file, pass in -c="./my/local/config".

Sample config:

{
  "withCss": "scss",
  "useFlow": true
}

Arguments

  • Type (Positional, Enum, Required):

    • The following inputs are valid as types:
      • f, F, fn, FN, func, function: Stateless Functional Component
      • c, C, comp, component: Class Component
      • pc, PC, purecomp, purecomponent: PureComponent
  • Name (Positional, String, Required):

    • Component/File Names will be PascalCased:
      • "test-component" becomes "TestComponent"
  • Dir (-d, --dir: String, Optional; Default: ./src/components):

    • This is where your component directory will be generated
  • Use Flow (--use-flow: Boolean, Optional; Default: false):

    • Generate components with type definitions and flow file annotation (/* @flow */) at the top.
  • Dry Run (--dry-run: Boolean, Optional; Default: false):

    • If true, components will be written to STDOUT instead of saved to disk.
  • Force (-f, --force: Boolean, Optional; Default: false):

    • If true, CLI will not prompt before overwriting existing directories (dangerous)
  • CSS (-s, --with-css: Enum, Optional; Default: css):

    • Enum: 'css' | 'sass' | 'scss' | 'less'
  • Config (-c, --config: String, Optional):

    • Specify a config file path to look in other than ~ or ./
  • No Config (--no-config: Boolean, Optional; Default: false):

    • Do not read config files, only read args from ARGV

Bugs, Pull Requests

https://github.com/pdeona/react-comp-gen