Skip to main content

Generate Commands

The MonsterJS CLI is a powerful tool that simplifies the process of creating components, services, and other necessary files for a MonsterJS application.

The syntax for the generate command in MonsterJS CLI is mn generate <type> <name>. Here, the <type> is the type of file to be generated, and <name> refers to the name of the file to be created. The name field can also accept a file path.

Here's an example command that generates a component in MonsterJS CLI:

mn generate component my-component

The command above will generate the files like the following.

├── hello-world.component.tsx
└── hello-world.component.scss

Generate Types

Here's a list of available types for the generate command in MonsterJS CLI.

componentGenerate a component file.
guardGenerate a route guard that can help the developer to allow or prevent the user from navigating certain paths or viewing components.
serviceGenerate a service file that will hold the business logic of the application.
classGenerate a simple typescript class.
interfaceGenerate a typescript interface to describe a data.
directiveGenerate a directive file.

For more information about each command in MonsterJS CLI, we can check the help feature of the cli. The syntax for this is mn <command> --help, where <command> is the name of the command you want to learn more about.


mn generate component --help

This will show additional information for the generate component command.