# srcg

> Naively simple (and biased) generator for React components

Latest version **0.1.4** (published 2017-10-11) · ISC license · 0 weekly downloads

## Install

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

Provides the command `srcg`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2017-10-11 |
| First published | 2017-09-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | glosee |

## Links

- npm: https://www.npmjs.com/package/srcg
- Repository: https://github.com/glosee/srcg
- Homepage: https://github.com/glosee/srcg#readme
- Issues: https://github.com/glosee/srcg/issues
- npm.io page: https://npm.io/package/srcg

## Dependencies (2)

- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [handlebars](https://npm.io/package/handlebars.md) ^4.0.10

## Recent versions

- 0.1.4 (latest) — 2017-10-11
- 0.1.3 — 2017-10-11
- 0.1.2 — 2017-09-08
- 0.1.1 — 2017-09-08

## README

# SRCG (Simple React Component Generator)

This is an extremely basic generator for React components. It currently supports generating a regular class or functional component. It was designed to take away a little bit of the boilerplate you need when making a bunch of components.

## Install

```
$ npm install -g srcg
```

_Prefers global installation, but it should also work local to a project._

## Example Usage

```
$ srcg --name 'MyComponentsName' --type 'function' --path 'js/components --connected'
```

## Options

### name

The name of the Component, which is used as the variable/class name and the default export name.

### type

Either `'function'` or `'class'` (default is `'class'`).

When `'function'` output is

```
$ react-component-generator --name='MyComponentsName' --type='function' --path='js/components'

// MyComponentsName.js
import PropTypes from 'prop-types';
import React from 'react';

const MyComponentsName = props => {

};

MyComponentsName.propTypes = {

};

export default MyComponentsName;
```

When `'class'` output is

```
import PropTypes from 'prop-types';
import React from 'react';

class MyComponentsName extends React.Component {

}

MyComponentsName.propTypes = {

};

export default MyComponentsName;
```

### path

The output path, relative to the current working directory.

### connected

Pass this to create a class that is wrapped with `connect` and `mapStateToProps` (a la `react-redux`)

## Why?

Because I was tired of writing `import PropTypes from 'prop-types'` 20 times a day.

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