1.0.2 • Published 2 years ago

react-ct v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

react-cli-tool

react-cli-tool is a TypeScript CLI tool for creating react component boilerplate

Note: Please install this package globally for best compatibility
npm i -g react-ct

Example usage

rct -gc componentName

If you would like to generate a component further down in the file hierarchy just pass prefix the name of your component with the file path
Example: rct -gc Components/HomePage/componentName

Output

CREATE /Users/user/Desktop/directory/app/src/ComponentName/index.tsx
CREATE /Users/user/Desktop/directory/app/src/ComponentName/ComponentName.tsx
CREATE /Users/user/Desktop/directory/app/src/ComponentName/ComponentName.tsx

src/ComponentName/index.tsx

export { default } from './ComponentName';

src/ComponentName/ComponentName.tsx

import React from 'react';
import './ComponentName.scss';

const ComponentName = () => {
  return <div className="component-name">ComponentName</div>;
};

export default ComponentName;

src/ComponentName/ComponentName.scss

.component-name {
}

Options

-v, --version : Returns currently installed version of react-ct

-gc, --generate-component "componentName" : Generates component directory and corresponding files, converts given name to camelCase

To Do:

  • Implement compatibility for non TypeScript projects
  • Option to generate classical components instead of hooks
  • Option to ignore the default component naming convention