# @rehx/react-component-cli

> CLI for creating new React components

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

## Install

```sh
npm install @rehx/react-component-cli
pnpm add @rehx/react-component-cli
yarn add @rehx/react-component-cli
bun add @rehx/react-component-cli
```

Provides the command `crc`.

## 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.0 |
| Published | 2023-04-15 |
| First published | 2023-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Jesse Ajioh |
| Maintainers | rehx |
| Keywords | react, reactjs, cli, component, boilerplate |

## Links

- npm: https://www.npmjs.com/package/@rehx/react-component-cli
- Repository: https://github.com/ajiohjesse/react-component-cli
- Homepage: https://github.com/ajiohjesse/react-component-cli#readme
- Issues: https://github.com/ajiohjesse/react-component-cli/issues
- npm.io page: https://npm.io/package/@rehx/react-component-cli

## 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.0 (latest) — 2023-04-15

## README

# React Component CLI

Easily bootstrap new react components based on your
preferences.

## Usage

To create a button component, run the following command in
your terminal;

```bash
  crc button
```

- src
  - components
    - button.jsx

### For nested components

```bash
  crc PageLayout layouts
```

- src
  - components
    - layouts
      - PageLayout.jsx

## Installation

Clone the project

```bash
  git clone https://github.com/ajiohjesse/react-component-cli.git
```

Go to the project directory

```bash
  cd react-component-cli
```

Install as global

```bash
  npm install -g
```

Test your installation

```bash
  crc -v
```

## Configuration

Every new component is a react functional component. The
`src` folder is used by default and will be created if it
doesn't exist.

Default options can be changed by creating a
`crc.config.json` file in the root folder of your computer
(`C:\Users\username` for windows). This configuration will
be applied for every project.

To customize based on specific projects, create the
`crc.config.json` file in the root folder of your React project
directory.

## Default Config

```json
{
  "src": true,
  "extension": "jsx",
  "styleOption": "plain"
}
```

## Reference

| Key           | Type      | Description                                                                                                                    |
| :------------ | :-------- | :----------------------------------------------------------------------------------------------------------------------------- |
| `src`         | `boolean` | Use the `src` folder when creating new components.                                                                             |
| `extension`   | `string`  | The default file extension. Options are `js`, `jsx`, `ts`, or `tsx`.                                                           |
| `styleOption` | `string`  | Customize the component boiler plate based on prefered style option. Options are `plain`, `css-modules` or `styled-components` |

## Output

### plain

```javascript
//button.jsx

const Button = () => {
  return (
    <div>
      <h1>button</h1>
    </div>
  );
};

export default Button;
```

### css-modules

```javascript
//button.jsx

import styles from './button.module.css';

const Button = () => {
  return (
    <div>
      <h1>button</h1>
    </div>
  );
};

export default Button;
```

> **Note:** A corresponding `.module.css` file will be
> created and auto imported if style option is set to
> css-modules.

### styled-components

```javascript
//Button.jsx

import styled from 'styled-components';

const Button = () => {
  return (
    <ButtonWrapper>
      <h1>Button</h1>
    <ButtonWrapper>
  );
};

export default Button;

const ButtonWrapper = styled.div`
  display: grid;
`
```

## Flags

`crc init` - Initialize a config file in your project directory.

`crc -v` - Check version.

`crc -help` - See options.

`crc <component name> --plain` - force create a plain component.

## Author

- [@ajiohjesse](https://www.github.com/ajiohjesse)

Inspired by Josh Comeau's `new-component` available via
<a href="https://github.com/joshwcomeau/new-component">this
repository.</a>

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