Medusa-extender CLI
Tags: javascript, node, opensource, medusa
Published: 2022-03-11 17:00:06

[Medusa](https://www.medusajs.com/) is an open source headless commerce platform that allows you to create your own store in a matter of minutes. Part of what makes Medusa a good choice for your e-commerce store is its extensibility.

[Medusa-extender](https://github.com/adrien2p/medusa-extender/tree/v1.5.2) is a package that takes your medusa project to the next level. Since the medusa-extender provides quite a lot of features, a new tool has been created to make things even easier to use.

Here, we will see what features the CLI does provides you and how to use them.

## API Reference

To make things easier for you, the project comes with a CLI that allow
you to generate any component with minimum code implementation and also
to be able to run the migrations and show the list of applied and to be applied migrations.


[![-----------------------------------------------------](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/cloudy.png)](#commands-references)

### Commands references


| Name       | Alias | Description                                      |
|------------|-------|--------------------------------------------------|
| `migrate`  | `m`   | Migrate the migrations that has not been applied yet. Can also show you the migrations already applied and to be applied. |
| `generate` | `g`   | Generate a new component among: module, service, entity, repository, migration, validator, router, middleware |


#### Command `generate` reference

##### Usage

```bash
./node_modules/.bin/medex g [option]
```

##### Options


| Name                  | Alias | Description                                      |
|-----------------------|-------|--------------------------------------------------|
| `--module <name>`     | `-m`  | Generate a new module.                           |
| `--middleware <name>` | `-mi` | Generate a new middleware.                       |
| `--service <name>`    | `-s`  | Generate a new service.                          |
| `--router <name>`     | `-r`  | Generate a new router.                           |
| `--entity <name>`     | `-e`  | Generate a new entity.                           |
| `--repository <name>` | `-re` | Generate a new repository.                       |
| `--migration <name>`  | `-mi` | Generate a new migration.                        |
| `--validator <name>`  | `-va` | Generate a new validator.                        |
| `--path`              | `-p`  | specify the path where the component must be generated (by default the component will be generated at [`src/modules/<name>/<name>.<type>.ts`]. |


:point_right: __Examples__

Without specifying the location `-p`

```bash
./node_modules/.bin/medex g -m store
```

> Generate the store modules at `src/modules/store/store.module.ts`

With specifying the location `-p`

```bash
./node_modules/.bin/medex g -m store -p src/modules
```

> Generate the store modules at `src/modules/store.module.ts`

#### Command `migrate` reference

##### Usage

```bash
./node_modules/.bin/medex m [option]
```

##### Options


| Name     | Alias | Description                                  |
|----------|-------|----------------------------------------------|
| `--run`  | `-r`  | Run migrations up method.                    |
| `--show` | `-s`  | Show all applied and non applied migrations. |

## Discussions

If you are interesting in participate to any discussions you can follow that [links](https://github.com/adrien2p/medusa-extender/discussions)

[![-----------------------------------------------------](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/cloudy.png)](#like-my-work-heartbeat)

## Conclusion

This project needs a :star: from you. Don't forget to leave a star :star:.

I hope that this new tool will help you enjoying the medusa-extender in a better way and that it will please the community :heart:

You can now easily manage your migrations and generate any components with a minimal implementation.

See you soon :rocket: