2.0.3 • Published 2 years ago

create-react-file v2.0.3

Weekly downloads
22
License
ISC
Repository
github
Last release
2 years 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

2 years ago

2.0.2-alpha.5

3 years ago

2.0.2-alpha.4

3 years ago

2.0.2-alpha.3

3 years ago

2.0.2-alpha.2

3 years ago

2.0.2-alpha.1

3 years ago

2.0.2

4 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.28

5 years ago

1.1.27

5 years ago

1.1.26

6 years ago

1.1.25

6 years ago

1.1.24

6 years ago

1.1.23

7 years ago

1.1.22

7 years ago

1.1.21

7 years ago

1.1.20

7 years ago

1.1.19

7 years ago

1.1.18

7 years ago

1.1.17

7 years ago

1.1.16

7 years ago

1.1.15

7 years ago

1.1.14

7 years ago

1.1.13

7 years ago

1.1.12

7 years ago

1.1.11

7 years ago

1.1.10

7 years ago

1.1.9

8 years ago

1.1.8

8 years ago

1.1.7

8 years ago

1.1.6

8 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago