@jilio/addnew
v1.0.6
Published
A utility for adding new components using feature-sliced methodology
Downloads
247
Readme
Addnew
addnew is a command-line utility designed to simplify the creation of new components in your feature-sliced architecture.
This tool supports the generation of various component types such as pages, widgets, features, entities, and shared. It also takes care of correctly updating paths in your tsconfig.json file.
Installation
yarn add -D @jilio/addnewFor easier access, you can add it to the scripts section of your package.json:
"scripts": {
"addnew": "npx @jilio/addnew"
}Usage
To create a new component, use the following syntax:
npx @jilio/addnew <component_type> <component_name><component_type> should be one of the following:
- page
- widget
- feature
- entity
- shared
<component_name> is the name of your new component.
For example, to create a new feature named ThemeToggle, you would run:
npx @jilio/addnew feature ThemeToggleor
yarn addnew feature themeToggleThis will create a new directory in your src/4_features directory named ThemeToggle, with a React component file (ThemeToggle.tsx) and an index.ts file.
Note
For shared type, it just creates a single .ts file instead of a full component structure. For example:
npx @jilio/addnew shared routerThis will create a new router.ts file in your src/6_shared directory.
License
MIT
