2.0.3 • Published 6 months ago

create-react-file v2.0.3

Weekly downloads
22
License
ISC
Repository
github
Last release
6 months ago

create-react-file

Use command line to create component or something else

Installation

npm install create-react-file -g

Execution

$ create-react-file Component

Create folder ./Component and file Component.jsx, index.js, Component.css.

Component.jsx

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';

class Component extends Component {
  constructor(props) {
    super(props);
  }

  static propTypes = {};

  static defaultProps = {};

  state = {};

  render() {
    const { className, children, ...others } = this.props;

    const cls = classnames({
      'components-component-render': true,
      [className]: !!className,
    });

    return (
      <div className={cls} {...others}>
        { children }
      </div>
    );
  }
}

export default Component;

Component.scss

.components-component-render {
  
}

index.js

import './Component.scss';
import Component from './Component';

export default Component;

Help

$ create-react-file --help
  Usage: create-react-file [options] <name> [parentName]

  Options:
    -f, --function  create function component
    -p, --page      create component as page
    -s, --single    create single file Component.jsx
    -h, --hooks     create file hooks.js
    -h, --help      output usage information

Simply command-line

Little tip with oh my zsh. Changing .zshrc like this makes the tool be more convenient.

alias cf="create-react-file"
alias cfp="create-react-file -p"
2.0.3

6 months ago

2.0.2-alpha.5

2 years ago

2.0.2-alpha.4

2 years ago

2.0.2-alpha.3

2 years ago

2.0.2-alpha.2

2 years ago

2.0.2-alpha.1

2 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

4 years ago

1.1.28

4 years ago

1.1.27

4 years ago

1.1.26

5 years ago

1.1.25

5 years ago

1.1.24

5 years ago

1.1.23

5 years ago

1.1.22

5 years ago

1.1.21

6 years ago

1.1.20

6 years ago

1.1.19

6 years ago

1.1.18

6 years ago

1.1.17

6 years ago

1.1.16

6 years ago

1.1.15

6 years ago

1.1.14

6 years ago

1.1.13

6 years ago

1.1.12

6 years ago

1.1.11

6 years ago

1.1.10

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago