From b6df24463d19fac05ddee4d6f0505e0b1bad5e5d Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Mon, 14 Oct 2024 13:40:30 +0300 Subject: [PATCH] docs: updates for breaking changes (#9558) - Update modules registration - Update `medusa-config.js` to `medusa-config.ts` - Update the out directory in the admin deployment guide - Update logger imports - Other fixes Note: will need to re-generate references afterwards Closes #9548 --- .../api-routes/cors/page.mdx | 6 +-- .../modules/container/page.mdx | 8 ++-- .../modules/multiple-services/page.mdx | 2 +- .../modules/options/page.mdx | 10 ++--- www/apps/book/app/basics/modules/page.mdx | 24 ++++------- .../basics/project-directories-files/page.mdx | 2 +- .../custom-features/module/page.mdx | 12 +++--- .../integrate-systems/service/page.mdx | 12 +++--- .../instrumentation/page.mdx | 13 +++--- .../debugging-and-testing/logging/page.mdx | 16 ++++---- .../cache/create/page.mdx | 12 +++--- .../cache/in-memory/page.mdx | 15 ++++--- .../cache/redis/page.mdx | 14 +++---- .../event/create/page.mdx | 12 +++--- .../event/local/page.mdx | 14 ++++--- .../event/redis/page.mdx | 16 ++++---- .../architectural-modules/file/local/page.mdx | 14 +++---- .../architectural-modules/file/s3/page.mdx | 26 ++++++------ .../notification/local/page.mdx | 14 +++---- .../notification/page.mdx | 14 +++---- .../notification/sendgrid/page.mdx | 14 +++---- .../workflow-engine/in-memory/page.mdx | 14 ++++--- .../workflow-engine/redis/page.mdx | 12 +++--- .../auth/auth-providers/emailpass/page.mdx | 4 +- .../auth/auth-providers/github/page.mdx | 4 +- .../auth/auth-providers/google/page.mdx | 4 +- .../auth/auth-providers/page.mdx | 2 +- .../auth/module-options/page.mdx | 30 +++++++------- .../app/commerce-modules/cart/extend/page.mdx | 2 +- .../commerce-modules/customer/extend/page.mdx | 2 +- .../fulfillment/module-options/page.mdx | 14 +++---- .../payment/module-options/page.mdx | 14 +++---- .../payment/payment-provider/stripe/page.mdx | 14 +++---- .../tax/module-options/page.mdx | 12 +++--- .../user/module-options/page.mdx | 12 +++--- .../app/deployment/admin/vercel/page.mdx | 6 +-- .../medusa-application/railway/page.mdx | 41 +++++++++---------- .../app/medusa-container-resources/page.mdx | 8 ++-- .../app/recipes/commerce-automation/page.mdx | 13 +++--- .../examples/standard/page.mdx | 40 +++++++++--------- .../integrate-ecommerce-stack/page.mdx | 10 ++--- .../examples/restaurant-delivery/page.mdx | 21 +++++----- .../marketplace/examples/vendors/page.mdx | 10 ++--- .../subscriptions/examples/standard/page.mdx | 10 ++--- .../app/storefront-development/tips/page.mdx | 4 +- .../_sections/other/cors-errors.mdx | 4 +- .../medusa-admin/no-widget-route/page.mdx | 4 +- .../merger-custom-options/auth-provider.ts | 12 +++--- .../constants/merger-custom-options/file.ts | 12 +++--- .../fulfillment-provider.ts | 12 +++--- .../merger-custom-options/medusa-config.ts | 2 +- .../merger-custom-options/notification.ts | 12 +++--- .../merger-custom-options/payment-provider.ts | 12 +++--- 53 files changed, 319 insertions(+), 324 deletions(-) diff --git a/www/apps/book/app/advanced-development/api-routes/cors/page.mdx b/www/apps/book/app/advanced-development/api-routes/cors/page.mdx index 02e359dce3d37..98f935959a0bb 100644 --- a/www/apps/book/app/advanced-development/api-routes/cors/page.mdx +++ b/www/apps/book/app/advanced-development/api-routes/cors/page.mdx @@ -20,7 +20,7 @@ These configurations accept a URL pattern to identify allowed origins. For example: -```js title="medusa-config.js" +```js title="medusa-config.ts" module.exports = defineConfig({ projectConfig: { http: { @@ -78,7 +78,7 @@ You can do that in the exported middlewares configurations in `src/api/middlewar For example: -export const highlights = [["25", "parseCorsOrigins", "A utility function that parses the CORS configurations in `medusa-config.js`"]] +export const highlights = [["25", "parseCorsOrigins", "A utility function that parses the CORS configurations in `medusa-config.ts`"]] ```ts title="src/api/middlewares.ts" highlights={highlights} collapsibleLines="1-10" expandButtonLabel="Show Imports" import { defineMiddlewares } from "@medusajs/medusa" @@ -117,4 +117,4 @@ export default defineMiddlewares({ }) ``` -This retrieves the configurations exported from `medusa-config.js` and applies the `storeCors` to routes starting with `/custom`. +This retrieves the configurations exported from `medusa-config.ts` and applies the `storeCors` to routes starting with `/custom`. diff --git a/www/apps/book/app/advanced-development/modules/container/page.mdx b/www/apps/book/app/advanced-development/modules/container/page.mdx index e87f30f38501a..e4a11530bc5ba 100644 --- a/www/apps/book/app/advanced-development/modules/container/page.mdx +++ b/www/apps/book/app/advanced-development/modules/container/page.mdx @@ -27,7 +27,7 @@ A service's constructor accepts as a first parameter an object used to resolve r For example: ```ts highlights={[["4"], ["10"]]} -import { Logger } from "@medusajs/medusa" +import { Logger } from "@medusajs/framework/types" type InjectedDependencies = { logger: Logger @@ -56,12 +56,14 @@ For example: import { LoaderOptions, } from "@medusajs/framework/modules-sdk" -import { Logger } from "@medusajs/medusa" +import { + ContainerRegistrationKeys +} from "@medusajs/framework/utils" export default async function helloWorldLoader({ container, }: LoaderOptions) { - const logger: Logger = container.resolve("logger") + const logger = container.resolve(ContainerRegistrationKeys.LOGGER) logger.info("[helloWorldLoader]: Hello, World!") } diff --git a/www/apps/book/app/advanced-development/modules/multiple-services/page.mdx b/www/apps/book/app/advanced-development/modules/multiple-services/page.mdx index ed4cf770f09b8..23d1dc5701f59 100644 --- a/www/apps/book/app/advanced-development/modules/multiple-services/page.mdx +++ b/www/apps/book/app/advanced-development/modules/multiple-services/page.mdx @@ -100,7 +100,7 @@ export class ClientService { Your internal service can't access the module's options. -To retrieve the module's options, use the `configModule` registered in the module's container, which is the configurations in `medusa-config.js`. +To retrieve the module's options, use the `configModule` registered in the module's container, which is the configurations in `medusa-config.ts`. For example: diff --git a/www/apps/book/app/advanced-development/modules/options/page.mdx b/www/apps/book/app/advanced-development/modules/options/page.mdx index 85131ff9b089a..78289eb80dbc1 100644 --- a/www/apps/book/app/advanced-development/modules/options/page.mdx +++ b/www/apps/book/app/advanced-development/modules/options/page.mdx @@ -16,21 +16,21 @@ For example, if you’re creating a module that integrates a third-party service ## How to Pass Options to a Module? -To pass options to a module, add an `options` property to the module’s configuration in `medusa-config.js`. +To pass options to a module, add an `options` property to the module’s configuration in `medusa-config.ts`. For example: -```js title="medusa-config.js" +```js title="medusa-config.ts" module.exports = defineConfig({ // ... - modules: { - helloModuleService: { + modules: [ + { resolve: "./modules/hello", options: { capitalize: true, }, }, - }, + ] }) ``` diff --git a/www/apps/book/app/basics/modules/page.mdx b/www/apps/book/app/basics/modules/page.mdx index 6cfaafe458283..2dca6f60a1b50 100644 --- a/www/apps/book/app/basics/modules/page.mdx +++ b/www/apps/book/app/basics/modules/page.mdx @@ -118,37 +118,29 @@ export default Module(HELLO_MODULE, { You use the `Module` function imported from `@medusajs/framework/utils` to create the module's definition. It accepts two parameters: -1. The module's name. +1. The name that the module's main service is registered under (`helloModuleService`). 2. An object with a required property `service` indicating the module's main service. ### 4. Add Module to Configurations The last step is to add the module in Medusa’s configurations. -In `medusa-config.js`, add a `modules` property and pass to it your custom module: +In `medusa-config.ts`, add a `modules` property and pass in it your custom module: -```js title="medusa-config.js" highlights={[["6", "helloModuleService", "The key of the main service to be registered in the Medusa container."]]} +```ts title="medusa-config.ts" highlights={[["6", "helloModuleService", "The key of the main service to be registered in the Medusa container."]]} module.exports = defineConfig({ projectConfig: { // ... }, - modules: { - helloModuleService: { + modules: [ + { resolve: "./modules/hello", - }, - }, + } + ] }) ``` -The key `helloModuleService` is the name of the module’s main service. It will be registered in the Medusa container with that name. - - - -The key must be the same value passed as the first parameter to the `Module` function in the module's definition. - - - -Its value is an object having the `resolve` property, whose value is either a path to module's directory relative to `src` (it shouldn't include `src` in the path), or an `npm` package’s name. +Its value is an array of objects, each having a `resolve` property, whose value is either a path to module's directory relative to `src` (it shouldn't include `src` in the path), or an `npm` package’s name. ### 5. Generate Migrations diff --git a/www/apps/book/app/basics/project-directories-files/page.mdx b/www/apps/book/app/basics/project-directories-files/page.mdx index d5d930c4c90de..10fb80714b42d 100644 --- a/www/apps/book/app/basics/project-directories-files/page.mdx +++ b/www/apps/book/app/basics/project-directories-files/page.mdx @@ -18,6 +18,6 @@ This directory is the central place for your custom development. It includes the - `subscribers`: Holds your event listeners that are executed asynchronously whenever an event is emitted. - `workflows`: Holds your custom flows that can be executed from anywhere in your application. -## medusa-config.js +## medusa-config.ts This file holds your Medusa configurations, such as your PostgreSQL database configurations. diff --git a/www/apps/book/app/customization/custom-features/module/page.mdx b/www/apps/book/app/customization/custom-features/module/page.mdx index 2b22ef4e55d72..ae3927d7642e5 100644 --- a/www/apps/book/app/customization/custom-features/module/page.mdx +++ b/www/apps/book/app/customization/custom-features/module/page.mdx @@ -97,16 +97,16 @@ Learn more about modules and services [in this guide](../../../basics/modules/pa ## 5. Register Module in Config -Finally, add the module to Medusa's configurations in `medusa-config.js`: +Finally, add the module to Medusa's configurations in `medusa-config.ts`: -```js title="medusa-config.js" +```ts title="medusa-config.ts" module.exports = defineConfig({ // ... - modules: { - brandModuleService: { + modules: [ + { resolve: "./modules/brand", - }, - }, + } + ] }) ``` diff --git a/www/apps/book/app/customization/integrate-systems/service/page.mdx b/www/apps/book/app/customization/integrate-systems/service/page.mdx index 260d5d5224933..0cbb8a587725d 100644 --- a/www/apps/book/app/customization/integrate-systems/service/page.mdx +++ b/www/apps/book/app/customization/integrate-systems/service/page.mdx @@ -61,7 +61,7 @@ export class BrandClient { This creates a `BrandClient` service. Using dependency injection, you resolve the `logger` and `configModule` from the Module's container. -`logger` is useful to log messages, and `configModule` has configurations exported in `medusa-config.js`. +`logger` is useful to log messages, and `configModule` has configurations exported in `medusa-config.ts`. You also define an `options_` property in your service to store the module's options. @@ -180,19 +180,19 @@ In the main module service, you first resolve through dependency injection the ` ## 4. Pass Options to the Module -To pass options in the module, change its configurations in `medusa-config.js`: +To pass options in the module, change its configurations in `medusa-config.ts`: -```js title="medusa-config.js" +```ts title="medusa-config.ts" module.exports = defineConfig({ // ... - modules: { - brandModuleService: { + modules: [ + { resolve: "./modules/brand", options: { apiKey: process.env.BRAND_API_KEY || "temp", }, }, - }, + ] }) ``` diff --git a/www/apps/book/app/debugging-and-testing/instrumentation/page.mdx b/www/apps/book/app/debugging-and-testing/instrumentation/page.mdx index d34c03140d84c..e853f0fcd4632 100644 --- a/www/apps/book/app/debugging-and-testing/instrumentation/page.mdx +++ b/www/apps/book/app/debugging-and-testing/instrumentation/page.mdx @@ -44,14 +44,13 @@ Also, install the dependencies relevant for the exporter you use. If you're usin npm install @opentelemetry/exporter-zipkin ``` -### Add instrumentation.js +### Add instrumentation.ts -Next, create the file `instrumentation.js` with the following content: +Next, create the file `instrumentation.ts` with the following content: -```js title="instrumentation.js" -const { registerOtel } = require("@medusajs/medusa") -// If using an exporter other than Zipkin, require it here. -const { ZipkinExporter } = require("@opentelemetry/exporter-zipkin") +```ts title="instrumentation.ts" +import { registerOtel } from "@medusajs/medusa" +import { ZipkinExporter } from "@opentelemetry/exporter-zipkin" // If using an exporter other than Zipkin, initialize it here. const exporter = new ZipkinExporter({ @@ -72,7 +71,7 @@ export function register() { } ``` -In the `instrumentation.js` file, you export a `register` function that uses Medusa's `registerOtel` utility function. +In the `instrumentation.ts` file, you export a `register` function that uses Medusa's `registerOtel` utility function. You also initialize an instance of the exporter, such as Zipkin, and pass it to the `registerOtel` function. diff --git a/www/apps/book/app/debugging-and-testing/logging/page.mdx b/www/apps/book/app/debugging-and-testing/logging/page.mdx index 7cc54c5d9af40..e76963d57becb 100644 --- a/www/apps/book/app/debugging-and-testing/logging/page.mdx +++ b/www/apps/book/app/debugging-and-testing/logging/page.mdx @@ -26,13 +26,13 @@ export const highlights = [ ] ```ts title="src/jobs/log-message.ts" highlights={highlights} -import { Logger } from "@medusajs/medusa" import { MedusaContainer } from "@medusajs/framework/types" +import { ContainerRegistrationKeys } from "@medusajs/framework/utils" export default async function myCustomJob( container: MedusaContainer ) { - const logger: Logger = container.resolve("logger") + const logger = container.resolve(ContainerRegistrationKeys.LOGGER) logger.info("I'm using the logger!") } @@ -129,11 +129,14 @@ The `Logger` class has an `activity` method used to log a message of level `info For example: -```ts title="src/loaders/log-message.ts" -import { Logger, MedusaContainer } from "@medusajs/medusa" +```ts title="src/jobs/log-message.ts" +import { MedusaContainer } from "@medusajs/framework/types" +import { ContainerRegistrationKeys } from "@medusajs/framework/utils" -export default async (container: MedusaContainer) => { - const logger = container.resolve("logger") +export default async function myCustomJob( + container: MedusaContainer +) { + const logger = container.resolve(ContainerRegistrationKeys.LOGGER) const activityId = logger.activity("First log message") @@ -141,7 +144,6 @@ export default async (container: MedusaContainer) => { logger.success(activityId, "Last log message") } - ``` The `activity` method returns the ID of the started activity. This ID can then be passed to one of the following methods of the `Logger` class: diff --git a/www/apps/resources/app/architectural-modules/cache/create/page.mdx b/www/apps/resources/app/architectural-modules/cache/create/page.mdx index 4c9d1e83c4afe..73bb0d10d3be1 100644 --- a/www/apps/resources/app/architectural-modules/cache/create/page.mdx +++ b/www/apps/resources/app/architectural-modules/cache/create/page.mdx @@ -148,25 +148,25 @@ This exports the module's definition, indicating that the `MyCacheService` is th ## 4. Use Module -To use your Cache Module, add it to the `modules` object exported as part of the configurations in `medusa-config.js`. A Cache Module is added under the `cacheService` key. +To use your Cache Module, add it to the `modules` object exported as part of the configurations in `medusa-config.ts`. A Cache Module is added under the `cacheService` key. For example: -```js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +```ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... module.exports = defineConfig({ // ... - modules: { - [Modules.CACHE]: { + modules: [ + { resolve: "./modules/my-cache", options: { // any options ttl: 30, }, }, - }, + ] }) ``` diff --git a/www/apps/resources/app/architectural-modules/cache/in-memory/page.mdx b/www/apps/resources/app/architectural-modules/cache/in-memory/page.mdx index d6a11dcd3367c..47ff9e87dada2 100644 --- a/www/apps/resources/app/architectural-modules/cache/in-memory/page.mdx +++ b/www/apps/resources/app/architectural-modules/cache/in-memory/page.mdx @@ -22,23 +22,22 @@ The In-Memory Cache Module is registered by default in your application. -Add the module into the `modules` property of the exported object in `medusa-config.js`: - -```js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +Add the module into the `modules` property of the exported object in `medusa-config.ts`: +```ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... module.exports = defineConfig({ // ... - modules: { - [Modules.CACHE]: { - resolve: "@medusajs/medusa/cache-inmemory", + modules: [ + { + resolve: "@medusajs/cache-inmemory", options: { // optional options }, }, - }, + ] }) ``` diff --git a/www/apps/resources/app/architectural-modules/cache/redis/page.mdx b/www/apps/resources/app/architectural-modules/cache/redis/page.mdx index fb7dc2adc9d4d..d82de35781723 100644 --- a/www/apps/resources/app/architectural-modules/cache/redis/page.mdx +++ b/www/apps/resources/app/architectural-modules/cache/redis/page.mdx @@ -19,27 +19,27 @@ The Redis Cache Module uses Redis to cache data in your store. In production, it } ]} /> -Add the module into the `modules` property of the exported object in `medusa-config.js`: +Add the module into the `modules` property of the exported object in `medusa-config.ts`: export const highlights = [ ["11", "redisUrl", "The Redis connection URL."] ] -```js title="medusa-config.js" highlights={highlights} -const { Modules } = require("@medusajs/framework/utils") +```ts title="medusa-config.ts" highlights={highlights} +import { Modules } from "@medusajs/framework/utils" // ... module.exports = defineConfig({ // ... - modules: { - [Modules.CACHE]: { - resolve: "@medusajs/medusa/cache-redis", + modules: [ + { + resolve: "@medusajs/cache-redis", options: { redisUrl: process.env.CACHE_REDIS_URL, }, }, - }, + ] }) ``` diff --git a/www/apps/resources/app/architectural-modules/event/create/page.mdx b/www/apps/resources/app/architectural-modules/event/create/page.mdx index 474a8a0310c68..c34b9e1e83e37 100644 --- a/www/apps/resources/app/architectural-modules/event/create/page.mdx +++ b/www/apps/resources/app/architectural-modules/event/create/page.mdx @@ -103,24 +103,24 @@ This exports the module's definition, indicating that the `MyEventService` is th ## 4. Use Module -To use your Event Module, add it to the `modules` object exported as part of the configurations in `medusa-config.js`. An Event Module is added under the `eventBus` key. +To use your Event Module, add it to the `modules` object exported as part of the configurations in `medusa-config.ts`. An Event Module is added under the `eventBus` key. For example: -```js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +```ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... module.exports = defineConfig({ // ... - modules: { - [Modules.EVENT_BUS]: { + modules: [ + { resolve: "./modules/my-event", options: { // any options }, }, - }, + ] }) ``` diff --git a/www/apps/resources/app/architectural-modules/event/local/page.mdx b/www/apps/resources/app/architectural-modules/event/local/page.mdx index 5666d240ab483..9cf554a96a14a 100644 --- a/www/apps/resources/app/architectural-modules/event/local/page.mdx +++ b/www/apps/resources/app/architectural-modules/event/local/page.mdx @@ -20,18 +20,20 @@ The Local Event Bus Module is registered by default in your application. -Add the module into the `modules` property of the exported object in `medusa-config.js`: +Add the module into the `modules` property of the exported object in `medusa-config.ts`: -```js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +```ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... module.exports = defineConfig({ // ... - modules: { - [Modules.EVENT_BUS]: true, - }, + modules: [ + { + resolve: "@medusajs/event-bus-local" + } + ] }) ``` diff --git a/www/apps/resources/app/architectural-modules/event/redis/page.mdx b/www/apps/resources/app/architectural-modules/event/redis/page.mdx index 98f42af3ce5f2..45feabb361ab1 100644 --- a/www/apps/resources/app/architectural-modules/event/redis/page.mdx +++ b/www/apps/resources/app/architectural-modules/event/redis/page.mdx @@ -23,27 +23,27 @@ In production, it's recommended to use this module. } ]} /> -Add the module into the `modules` property of the exported object in `medusa-config.js`: +Add the module into the `modules` property of the exported object in `medusa-config.ts`: export const highlights = [ ["11", "redisUrl", "The Redis connection URL."] ] -```js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +```ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... module.exports = defineConfig({ // ... - modules: { - [Modules.EVENT_BUS]: { - resolve: "@medusajs/medusa/event-bus-redis", + modules: [ + { + resolve: "@medusajs/event-bus-redis", options: { redisUrl: process.env.EVENTS_REDIS_URL, }, - }, - }, + } + ] }) ``` diff --git a/www/apps/resources/app/architectural-modules/file/local/page.mdx b/www/apps/resources/app/architectural-modules/file/local/page.mdx index fddb55762276d..33d4a9e25c574 100644 --- a/www/apps/resources/app/architectural-modules/file/local/page.mdx +++ b/www/apps/resources/app/architectural-modules/file/local/page.mdx @@ -32,20 +32,20 @@ The File Module accepts one provider only. -```js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +```ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... module.exports = { // ... - modules: { - [Modules.FILE]: { - resolve: "@medusajs/medusa/file", + modules: [ + { + resolve: "@medusajs/file", options: { providers: [ { - resolve: "@medusajs/medusa/file-local-next", + resolve: "@medusajs/file-local-next", id: "local", options: { // provider options... @@ -54,7 +54,7 @@ module.exports = { ], }, }, - }, + ] } ``` diff --git a/www/apps/resources/app/architectural-modules/file/s3/page.mdx b/www/apps/resources/app/architectural-modules/file/s3/page.mdx index 359c0a145e1d1..c0b51c6c9ff1a 100644 --- a/www/apps/resources/app/architectural-modules/file/s3/page.mdx +++ b/www/apps/resources/app/architectural-modules/file/s3/page.mdx @@ -112,21 +112,21 @@ The File Module accepts one provider only. -```js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +```ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... module.exports = { // ... - modules: { + modules: [ // ... - [Modules.FILE]: { - resolve: "@medusajs/medusa/file", + { + resolve: "@medusajs/file", options: { providers: [ { - resolve: "@medusajs/medusa/file-s3", + resolve: "@medusajs/file-s3", id: "s3", options: { file_url: process.env.S3_FILE_URL, @@ -141,7 +141,7 @@ module.exports = { ], }, }, - }, + ] } ``` @@ -349,16 +349,16 @@ If you're using MinIO or Supabase, set `forcePathStyle` to `true` in the `additi For example: -```js title="medusa-config.js" +```ts title="medusa-config.ts" module.exports = defineConfig({ // ... - modules: { - [Modules.FILE]: { - resolve: "@medusajs/medusa/file", + modules: [ + { + resolve: "@medusajs/file", options: { providers: [ { - resolve: "@medusajs/medusa/file-s3", + resolve: "@medusajs/file-s3", id: "s3", options: { // ... @@ -370,7 +370,7 @@ module.exports = defineConfig({ ], }, }, - }, + ] }) ``` --- diff --git a/www/apps/resources/app/architectural-modules/notification/local/page.mdx b/www/apps/resources/app/architectural-modules/notification/local/page.mdx index 33d3a51efae3f..36029c62506d1 100644 --- a/www/apps/resources/app/architectural-modules/notification/local/page.mdx +++ b/www/apps/resources/app/architectural-modules/notification/local/page.mdx @@ -26,21 +26,21 @@ Only one provider can be defined for a channel. -```js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +```ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... module.exports = defineConfig({ // ... - modules: { - [Modules.NOTIFICATION]: { - resolve: "@medusajs/medusa/notification", + modules: [ + { + resolve: "@medusajs/notification", options: { providers: [ // ... { - resolve: "@medusajs/medusa/notification-local", + resolve: "@medusajs/notification-local", id: "local", options: { channels: ["email"], @@ -49,7 +49,7 @@ module.exports = defineConfig({ ], }, }, - }, + ] }) ``` diff --git a/www/apps/resources/app/architectural-modules/notification/page.mdx b/www/apps/resources/app/architectural-modules/notification/page.mdx index 2f1436ed6b02d..d3e84cce836bc 100644 --- a/www/apps/resources/app/architectural-modules/notification/page.mdx +++ b/www/apps/resources/app/architectural-modules/notification/page.mdx @@ -30,22 +30,22 @@ When you send a notification, you specify the channel to send it through, such a For example: -```js title="medusa-config.js" highlights={[["19"]]} -const { Modules } = require("@medusajs/framework/utils") +```ts title="medusa-config.ts" highlights={[["19"]]} +import { Modules } from "@medusajs/framework/utils" // ... module.exports = { // ... - modules: { + modules: [ // ... - [Modules.NOTIFICATION]: { - resolve: "@medusajs/medusa/notification", + { + resolve: "@medusajs/notification", options: { providers: [ // ... { - resolve: "@medusajs/medusa/notification-local", + resolve: "@medusajs/notification-local", id: "notification", options: { channels: ["email"], @@ -54,7 +54,7 @@ module.exports = { ], }, }, - }, + ] } ``` diff --git a/www/apps/resources/app/architectural-modules/notification/sendgrid/page.mdx b/www/apps/resources/app/architectural-modules/notification/sendgrid/page.mdx index 47b80bb94683b..e668d218be795 100644 --- a/www/apps/resources/app/architectural-modules/notification/sendgrid/page.mdx +++ b/www/apps/resources/app/architectural-modules/notification/sendgrid/page.mdx @@ -37,21 +37,21 @@ Only one provider can be defined for a channel. -```js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +```ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... module.exports = defineConfig({ // ... - modules: { - [Modules.NOTIFICATION]: { - resolve: "@medusajs/medusa/notification", + modules: [ + { + resolve: "@medusajs/notification", options: { providers: [ // ... { - resolve: "@medusajs/medusa/notification-sendgrid", + resolve: "@medusajs/notification-sendgrid", id: "sendgrid", options: { channels: ["email"], @@ -62,7 +62,7 @@ module.exports = defineConfig({ ], }, }, - }, + ] }) ``` diff --git a/www/apps/resources/app/architectural-modules/workflow-engine/in-memory/page.mdx b/www/apps/resources/app/architectural-modules/workflow-engine/in-memory/page.mdx index dc25afe86a030..b1c616767c009 100644 --- a/www/apps/resources/app/architectural-modules/workflow-engine/in-memory/page.mdx +++ b/www/apps/resources/app/architectural-modules/workflow-engine/in-memory/page.mdx @@ -22,17 +22,19 @@ The In-Memory Workflow Engine Module is registered by default in your applicatio -Add the module into the `modules` property of the exported object in `medusa-config.js`: +Add the module into the `modules` property of the exported object in `medusa-config.ts`: -```js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +```ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... module.exports = defineConfig({ // ... - modules: { - [Modules.WORKFLOW_ENGINE]: true, - }, + modules: [ + { + resolve: "@medusajs/workflow-engine-inmemory" + } + ], }) ``` diff --git a/www/apps/resources/app/architectural-modules/workflow-engine/redis/page.mdx b/www/apps/resources/app/architectural-modules/workflow-engine/redis/page.mdx index a13295a7f220c..9334e26719cbf 100644 --- a/www/apps/resources/app/architectural-modules/workflow-engine/redis/page.mdx +++ b/www/apps/resources/app/architectural-modules/workflow-engine/redis/page.mdx @@ -19,21 +19,21 @@ The Redis Workflow Engine Module uses Redis to track workflow executions and han } ]} /> -Add the module into the `modules` property of the exported object in `medusa-config.js`: +Add the module into the `modules` property of the exported object in `medusa-config.ts`: export const highlights = [ ["12", "url", "The Redis connection URL."] ] -```js title="medusa-config.js" highlights={highlights} -const { Modules } = require("@medusajs/framework/utils") +```ts title="medusa-config.ts" highlights={highlights} +import { Modules } from "@medusajs/framework/utils" // ... module.exports = defineConfig({ // ... - modules: { - [Modules.WORKFLOW_ENGINE]: { + modules: [ + { resolve: "@medusajs/workflow-engine-redis", options: { redis: { @@ -41,7 +41,7 @@ module.exports = defineConfig({ }, }, }, - }, + ] }) ``` diff --git a/www/apps/resources/app/commerce-modules/auth/auth-providers/emailpass/page.mdx b/www/apps/resources/app/commerce-modules/auth/auth-providers/emailpass/page.mdx index 1eba284ab0279..b1a4041932d8b 100644 --- a/www/apps/resources/app/commerce-modules/auth/auth-providers/emailpass/page.mdx +++ b/www/apps/resources/app/commerce-modules/auth/auth-providers/emailpass/page.mdx @@ -18,8 +18,8 @@ The Emailpass auth provider is registered by default with the Auth Module. If you want to pass options to the provider, add the provider to the `providers` option of the Auth Module: -```js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +```ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... diff --git a/www/apps/resources/app/commerce-modules/auth/auth-providers/github/page.mdx b/www/apps/resources/app/commerce-modules/auth/auth-providers/github/page.mdx index 26350fde8b3da..4b42203f198bc 100644 --- a/www/apps/resources/app/commerce-modules/auth/auth-providers/github/page.mdx +++ b/www/apps/resources/app/commerce-modules/auth/auth-providers/github/page.mdx @@ -35,8 +35,8 @@ Learn about the authentication flow in [this guide](../../authentication-route/p Add the module to the array of providers passed to the Auth Module: -```js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +```ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... diff --git a/www/apps/resources/app/commerce-modules/auth/auth-providers/google/page.mdx b/www/apps/resources/app/commerce-modules/auth/auth-providers/google/page.mdx index 4c689c4fcd372..d583e96b84f84 100644 --- a/www/apps/resources/app/commerce-modules/auth/auth-providers/google/page.mdx +++ b/www/apps/resources/app/commerce-modules/auth/auth-providers/google/page.mdx @@ -35,8 +35,8 @@ Learn about the authentication flow for third-party providers in [this guide](.. Add the module to the array of providers passed to the Auth Module: -```js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +```ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... diff --git a/www/apps/resources/app/commerce-modules/auth/auth-providers/page.mdx b/www/apps/resources/app/commerce-modules/auth/auth-providers/page.mdx index 5551b6b2dad37..e7d27e26b5ebf 100644 --- a/www/apps/resources/app/commerce-modules/auth/auth-providers/page.mdx +++ b/www/apps/resources/app/commerce-modules/auth/auth-providers/page.mdx @@ -41,7 +41,7 @@ By default, users of all actor types can authenticate with all installed auth mo To restrict the auth providers used for actor types, use the [authMethodsPerActor option](/references/medusa-config#http-authMethodsPerActor-1-3) in Medusa's configurations: -```js title="medusa-config.js" +```ts title="medusa-config.ts" module.exports = defineConfig({ projectConfig: { http: { diff --git a/www/apps/resources/app/commerce-modules/auth/module-options/page.mdx b/www/apps/resources/app/commerce-modules/auth/module-options/page.mdx index 8d408ef0846a1..ca0e7c310b791 100644 --- a/www/apps/resources/app/commerce-modules/auth/module-options/page.mdx +++ b/www/apps/resources/app/commerce-modules/auth/module-options/page.mdx @@ -26,27 +26,29 @@ By default, the `emailpass` provider is registered to authenticate customers and For example: -```js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +```ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... module.exports = defineConfig({ // ... - modules: { - resolve: "@medusajs/medusa/auth", - options: { - providers: [ - { - resolve: "@medusajs/medusa/auth-emailpass", - id: "emailpass", - options: { - // provider options... + modules: [ + { + resolve: "@medusajs/auth", + options: { + providers: [ + { + resolve: "@medusajs/auth-emailpass", + id: "emailpass", + options: { + // provider options... + }, }, - }, - ], + ], + }, }, - }, + ] }) ``` diff --git a/www/apps/resources/app/commerce-modules/cart/extend/page.mdx b/www/apps/resources/app/commerce-modules/cart/extend/page.mdx index 72c9c9ee59872..e80fad21085c7 100644 --- a/www/apps/resources/app/commerce-modules/cart/extend/page.mdx +++ b/www/apps/resources/app/commerce-modules/cart/extend/page.mdx @@ -81,7 +81,7 @@ This defines a link between the `Cart` and `Custom` data models. Using this link -Add the following configuration in `medusa-config.js`: +Add the following configuration in `medusa-config.ts`: -```js title="medusa-config.js" +```ts title="medusa-config.ts" module.exports = defineConfig({ // ... admin: { @@ -89,9 +89,9 @@ Later, you’ll set different values of the `DISABLE_MEDUSA_ADMIN` environment v ### Configure Redis URL -Add the following configuration in `medusa-config.js` : +Add the following configuration in `medusa-config.ts` : -```js title="medusa-config.js" +```ts title="medusa-config.ts" module.exports = defineConfig({ projectConfig: { // ... @@ -134,34 +134,33 @@ For example, add the following dependencies in `package.json` for the Cache, Eve ```json "dependencies": { // ... - "@medusajs/medusa/cache-redis": "rc", - "@medusajs/medusa/event-bus-redis": "rc", + "@medusajs/cache-redis": "rc", + "@medusajs/event-bus-redis": "rc", "@medusajs/workflow-engine-redis": "rc" } ``` -Then, add these modules in `medusa-config.js`: +Then, add these modules in `medusa-config.ts`: -```js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +```ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" module.exports = defineConfig({ // ... - modules: { - // ... - [Modules.CACHE]: { - resolve: "@medusajs/medusa/cache-redis", + modules: [ + { + resolve: "@medusajs/cache-redis", options: { redisUrl: process.env.REDIS_URL, }, }, - [Modules.EVENT_BUS]: { - resolve: "@medusajs/medusa/event-bus-redis", + { + resolve: "@medusajs/event-bus-redis", options: { redisUrl: process.env.REDIS_URL, }, }, - [Modules.WORKFLOW_ENGINE]: { + { resolve: "@medusajs/workflow-engine-redis", options: { redis: { @@ -169,7 +168,7 @@ module.exports = defineConfig({ }, }, }, - }, + ] }) ``` @@ -286,9 +285,9 @@ You can either generate a random domain name or set a custom one. To do that: If you’re deploying the Medusa application in server mode with the admin, you have to make some changes now that you’ve obtained the application’s URL. -First, add the following configuration to `medusa-config.js`: +First, add the following configuration to `medusa-config.ts`: -```js title="medusa-config.js" +```ts title="medusa-config.ts" module.exports = defineConfig({ // ... admin: { diff --git a/www/apps/resources/app/medusa-container-resources/page.mdx b/www/apps/resources/app/medusa-container-resources/page.mdx index e3f4161cf1a4a..fb23a7d320192 100644 --- a/www/apps/resources/app/medusa-container-resources/page.mdx +++ b/www/apps/resources/app/medusa-container-resources/page.mdx @@ -48,7 +48,7 @@ Use the `ContainerRegistrationKeys` enum imported from `@medusajs/framework/util - The configurations that are exported from `medusa-config.js`. + The configurations that are exported from `medusa-config.ts`. @@ -120,12 +120,12 @@ Use the `ContainerRegistrationKeys` enum imported from `@medusajs/framework/util - The main service of every module added in `medusa-config.js`. + The main service of every module added in `medusa-config.ts`. - - For custom modules, the registration name is the key of the module in the `modules` configuration in `medusa-config.js`. + - For custom modules, the registration name is the key of the module in the `modules` configuration in `medusa-config.ts`. - For Medusa's commerce modules, use the `Modules` enum imported from `@medusajs/framework/utils`. @@ -229,7 +229,7 @@ Use the `ContainerRegistrationKeys` enum imported from `@medusajs/framework/util - The configurations exported from `medusa-config.js`. + The configurations exported from `medusa-config.ts`. diff --git a/www/apps/resources/app/recipes/commerce-automation/page.mdx b/www/apps/resources/app/recipes/commerce-automation/page.mdx index 544c08121d442..53151076521dc 100644 --- a/www/apps/resources/app/recipes/commerce-automation/page.mdx +++ b/www/apps/resources/app/recipes/commerce-automation/page.mdx @@ -150,19 +150,16 @@ export const restockModelHighlights = [ }) ``` - Finally, add the module to the `modules` object in `medusa-config.js`: + Finally, add the module to the `modules` object in `medusa-config.ts`: - ```js title="medusa-config.js" + ```ts title="medusa-config.ts" module.exports = defineConfig({ // ... - modules: { - "restockNotificationModuleService": { + modules: [ + { resolve: "./modules/restock-notification", - definition: { - isQueryable: true, - }, }, - }, + ] }) ``` diff --git a/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx b/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx index c8a126860bb4e..2f0c229e23268 100644 --- a/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx +++ b/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx @@ -189,16 +189,16 @@ export default Module(DIGITAL_PRODUCT_MODULE, { ### Add Module to Medusa Configuration -Finally, add the module to the list of modules in `medusa-config.js`: +Finally, add the module to the list of modules in `medusa-config.ts`: -```tsx title="medusa-config.js" +```ts title="medusa-config.ts" module.exports = defineConfig({ // ... - modules: { - digitalProductModuleService: { + modules: [ + { resolve: "./modules/digital-product", }, - }, + ] }) ``` @@ -1502,21 +1502,21 @@ export default providerExport ### Register Module Provider in Medusa's Configurations -Finally, register the module provider in `medusa-config.js`: +Finally, register the module provider in `medusa-config.ts`: -```js title="medusa-config.js" +```ts title="medusa-config.ts" // other imports... -const { Modules } = require("@medusajs/framework/utils") +import { Modules } from "@medusajs/framework/utils" module.exports = defineConfig({ - modules: { + modules: [ // ... - [Modules.FULFILLMENT]: { - resolve: "@medusajs/medusa/fulfillment", + { + resolve: "@medusajs/fulfillment", options: { providers: [ { - resolve: "@medusajs/medusa/fulfillment-manual", + resolve: "@medusajs/fulfillment-manual", id: "manual", }, { @@ -1526,7 +1526,7 @@ module.exports = defineConfig({ ], }, }, - }, + ] }) ``` @@ -2000,19 +2000,19 @@ In the `sendDigitalOrderNotificationStep`, you use a notification provider confi Check out the [Integrations page](../../../../integrations/page.mdx) to find Notification Module Providers. -For testing purposes, add to `medusa-config.js` the following to use the Local Notification Module Provider: +For testing purposes, add to `medusa-config.ts` the following to use the Local Notification Module Provider: -```js title="medusa-config.js" +```ts title="medusa-config.ts" module.exports = defineConfig({ // ... - modules: { + modules: [ // ... - [Modules.NOTIFICATION]: { - resolve: "@medusajs/medusa/notification", + { + resolve: "@medusajs/notification", options: { providers: [ { - resolve: "@medusajs/medusa/notification-local", + resolve: "@medusajs/notification-local", id: "local", options: { name: "Local Notification Provider", @@ -2022,7 +2022,7 @@ module.exports = defineConfig({ ], }, }, - }, + ] }) ``` diff --git a/www/apps/resources/app/recipes/integrate-ecommerce-stack/page.mdx b/www/apps/resources/app/recipes/integrate-ecommerce-stack/page.mdx index 2d477618a44c6..bb1f1c36a9708 100644 --- a/www/apps/resources/app/recipes/integrate-ecommerce-stack/page.mdx +++ b/www/apps/resources/app/recipes/integrate-ecommerce-stack/page.mdx @@ -116,19 +116,19 @@ export const serviceHighlights = [ }) ``` - Finally, add the module to the `modules` object in `medusa-config.js`: + Finally, add the module to the `modules` object in `medusa-config.ts`: - ```js title="medusa-config.js" highlights={[["7", "ERP_API_KEY", "The environment variable holding the API key of the ERP system."]]} + ```ts title="medusa-config.ts" highlights={[["7", "ERP_API_KEY", "The environment variable holding the API key of the ERP system."]]} module.exports = defineConfig({ // ... - modules: { - erpModuleService: { + modules: [ + { resolve: "./modules/erp", options: { apiKey: process.env.ERP_API_KEY, }, }, - }, + ] }) ``` diff --git a/www/apps/resources/app/recipes/marketplace/examples/restaurant-delivery/page.mdx b/www/apps/resources/app/recipes/marketplace/examples/restaurant-delivery/page.mdx index d4173a26d8852..12c8b2de8c41b 100644 --- a/www/apps/resources/app/recipes/marketplace/examples/restaurant-delivery/page.mdx +++ b/www/apps/resources/app/recipes/marketplace/examples/restaurant-delivery/page.mdx @@ -155,16 +155,16 @@ export default Module(RESTAURANT_MODULE, { ### Add Restaurant Module to Medusa Configuration -Finally, add the module to the list of modules in `medusa-config.js`: +Finally, add the module to the list of modules in `medusa-config.ts`: -```js title="medusa-config.js" +```ts title="medusa-config.ts" module.exports = defineConfig({ // ... - modules: { - restaurantModuleService: { + modules: [ + { resolve: "./modules/restaurant", }, - }, + ] }) ``` @@ -299,17 +299,16 @@ export default Module(DELIVERY_MODULE, { ### Add Delivery Module to Medusa Configuration -Finally, add the module to the list of modules in `medusa-config.js`: +Finally, add the module to the list of modules in `medusa-config.ts`: -```js title="medusa-config.js" +```ts title="medusa-config.ts" module.exports = defineConfig({ // ... - modules: { - deliveryModuleService: { + modules: [ + { resolve: "./modules/delivery", }, - // ... - }, + ] }) ``` diff --git a/www/apps/resources/app/recipes/marketplace/examples/vendors/page.mdx b/www/apps/resources/app/recipes/marketplace/examples/vendors/page.mdx index 4a63fca79bed4..5ca0a32cdc9c0 100644 --- a/www/apps/resources/app/recipes/marketplace/examples/vendors/page.mdx +++ b/www/apps/resources/app/recipes/marketplace/examples/vendors/page.mdx @@ -135,16 +135,16 @@ export default Module(MARKETPLACE_MODULE, { ### Add Module to Medusa Configuration -Finally, add the module to the list of modules in `medusa-config.js`: +Finally, add the module to the list of modules in `medusa-config.ts`: -```ts title="medusa-config.js" +```ts title="medusa-config.ts" module.exports = defineConfig({ // ... - modules: { - marketplaceModuleService: { + modules: [ + { resolve: "./modules/marketplace", }, - }, + ] }) ``` diff --git a/www/apps/resources/app/recipes/subscriptions/examples/standard/page.mdx b/www/apps/resources/app/recipes/subscriptions/examples/standard/page.mdx index 4c05aa6abf728..7c85b22b8dfcf 100644 --- a/www/apps/resources/app/recipes/subscriptions/examples/standard/page.mdx +++ b/www/apps/resources/app/recipes/subscriptions/examples/standard/page.mdx @@ -153,16 +153,16 @@ This sets the module’s name to `subscriptionModuleService` and its main servic ### Register Module in Medusa’s Configuration -Finally, add the module into `medusa-config.js`: +Finally, add the module into `medusa-config.ts`: -```ts title="medusa-config.js" +```ts title="medusa-config.ts" module.exports = defineConfig({ // ... - modules: { - subscriptionModuleService: { + modules: [ + { resolve: "./modules/subscription", }, - }, + ] }) ``` diff --git a/www/apps/resources/app/storefront-development/tips/page.mdx b/www/apps/resources/app/storefront-development/tips/page.mdx index 9a7f78a488547..2128f877a1bf7 100644 --- a/www/apps/resources/app/storefront-development/tips/page.mdx +++ b/www/apps/resources/app/storefront-development/tips/page.mdx @@ -36,11 +36,11 @@ npm install @medusajs/types@rc ## Configure CORS -The Medusa application’s API routes are guarded by a CORS middleware. Make sure to set the `storeCors` property of the `http` configuration in `medusa-config.js` to the storefront’s URL. +The Medusa application’s API routes are guarded by a CORS middleware. Make sure to set the `storeCors` property of the `http` configuration in `medusa-config.ts` to the storefront’s URL. For example: -```js title="medusa-config.js" +```ts title="medusa-config.ts" module.exports = defineConfig({ projectConfig: { http: { diff --git a/www/apps/resources/app/troubleshooting/_sections/other/cors-errors.mdx b/www/apps/resources/app/troubleshooting/_sections/other/cors-errors.mdx index 2f886826de801..274e7d445da24 100644 --- a/www/apps/resources/app/troubleshooting/_sections/other/cors-errors.mdx +++ b/www/apps/resources/app/troubleshooting/_sections/other/cors-errors.mdx @@ -4,9 +4,9 @@ You might see a log in your browser console, that looks like this: ![CORS error log](https://res.cloudinary.com/dza7lstvk/image/upload/v1668003322/Medusa%20Docs/Other/jnHK115_udgf2n.png) -In your `medusa-config.js` , you should ensure that you've configured your CORS settings correctly: +In your `medusa-config.ts` , you should ensure that you've configured your CORS settings correctly: -```js title="medusa-config.js" +```ts title="medusa-config.ts" module.exports = defineConfig({ projectConfig: { http: { diff --git a/www/apps/resources/app/troubleshooting/medusa-admin/no-widget-route/page.mdx b/www/apps/resources/app/troubleshooting/medusa-admin/no-widget-route/page.mdx index dbc971e63d951..ed288ac27d7d1 100644 --- a/www/apps/resources/app/troubleshooting/medusa-admin/no-widget-route/page.mdx +++ b/www/apps/resources/app/troubleshooting/medusa-admin/no-widget-route/page.mdx @@ -42,9 +42,9 @@ Refer to the [Admin Development Constraints](!docs!/advanced-development/admin/c If you're using a Docker image to host your Medusa application, make sure that the image's root path is different than the Medusa Admin's `path` configuration. -For example, if your Docker image's root path is `/app`, make sure to change the `path` configuration in `medusa-config.js`, as it's `/app` by default: +For example, if your Docker image's root path is `/app`, make sure to change the `path` configuration in `medusa-config.ts`, as it's `/app` by default: -```js title="medusa-config.js" +```ts title="medusa-config.ts" module.exports = defineConfig({ admin: { path: `/dashboard`, diff --git a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/auth-provider.ts b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/auth-provider.ts index 67cd8f8fa3813..949a2171fdf44 100644 --- a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/auth-provider.ts +++ b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/auth-provider.ts @@ -48,17 +48,17 @@ export default { This exports the module's definition, indicating that the \`MyAuthProviderService\` is the module's service.`, `## 4. Use Module -To use your Auth Module Provider, add it to the \`providers\` array of the Auth Module: +To use your Auth Module Provider, add it to the \`providers\` array of the Auth Module in \`medusa-config.ts\`: -\`\`\`js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +\`\`\`ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... module.exports = defineConfig({ // ... - modules: { - [Modules.AUTH]: { + modules: [ + { resolve: "@medusajs/framework/auth", options: { providers: [ @@ -72,7 +72,7 @@ module.exports = defineConfig({ ], }, }, - } + ] }) \`\`\` `, diff --git a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/file.ts b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/file.ts index 816810e6dc88f..001bb6485e9a9 100644 --- a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/file.ts +++ b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/file.ts @@ -48,7 +48,7 @@ export default { This exports the module's definition, indicating that the \`MyFileProviderService\` is the module's service.`, `## 4. Use Module -To use your File Module Provider, add it to the \`providers\` array of the File Module: +To use your File Module Provider, add it to the \`providers\` array of the File Module in \`medusa-config.ts\`: @@ -56,15 +56,15 @@ The File Module accepts one provider only. -\`\`\`js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +\`\`\`ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... module.exports = defineConfig({ // ... - modules: { - [Modules.FILE]: { + modules: [ + { resolve: "@medusajs/framework/file", options: { providers: [ @@ -78,7 +78,7 @@ module.exports = defineConfig({ ], }, }, - } + ] }) \`\`\` `, diff --git a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/fulfillment-provider.ts b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/fulfillment-provider.ts index 2e4e09e6ae4cf..f5639d112cfe4 100644 --- a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/fulfillment-provider.ts +++ b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/fulfillment-provider.ts @@ -48,17 +48,17 @@ export default { This exports the module's definition, indicating that the \`MyFulfillmentProviderService\` is the module's service.`, `## 4. Use Module -To use your Fulfillment Module Provider, add it to the \`providers\` array of the Fulfillment Module: +To use your Fulfillment Module Provider, add it to the \`providers\` array of the Fulfillment Module in \`medusa-config.ts\`: -\`\`\`js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +\`\`\`ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... module.exports = defineConfig({ // ... - modules: { - [Modules.FULFILLMENT]: { + modules: [ + { resolve: "@medusajs/framework/fulfillment", options: { providers: [ @@ -72,7 +72,7 @@ module.exports = defineConfig({ ], }, }, - } + ] }) \`\`\` `, diff --git a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/medusa-config.ts b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/medusa-config.ts index abec1d5aa5b42..191741c133704 100644 --- a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/medusa-config.ts +++ b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/medusa-config.ts @@ -9,7 +9,7 @@ const medusaConfigOptions: FormattingOptionsType = { frontmatterData: { slug: "/references/medusa-config", }, - reflectionDescription: `In this document, you’ll learn how to create a file service in the Medusa backend and the methods you must implement in it.`, + reflectionDescription: `In this document, you’ll learn how to create a file service in the Medusa application and the methods you must implement in it.`, reflectionTitle: { fullReplacement: "Configure Medusa Backend", }, diff --git a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/notification.ts b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/notification.ts index e4053c941165d..96736761bc887 100644 --- a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/notification.ts +++ b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/notification.ts @@ -52,7 +52,7 @@ export default { This exports the module's definition, indicating that the \`MyNotificationProviderService\` is the module's service.`, `## 4. Use Module -To use your Notification Module Provider, add it to the \`providers\` array of the Notification Module: +To use your Notification Module Provider, add it to the \`providers\` array of the Notification Module in \`medusa-config.ts\`: @@ -60,15 +60,15 @@ The Notification Module accepts one provider per channel. -\`\`\`js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +\`\`\`ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... module.exports = defineConfig({ // ... - modules: { - [Modules.NOTIFICATION]: { + modules: [ + { resolve: "@medusajs/framework/notification", options: { providers: [ @@ -83,7 +83,7 @@ module.exports = defineConfig({ ], }, }, - } + ] }) \`\`\` diff --git a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/payment-provider.ts b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/payment-provider.ts index 214cfbce55b2b..fff1511015a0d 100644 --- a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/payment-provider.ts +++ b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/payment-provider.ts @@ -57,17 +57,17 @@ export default { This exports the module's definition, indicating that the \`MyPaymentProviderService\` is the module's service.`, `## 4. Use Module -To use your Payment Module Provider, add it to the \`providers\` array of the Payment Module: +To use your Payment Module Provider, add it to the \`providers\` array of the Payment Module in \`medusa-config.ts\`: -\`\`\`js title="medusa-config.js" -const { Modules } = require("@medusajs/framework/utils") +\`\`\`ts title="medusa-config.ts" +import { Modules } from "@medusajs/framework/utils" // ... module.exports = defineConfig({ // ... - modules: { - [Modules.PAYMENT]: { + modules: [ + { resolve: "@medusajs/framework/payment", options: { providers: [ @@ -82,7 +82,7 @@ module.exports = defineConfig({ ] } } - } + ] }) \`\`\` `,