1.0.2 • Published 5 years ago

generate-reactjs-component v1.0.2

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

Generate React Component

A CLI utility for quickly creating React components

Installation

Install Globally

 npm install -g generate-reactjs-component

Usage

 gc [options] ComponentName [...ComponentNames]

Example

Running the following command:

 gc HomePage

will create the following files in the current directory:

HomePage.js

import React from 'react';

let HomePage = () => {
	return (
		<div>
			HomePage Component
		</div>
	)
}

export default HomePage;

test/HomePage.test.js

import React from 'react';
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import HomePage from '../HomePage';

describe('<HomePage />', () => {

	it('should render', () => {
		const wrapper = shallow(<HomePage />);
		expect(toJson(wrapper)).toMatchSnapshot();
	});
});

Options

--create-dir: creates a directory with the same name as the component being generated and adds the files to that directory instead of the current one.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

ISC