my-component-generator v1.4.7
React Component Generator
This npm package allows you to quickly generate new components in your React application. This component generator uses mkdirp
, fs
, and path
packages to create a new component folder, with an index file, a .jsx
file, and a .module.css
file.
Installation
To install this package, add it to your devDependencies
in the package.json
file and run the following command:
npm install
Add Script
Create a new script in your package.json file by adding the following line to the scripts object:
"new-component": "my-component-generator"
Usage
To generate a new component, run the following command:
npm run new-component [component-name] [directory]
component-name
is the name you want to give to your new component. directory
is optional and represents the directory where you want to create the new component. By default, the component will be created in a folder named components
inside the src
folder.
Configuration
This component generator uses a default template for the component. If you want to customize the component template, you can modify the jsxContent
and cssContent
variables in the index.js
file.
Additionally, you can configure the package by modifying the variables at the top of the index.js
file. These variables include:
componentName
: the name of the component filedirectory
: the directory where the new component should be created
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago