create-component-x

1.2.11 • Public • Published

create-component-x is a command-line tool that allows you to create a component based on a blueprint

Installation

npm i -g create-component-x

Usage

Create a blueprint

Blueprint is a folder with component's structure. Use $compName$ as a placeholder for component name in filenames and inside the code.

Example of blueprint folder:

blueprint
│
│───src
│   │–––$compName$.js
│   └───$compName$.scss
│
│──tests
│   └───$compName$-test.js
│
│–––README.md
└───package.json

Example of component's blueprint:

import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
 
import cls from 'classnames';
import styles from './$compName$.scss';
 
class $compName$ extends PureComponent {
  static propTypes = {};
  static defaultProps = {};
  render() {
    return (
      <div className={styles.$compName$}>
        $compName$
      </div>
    );
  }
}
 
export default $compName$;

Use the blueprint

Go to the blueprint folder and add it to the storage for further use:

c-c use

Create a component

To create a component go to the target directory and run:

c-c create

Then enter component's name and select a blueprint from the list. Component is created!

Options

Custom pattern for placeholder could be used:

c-c use --pat="$comp$"

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.2.111latest

Version History

VersionDownloads (Last 7 Days)Published
1.2.111
1.2.100
1.2.90
1.2.80
1.2.70
1.2.60
1.2.50
1.2.40
1.2.30
1.2.10
1.2.00
1.1.60
1.1.50
1.1.40
1.1.30
1.1.20
1.1.10
1.1.00
1.0.170
1.0.160
1.0.150
1.0.140
1.0.130
1.0.120
1.0.110
1.0.100
1.0.90
1.0.80
1.0.70
1.0.60
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i create-component-x

Weekly Downloads

1

Version

1.2.11

License

none

Unpacked Size

18.8 kB

Total Files

25

Last publish

Collaborators

  • zharsky