1.0.1 • Published 1 year ago

compogen v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Create Component CLI

A CLI tool for creating new React components with custom templates.

Features

  • Creates functional components with or without refs
  • Allows custom templates via template.js file
  • Optional storybook and index files (from template)

Setup

Installation

npm install --save-dev compogen

Configuration

Add the following to your package.json:

{
  "scripts": {
    "compogen": "compogen"
  }
}

Further configuration is done via a template.js file in the root directory of your project. This file should export an object with the following properties:

interface Config {
  dir: string;
  ext: 'ts' | 'js';
  i: boolean;
  n: boolean;
  t: 'functional' | 'functionalWithRef';
  componentName: string;
  s: boolean;
  templates?: {
    functional?: string;
    functionalWithRef?: string;
    storybook?: string;
    index?: string;
  }
}

Usage

# help
npm run compogen -- --help
npm run compogen -- [options] componentName

Global Installation

You can install the CLI globally, so that you can use it for any project.

npm install -g compogen

Usage

compgen [options] componentName