rn-component-generator

0.0.3 • Public • Published

rn-component-generator

Simple, customizable utility for adding new React components to your project.

This project is a globally-installable CLI for adding new React native components. It's dead simple to use, and requires no configuration, although it's easy to customize it to fit your project's coding style.


Features

  • Simple CLI interface for adding Component, PureComponent, or Stateless Functional components.
  • Uses Prettier to stylistically match the existing project.
  • Offers global config, which can be overridden on a project-by-project basis.
  • Colourful terminal output!

Quickstart

Install via NPM:

$ npm i -g rn-component-generator

$ npm link rn-component-generator

Configuration

Configuration can be done through 3 different ways:

  • Creating a global .rn-component-generator-config.json in your home directory (~/.rn-component-generator-config.json).
  • Creating a local .rn-component-generator-config.json in your project's root directory.
  • Command-line arguments.

The resulting values are merged, with command-line values overwriting local values, and local values overwriting global ones.


API Reference

Type

Control the type of component created:

  • class for a traditional Component class (default),
  • pure-class for a PureComponent class,
  • functional for a stateless functional component.

Legacy createClass components are not supported, although support would be easy to add. Feel free to open an issue (or a PR!).

Usage:

Command line: --type <value> or -t <value>

JSON config: { "type": <value> }

Directory

Controls the desired directory for the created component. Defaults to src/

Legacy createClass components are not supported, although support would be easy to add. Feel free to open an issue (or a PR!).

Usage:

Command line: --dir <value> or -d <value>

JSON config: { "dir": <value> }

File Extension

Controls the file extension for the created components. Can be either js (default) or jsx.

Usage:

Command line: --extension <value> or -x <value>

JSON config: { "extension": <value> }

Package Sidebar

Install

npm i rn-component-generator

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

12.2 kB

Total Files

8

Last publish

Collaborators

  • hiral.parmar