1.0.3 • Published 5 years ago

@tsw38/create-react-component v1.0.3

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
5 years ago

Introduction

IDE snippets are ephemeral and aren't easily shared. I generally like all of my files to live close together and I am pretty lazy, so I created this package to automate my react component creation.

Installation

Local Install

$ npm i --save-dev @tsw38/create-react-component

Global Install

$ npm i -g @tsw38/create-react-component

Usage

This package adds two binaries to the node_modules crc and create-react-component, they both do the same thing and for the purposes of this read me, I will be using them interchangably.

OptionAliasDescriptionDefault
--destination-dAn optional flag for the destination of the componentsrc/components
--component-cThe name of the component to be createdn/a
--typescript--tsIf the component should be a ts filefalse
--with-story--wsIf a story file should be includedfalse

Examples:

If this was installed globally, you do not need to preface commands with npx. If you add this to your npm scripts you will have to do make sure to pass arguments to crc with a double dash

npx crc -c Calculator

This creates a javascript component named Calculator within src/components

npx crc -d src/common -c SomeComponent --ts --ws

This create a typescript component named SomeComponent within src/common/SomeComponent with a story file for storybook