DEV Community

Cover image for Medusa-extender CLI
Adrien de Peretti
Adrien de Peretti

Posted on

Medusa-extender CLI

Medusa 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 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.

-----------------------------------------------------

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
./node_modules/.bin/medex g [option]
Enter fullscreen mode Exit fullscreen mode
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].

👉 Examples

Without specifying the location -p

./node_modules/.bin/medex g -m store
Enter fullscreen mode Exit fullscreen mode

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

With specifying the location -p

./node_modules/.bin/medex g -m store -p src/modules
Enter fullscreen mode Exit fullscreen mode

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

Command migrate reference

Usage
./node_modules/.bin/medex m [option]
Enter fullscreen mode Exit fullscreen mode
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

-----------------------------------------------------

Conclusion

This project needs a ⭐ from you. Don't forget to leave a 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 ❤️

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

See you soon 🚀

Top comments (0)