docs: added dividers + see also section (#2899)

This commit is contained in:
Shahed Nasser
2022-12-26 15:52:08 +02:00
committed by GitHub
parent b0e5769e27
commit b0ebfd6bcf
100 changed files with 1047 additions and 291 deletions

View File

@@ -16,6 +16,8 @@ If you run into any errors while installing the CLI tool, check out the [trouble
:::
---
## Initialize Project
The recommended way to create a plugin is using the Medusa CLI. Run the following command to create a new Medusa project:
@@ -28,6 +30,8 @@ Where `medusa-plugin-custom` is the name of the plugin youre creating. In Med
By convention, all plugin names start with `medusa` followed by a descriptive name of what the plugin does. For example, the Stripe plugin is named `medusa-payment-stripe`.
---
## Changes to package.json
### Rename Project Name
@@ -145,6 +149,8 @@ npm install --save-dev cross-env
- `repository`: The repository that holds your plugins codebase.
- `keywords`: This should hold the keywords that are related to your plugin. Its recommended that all plugins use the keywords `medusa-plugin` or `medusa`.
---
## Develop your Plugin
Now, You can start developing your plugin. This can include adding services, endpoints, entities, or anything that's relevant to your plugin.
@@ -196,6 +202,8 @@ This guide doesn't cover how to create different files and components. If you
- How to [create an entity](./../entities/index.md)
- How to [create a migration](../migrations/index.md)
---
## Add Plugin Configuration
Plugins often allow developers that will later use them to enter their own configuration. For example, you can allow developers to specify the API key of a service youre integrating.
@@ -248,6 +256,8 @@ Make sure to include in the README of your plugin the configurations that can be
:::
---
## Test Your Plugin
While you develop your plugin, youll need to test it on an actual Medusa server. This can be done by using the [npm link](https://docs.npmjs.com/cli/v8/commands/npm-link) command.
@@ -354,6 +364,8 @@ It is safe to ignore any `cross-env: command not found` error you may receive.
:::
---
## NPM Ignore File
Not all files that you use while developing your plugin are necessary to be published.
@@ -387,6 +399,8 @@ medusa-db.sql
develop.sh
```
---
## Publish Plugin
Once youre done developing your plugin you can publish the package on NPMs registry so that other developers can benefit from it and use it.
@@ -439,6 +453,8 @@ Then, publish the new update:
npm publish
```
---
## Add Plugin to Medusas Repository
All officially-supported plugins are available in the [`packages` directory of the Medusa GitHub repository](https://github.com/medusajs/medusa/tree/master/packages).
@@ -451,6 +467,8 @@ Before contributing to the Medusa repository, please check out the [contribution
:::
---
## Install a Plugin
To install any published plugin, you can run the following command on any Medusa server project:
@@ -459,8 +477,10 @@ To install any published plugin, you can run the following command on any Medusa
npm install medusa-plugin-custom
```
## Whats Next
---
- Check out [available Services in Medusa](references/services/../../../../../references/services/classes/AuthService.md) that you can use in your plugin.
- Check out [available events](../subscribers/events-list.md) that you can listen to in Subscribers.
- Check out [available official plugins](https://github.com/medusajs/medusa/tree/master/packages).
## See Also
- [Available official plugins](https://github.com/medusajs/medusa/tree/master/packages)
- [Services reference](references/services/../../../../../references/services/classes/AuthService.md)
- [Events reference](../subscribers/events-list.md)