# compogen

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

Latest version **1.0.1** (published 2023-04-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install compogen
pnpm add compogen
yarn add compogen
bun add compogen
```

Provides the command `compogen`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-04-04 |
| First published | 2023-04-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 14.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | David Hilman |
| Maintainers | dhilman |
| Keywords | react, cli, component, generator, template, react-component-generator, storybook |

## Links

- npm: https://www.npmjs.com/package/compogen
- Repository: https://github.com/dhilman/compogen
- Issues: https://github.com/dhilman/compogen/issues
- npm.io page: https://npm.io/package/compogen

## Dependencies (4)

- [esm](https://npm.io/package/esm.md) ^3.2.25
- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [yargs](https://npm.io/package/yargs.md) ^17.7.1
- [fs-extra](https://npm.io/package/fs-extra.md) ^11.1.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2023-04-04
- 1.0.0 — 2023-04-04

## README

# 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

```bash
npm install --save-dev compogen
```

### Configuration

Add the following to your `package.json`:

```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:
```typescript
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

```bash
# help
npm run compogen -- --help
```

```bash
npm run compogen -- [options] componentName
```

--- 

### Global Installation

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

```bash
npm install -g compogen
```

#### Usage

```bash
compgen [options] componentName
```

---
_Source: https://npm.io/package/compogen · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
