chore: fixes to tsdocs + docs-util related to providers

This commit is contained in:
Shahed Nasser
2024-12-11 17:27:32 +02:00
parent dc5e73af4d
commit c3b2b4b438
15 changed files with 444 additions and 451 deletions
@@ -1,9 +1,10 @@
import { FormattingOptionsType } from "types"
import baseSectionsOptions from "../base-section-options.js"
const authProviderOptions: FormattingOptionsType = {
"^auth_provider/.*AbstractAuthModuleProvider": {
reflectionGroups: {
Properties: false,
Constructors: false,
},
reflectionDescription: `In this document, youll learn how to create an auth provider module and the methods you must implement in its main service.`,
frontmatterData: {
@@ -14,6 +15,12 @@ const authProviderOptions: FormattingOptionsType = {
},
shouldIncrementAfterStartSections: true,
expandMembers: true,
expandProperties: true,
sections: {
...baseSectionsOptions,
member_declaration_title: false,
reflection_typeParameters: false,
},
startSections: [
`## 1. Create Module Directory
@@ -55,10 +62,6 @@ This exports the module's definition, indicating that the \`MyAuthProviderServic
To use your Auth Module Provider, add it to the \`providers\` array of the Auth Module in \`medusa-config.ts\`:
\`\`\`ts title="medusa-config.ts"
import { Modules } from "@medusajs/framework/utils"
// ...
module.exports = defineConfig({
// ...
modules: [
@@ -66,6 +69,11 @@ module.exports = defineConfig({
resolve: "@medusajs/medusa/auth",
options: {
providers: [
// default provider
{
resolve: "@medusajs/medusa/auth-emailpass",
id: "emailpass",
},
{
resolve: "./src/modules/my-auth",
id: "my-auth",
@@ -1,9 +1,10 @@
import { FormattingOptionsType } from "types"
import baseSectionsOptions from "../base-section-options.js"
const fileOptions: FormattingOptionsType = {
"^file/.*AbstractFileProviderService": {
reflectionGroups: {
Properties: false,
Constructors: false,
},
reflectionDescription: `In this document, youll learn how to create a file provider module and the methods you must implement in its main service.`,
frontmatterData: {
@@ -14,6 +15,12 @@ const fileOptions: FormattingOptionsType = {
},
shouldIncrementAfterStartSections: true,
expandMembers: true,
expandProperties: true,
sections: {
...baseSectionsOptions,
member_declaration_title: false,
reflection_typeParameters: false,
},
startSections: [
`## 1. Create Module Directory
@@ -61,10 +68,6 @@ The File Module accepts one provider only.
</Note>
\`\`\`ts title="medusa-config.ts"
import { Modules } from "@medusajs/framework/utils"
// ...
module.exports = defineConfig({
// ...
modules: [
@@ -72,6 +75,11 @@ module.exports = defineConfig({
resolve: "@medusajs/medusa/file",
options: {
providers: [
// default provider
{
resolve: "@medusajs/medusa/file-local",
id: "local",
},
{
resolve: "./src/modules/my-file",
id: "my-file",
@@ -1,9 +1,10 @@
import { FormattingOptionsType } from "types"
import baseSectionsOptions from "../base-section-options.js"
const fulfillmentProviderOptions: FormattingOptionsType = {
"^fulfillment_provider/.*AbstractFulfillmentProviderService": {
reflectionGroups: {
Properties: false,
Constructors: false,
},
reflectionDescription: `In this document, youll learn how to create a fulfillment provider module and the methods you must implement in its main service.`,
frontmatterData: {
@@ -14,6 +15,12 @@ const fulfillmentProviderOptions: FormattingOptionsType = {
},
shouldIncrementAfterStartSections: true,
expandMembers: true,
expandProperties: true,
sections: {
...baseSectionsOptions,
member_declaration_title: false,
reflection_typeParameters: false,
},
startSections: [
`## 1. Create Module Directory
@@ -55,10 +62,6 @@ This exports the module's definition, indicating that the \`MyFulfillmentProvide
To use your Fulfillment Module Provider, add it to the \`providers\` array of the Fulfillment Module in \`medusa-config.ts\`:
\`\`\`ts title="medusa-config.ts"
import { Modules } from "@medusajs/framework/utils"
// ...
module.exports = defineConfig({
// ...
modules: [
@@ -66,6 +69,11 @@ module.exports = defineConfig({
resolve: "@medusajs/medusa/fulfillment",
options: {
providers: [
// default provider
{
resolve: "@medusajs/medusa/fulfillment-manual",
id: "manual",
},
{
resolve: "./src/modules/my-fulfillment",
id: "my-fulfillment",
@@ -1,9 +1,10 @@
import { FormattingOptionsType } from "types"
import baseSectionsOptions from "../base-section-options.js"
const notificationOptions: FormattingOptionsType = {
"^notification/.*AbstractNotificationProviderService": {
reflectionGroups: {
Properties: false,
Constructors: false,
},
reflectionDescription: `In this document, youll learn how to create a notification provider module and the methods you must implement in it.`,
frontmatterData: {
@@ -14,6 +15,12 @@ const notificationOptions: FormattingOptionsType = {
},
shouldIncrementAfterStartSections: true,
expandMembers: true,
expandProperties: true,
sections: {
...baseSectionsOptions,
member_declaration_title: false,
reflection_typeParameters: false,
},
startSections: [
`## 1. Create Module Directory
@@ -65,10 +72,6 @@ The Notification Module accepts one provider per channel.
</Note>
\`\`\`ts title="medusa-config.ts"
import { Modules } from "@medusajs/framework/utils"
// ...
module.exports = defineConfig({
// ...
modules: [
@@ -76,6 +79,15 @@ module.exports = defineConfig({
resolve: "@medusajs/medusa/notification",
options: {
providers: [
// default provider
{
resolve: "@medusajs/medusa/notification-local",
id: "local",
options: {
name: "Local Notification Provider",
channels: ["feed"],
},
},
{
resolve: "./src/modules/my-notification",
id: "my-notification",
@@ -1,4 +1,5 @@
import { FormattingOptionsType } from "types"
import baseSectionsOptions from "../base-section-options.js"
const paymentProviderOptions: FormattingOptionsType = {
"^payment_provider": {
@@ -13,10 +14,16 @@ const paymentProviderOptions: FormattingOptionsType = {
fullReplacement: "How to Create a Payment Provider",
},
reflectionGroups: {
Properties: false,
Constructors: false,
},
shouldIncrementAfterStartSections: true,
expandMembers: true,
expandProperties: true,
sections: {
...baseSectionsOptions,
member_declaration_title: false,
reflection_typeParameters: false,
},
startSections: [
`## 1. Create Module Directory
@@ -64,10 +71,6 @@ This exports the module's definition, indicating that the \`MyPaymentProviderSer
To use your Payment Module Provider, add it to the \`providers\` array of the Payment Module in \`medusa-config.ts\`:
\`\`\`ts title="medusa-config.ts"
import { Modules } from "@medusajs/framework/utils"
// ...
module.exports = defineConfig({
// ...
modules: [