docs: document module providers in plugins (#11360)
* docs: document module providers in plugins * small fixes * add missing title
This commit is contained in:
+12
-2
@@ -22,9 +22,18 @@ const authProviderOptions: FormattingOptionsType = {
|
||||
reflection_typeParameters: false,
|
||||
},
|
||||
startSections: [
|
||||
`## 1. Create Module Directory
|
||||
`## 1. Create Module Provider Directory
|
||||
|
||||
Start by creating a new directory for your module. For example, \`src/modules/my-auth\`.`,
|
||||
Start by creating a new directory for your module provider.
|
||||
|
||||
If you're creating the module provider in a Medusa application, create it under the \`src/modules\` directory. For example, \`src/modules/my-auth\`.
|
||||
If you're creating the module provider in a plugin, create it under the \`src/providers\` directory. For example, \`src/providers/my-auth\`.
|
||||
|
||||
<Note>
|
||||
|
||||
The rest of this guide always uses the \`src/modules/my-auth\` directory as an example.
|
||||
|
||||
</Note>`,
|
||||
`## 2. Create the Auth Provider Service
|
||||
|
||||
Create the file \`src/modules/my-auth/service.ts\` that holds the module's main service. It must extend the \`AbstractAuthModuleProvider\` class imported from \`@medusajs/framework/utils\`:
|
||||
@@ -78,6 +87,7 @@ module.exports = defineConfig({
|
||||
id: "emailpass",
|
||||
},
|
||||
{
|
||||
// if module provider is in a plugin, use \`plugin-name/providers/my-auth\`
|
||||
resolve: "./src/modules/my-auth",
|
||||
id: "my-auth",
|
||||
dependencies: [Modules.CACHE, ContainerRegistrationKeys.LOGGER],
|
||||
|
||||
+12
-2
@@ -22,9 +22,18 @@ const fileOptions: FormattingOptionsType = {
|
||||
reflection_typeParameters: false,
|
||||
},
|
||||
startSections: [
|
||||
`## 1. Create Module Directory
|
||||
`## Create Module Provider Directory
|
||||
|
||||
Start by creating a new directory for your module. For example, \`src/modules/my-file\`.`,
|
||||
Start by creating a new directory for your module provider.
|
||||
|
||||
If you're creating the module provider in a Medusa application, create it under the \`src/modules\` directory. For example, \`src/modules/my-file\`.
|
||||
If you're creating the module provider in a plugin, create it under the \`src/providers\` directory. For example, \`src/providers/my-file\`.
|
||||
|
||||
<Note>
|
||||
|
||||
The rest of this guide always uses the \`src/modules/my-file\` directory as an example.
|
||||
|
||||
</Note>`,
|
||||
`## 2. Create the File Provider Service
|
||||
|
||||
Create the file \`src/modules/my-file/service.ts\` that holds the implementation of the module's main service. It must extend the \`AbstractFileProviderService\` class imported from \`@medusajs/framework/utils\`:
|
||||
@@ -81,6 +90,7 @@ module.exports = defineConfig({
|
||||
id: "local",
|
||||
},
|
||||
{
|
||||
// if module provider is in a plugin, use \`plugin-name/providers/my-file\`
|
||||
resolve: "./src/modules/my-file",
|
||||
id: "my-file",
|
||||
options: {
|
||||
|
||||
+12
-2
@@ -22,9 +22,18 @@ const fulfillmentProviderOptions: FormattingOptionsType = {
|
||||
reflection_typeParameters: false,
|
||||
},
|
||||
startSections: [
|
||||
`## 1. Create Module Directory
|
||||
`## 1. Create Module Provider Directory
|
||||
|
||||
Start by creating a new directory for your module. For example, \`src/modules/my-fulfillment\`.`,
|
||||
Start by creating a new directory for your module provider.
|
||||
|
||||
If you're creating the module provider in a Medusa application, create it under the \`src/modules\` directory. For example, \`src/modules/my-fulfillment\`.
|
||||
If you're creating the module provider in a plugin, create it under the \`src/providers\` directory. For example, \`src/providers/my-fulfillment\`.
|
||||
|
||||
<Note>
|
||||
|
||||
The rest of this guide always uses the \`src/modules/my-fulfillment\` directory as an example.
|
||||
|
||||
</Note>`,
|
||||
`## 2. Create the Fulfillment Provider Service
|
||||
|
||||
Create the file \`src/modules/my-fulfillment/service.ts\` that holds the module's main service. It must extend the \`AbstractFulfillmentProviderService\` class imported from \`@medusajs/framework/utils\`:
|
||||
@@ -75,6 +84,7 @@ module.exports = defineConfig({
|
||||
id: "manual",
|
||||
},
|
||||
{
|
||||
// if module provider is in a plugin, use \`plugin-name/providers/my-fulfillment\`
|
||||
resolve: "./src/modules/my-fulfillment",
|
||||
id: "my-fulfillment",
|
||||
options: {
|
||||
|
||||
+12
-2
@@ -22,9 +22,18 @@ const notificationOptions: FormattingOptionsType = {
|
||||
reflection_typeParameters: false,
|
||||
},
|
||||
startSections: [
|
||||
`## 1. Create Module Directory
|
||||
`## 1. Create Module Provider Directory
|
||||
|
||||
Start by creating a new directory for your module. For example, \`src/modules/my-notification\`.`,
|
||||
Start by creating a new directory for your module provider.
|
||||
|
||||
If you're creating the module provider in a Medusa application, create it under the \`src/modules\` directory. For example, \`src/modules/my-notification\`.
|
||||
If you're creating the module provider in a plugin, create it under the \`src/providers\` directory. For example, \`src/providers/my-notification\`.
|
||||
|
||||
<Note>
|
||||
|
||||
The rest of this guide always uses the \`src/modules/my-notification\` directory as an example.
|
||||
|
||||
</Note>`,
|
||||
`## 2. Create the Notification Provider Service
|
||||
|
||||
Create the file \`src/modules/my-notification/service.ts\` that holds the implementation of the notification service.
|
||||
@@ -89,6 +98,7 @@ module.exports = defineConfig({
|
||||
},
|
||||
},
|
||||
{
|
||||
// if module provider is in a plugin, use \`plugin-name/providers/my-notification\`
|
||||
resolve: "./src/modules/my-notification",
|
||||
id: "my-notification",
|
||||
options: {
|
||||
|
||||
+12
-2
@@ -22,9 +22,18 @@ const paymentProviderOptions: FormattingOptionsType = {
|
||||
reflection_typeParameters: false,
|
||||
},
|
||||
startSections: [
|
||||
`## 1. Create Module Directory
|
||||
`## 1. Create Module Provider Directory
|
||||
|
||||
Start by creating a new directory for your module. For example, \`src/modules/my-payment\`.`,
|
||||
Start by creating a new directory for your module provider.
|
||||
|
||||
If you're creating the module provider in a Medusa application, create it under the \`src/modules\` directory. For example, \`src/modules/my-payment\`.
|
||||
If you're creating the module provider in a plugin, create it under the \`src/providers\` directory. For example, \`src/providers/my-payment\`.
|
||||
|
||||
<Note>
|
||||
|
||||
The rest of this guide always uses the \`src/modules/my-payment\` directory as an example.
|
||||
|
||||
</Note>`,
|
||||
`## 2. Create the Payment Provider Service
|
||||
|
||||
Create the file \`src/modules/my-payment/service.ts\` that holds the module's main service. It must extend the \`AbstractPaymentProvider\` class imported from \`@medusajs/framework/utils\`:
|
||||
@@ -76,6 +85,7 @@ module.exports = defineConfig({
|
||||
options: {
|
||||
providers: [
|
||||
{
|
||||
// if module provider is in a plugin, use \`plugin-name/providers/my-payment\`
|
||||
resolve: "./src/modules/my-payment",
|
||||
id: "my-payment",
|
||||
options: {
|
||||
|
||||
Reference in New Issue
Block a user