kz-structure-handler v1.0.6
KZ Structure Handler
A CLI tool to generate project files and update router configurations for Vue.js applications.
Table of Contents
Installation
To install this package globally, run the following command:
npm install -g kz-structure-handler
Or, add it to your project as a dev dependency:
npm install --save-dev kz-structure-handler
Usage
To use kz-structure-handler
, run the following command with the appropriate arguments:
kz <moduleName>:<folderName>[:<componentName>]
Examples:
Generate a new module structure:
kz user:components
Generate a component or view inside an existing module:
kz user:views:profile
Create a new module:
kz user:modules
Options
The command accepts the following parameters:
moduleName
: Name of the module (e.g.,user
).folderName
: Folder type where the content will be generated (e.g.,components
,views
,stores
).componentName
(optional): Name of the component to be created (e.g.,profile
).
Features
- Automatically generates files and folders for Vue components, views, stores, and more.
- Dynamically injects routes into Vue.js router files.
- Customizable templates for Vue components, SCSS, stores, and router configurations.
Examples
Example 1: Generating a New Module
Run the following command to create a new module with components, views, stores, router, and locales:
kz user:modules
This will generate the following directory structure:
src/
modules/
user/
components/
views/
stores/
router/
locales/
Example 2: Generating a New View
Run the following command to generate a new view inside the user
module:
kz user:views:profile
This will create:
src/modules/user/views/profile/
index.vue
index.scss
Error Handling
- If no valid argument is provided, the CLI will display an error and exit.
- If the module or folder doesn't exist, it will prompt the user to create them first.
- If the router file does not contain the necessary dynamic routes markers, an error will be thrown.
Contributing
We welcome contributions! To get started:
- Fork the repository.
- Create a feature branch.
- Submit a pull request.
Ensure you follow the code style and add tests if necessary.
License
This project is licensed under the MIT License.
Contact
For any questions, please contact Kerolos Zakaria.