1.0.6 • Published 6 months ago

kz-structure-handler v1.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

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:

  1. Generate a new module structure:

    kz user:components
  2. Generate a component or view inside an existing module:

    kz user:views:profile
  3. 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:

  1. Fork the repository.
  2. Create a feature branch.
  3. 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.