next-component-cli
v1.1.1
Published
CLI for creating new React components
Downloads
9
Maintainers
Readme
next-component-cli
This is package for create new component
Quick Start
Install via NPM:
# Using NPM
$ npm i next-component-cli
# or, using PNPM:
$ pnpm i next-component-cli
Reference
This package has several options for generating files.
-i = {ComponentName}.tsx
-t = {ComponentName}.types.ts
-h = {ComponentName}.hooks.ts
-c = {ComponentName}.constants.ts
-s = {ComponentName}.schemas.ts
-all = generate all files
You can create a folder structure according to what you want to create.
cd
into your project's directory, and try creating a new component:
$ new-component NewComponent
Your project will now have a new directory has five files index
, view
, types
, hooks
, constants
:
// `NewComponent/index.tsx`
import NewComponent from './NewComponent';
export default NewComponent;
$ new-component <ComponentName> <Option>
$ new-component NewComponent -all
# or
$ new-component NewComponent -i -t -c -h -s
$ new-component <ComponentName> -d <Path>
$ new-component NewComponent -d features/parent-folder/views
$ new-component <ComponentName> <Path> <Option>
$ new-component NewComponent -d features/parent-folder/views -all
# or
$ new-component NewComponent -d features/parent-folder/views -i -t -c -h -s
These files will be formatted according to your Prettier configuration.