From 8d3fb7fb2bb7d6774f4e1f97a25566f93e85399c Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Mon, 16 Sep 2024 20:34:00 +0300 Subject: [PATCH] docs: use require instead of import in medusa-config.js (#9102) Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com> --- .../resources/app/architectural-modules/cache/create/page.mdx | 2 +- .../app/architectural-modules/cache/in-memory/page.mdx | 2 +- .../resources/app/architectural-modules/cache/redis/page.mdx | 2 +- .../resources/app/architectural-modules/event/create/page.mdx | 2 +- .../resources/app/architectural-modules/event/local/page.mdx | 2 +- .../resources/app/architectural-modules/event/redis/page.mdx | 2 +- .../resources/app/architectural-modules/file/local/page.mdx | 2 +- www/apps/resources/app/architectural-modules/file/s3/page.mdx | 2 +- .../app/architectural-modules/notification/local/page.mdx | 2 +- .../resources/app/architectural-modules/notification/page.mdx | 2 +- .../app/architectural-modules/notification/sendgrid/page.mdx | 2 +- .../architectural-modules/workflow-engine/in-memory/page.mdx | 2 +- .../app/architectural-modules/workflow-engine/redis/page.mdx | 2 +- .../commerce-modules/auth/auth-providers/emailpass/page.mdx | 2 +- .../app/commerce-modules/auth/auth-providers/github/page.mdx | 2 +- .../app/commerce-modules/auth/auth-providers/google/page.mdx | 2 +- .../app/commerce-modules/auth/module-options/page.mdx | 2 +- .../app/commerce-modules/fulfillment/module-options/page.mdx | 2 +- .../app/commerce-modules/payment/module-options/page.mdx | 2 +- .../commerce-modules/payment/payment-provider/stripe/page.mdx | 2 +- .../app/commerce-modules/tax/module-options/page.mdx | 2 +- .../app/commerce-modules/user/module-options/page.mdx | 2 +- .../app/deployment/medusa-application/railway/page.mdx | 2 +- .../app/recipes/digital-products/examples/standard/page.mdx | 4 +--- .../src/constants/merger-custom-options/auth-provider.ts | 2 +- .../src/constants/merger-custom-options/file.ts | 2 +- .../constants/merger-custom-options/fulfillment-provider.ts | 2 +- .../src/constants/merger-custom-options/notification.ts | 2 +- .../src/constants/merger-custom-options/payment-provider.ts | 2 +- 29 files changed, 29 insertions(+), 31 deletions(-) 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 8b80483d88..775ce8a876 100644 --- a/www/apps/resources/app/architectural-modules/cache/create/page.mdx +++ b/www/apps/resources/app/architectural-modules/cache/create/page.mdx @@ -153,7 +153,7 @@ To use your Cache Module, add it to the `modules` object exported as part of the For example: ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... 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 2e398fa255..9bce2dba0d 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 @@ -37,7 +37,7 @@ Make sure that the version added in `package.json` is `preview` to avoid errors Next, add the module into the `modules` property of the exported object in `medusa-config.js`: ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... 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 c969b707e8..50dbdd7726 100644 --- a/www/apps/resources/app/architectural-modules/cache/redis/page.mdx +++ b/www/apps/resources/app/architectural-modules/cache/redis/page.mdx @@ -38,7 +38,7 @@ export const highlights = [ ] ```js title="medusa-config.js" highlights={highlights} -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... 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 64e5f5d77e..b683a73919 100644 --- a/www/apps/resources/app/architectural-modules/event/create/page.mdx +++ b/www/apps/resources/app/architectural-modules/event/create/page.mdx @@ -108,7 +108,7 @@ To use your Event Module, add it to the `modules` object exported as part of the For example: ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... 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 ed9af728c2..dd60b75c93 100644 --- a/www/apps/resources/app/architectural-modules/event/local/page.mdx +++ b/www/apps/resources/app/architectural-modules/event/local/page.mdx @@ -35,7 +35,7 @@ Make sure that the version added in `package.json` is `preview` to avoid errors Next, add the module into the `modules` property of the exported object in `medusa-config.js`: ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... 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 5e2c5bfffb..97e0d5b243 100644 --- a/www/apps/resources/app/architectural-modules/event/redis/page.mdx +++ b/www/apps/resources/app/architectural-modules/event/redis/page.mdx @@ -42,7 +42,7 @@ export const highlights = [ ] ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... 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 ff084d556b..c6d1b25154 100644 --- a/www/apps/resources/app/architectural-modules/file/local/page.mdx +++ b/www/apps/resources/app/architectural-modules/file/local/page.mdx @@ -45,7 +45,7 @@ The File Module accepts one provider only. ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... 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 5a425c47c6..9108e6179e 100644 --- a/www/apps/resources/app/architectural-modules/file/s3/page.mdx +++ b/www/apps/resources/app/architectural-modules/file/s3/page.mdx @@ -119,7 +119,7 @@ The File Module accepts one provider only. ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... 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 4847f5752d..507732fb9b 100644 --- a/www/apps/resources/app/architectural-modules/notification/local/page.mdx +++ b/www/apps/resources/app/architectural-modules/notification/local/page.mdx @@ -39,7 +39,7 @@ Only one provider can be defined for a channel. ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... diff --git a/www/apps/resources/app/architectural-modules/notification/page.mdx b/www/apps/resources/app/architectural-modules/notification/page.mdx index e0ea59d156..22ae8ccd63 100644 --- a/www/apps/resources/app/architectural-modules/notification/page.mdx +++ b/www/apps/resources/app/architectural-modules/notification/page.mdx @@ -31,7 +31,7 @@ When you send a notification, you specify the channel to send it through, such a For example: ```js title="medusa-config.js" highlights={[["19"]]} -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... 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 d2cf5e139c..d10c3eae1c 100644 --- a/www/apps/resources/app/architectural-modules/notification/sendgrid/page.mdx +++ b/www/apps/resources/app/architectural-modules/notification/sendgrid/page.mdx @@ -50,7 +50,7 @@ Only one provider can be defined for a channel. ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... 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 ff16c1aa49..fd8978b384 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 @@ -37,7 +37,7 @@ Make sure that the version added in `package.json` is `preview` to avoid errors Next, add the module into the `modules` property of the exported object in `medusa-config.js`: ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... 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 a31de0bb0e..710e9d6b5e 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 @@ -38,7 +38,7 @@ export const highlights = [ ] ```js title="medusa-config.js" highlights={highlights} -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... 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 eac100af4e..2ca08e7188 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 @@ -19,7 +19,7 @@ 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" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/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 8e49749e1b..f5cea508c3 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 @@ -42,7 +42,7 @@ npm install @medusajs/auth-github@preview Next, add the module to the array of providers passed to the Auth Module: ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/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 80fb147bbe..7c9c0da8a6 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 @@ -42,7 +42,7 @@ npm install @medusajs/auth-google@preview Next, add the module to the array of providers passed to the Auth Module: ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... 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 8627886745..4e5cc3a0f5 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 @@ -21,7 +21,7 @@ When the Medusa application starts, these providers are registered and can be us For example: ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... diff --git a/www/apps/resources/app/commerce-modules/fulfillment/module-options/page.mdx b/www/apps/resources/app/commerce-modules/fulfillment/module-options/page.mdx index 732061125a..54862384e4 100644 --- a/www/apps/resources/app/commerce-modules/fulfillment/module-options/page.mdx +++ b/www/apps/resources/app/commerce-modules/fulfillment/module-options/page.mdx @@ -21,7 +21,7 @@ When the Medusa application starts, these providers are registered and can be us For example: ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... diff --git a/www/apps/resources/app/commerce-modules/payment/module-options/page.mdx b/www/apps/resources/app/commerce-modules/payment/module-options/page.mdx index f56f19835d..3e8af8b055 100644 --- a/www/apps/resources/app/commerce-modules/payment/module-options/page.mdx +++ b/www/apps/resources/app/commerce-modules/payment/module-options/page.mdx @@ -102,7 +102,7 @@ When the Medusa application starts, these providers are registered and can be us For example: ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... diff --git a/www/apps/resources/app/commerce-modules/payment/payment-provider/stripe/page.mdx b/www/apps/resources/app/commerce-modules/payment/payment-provider/stripe/page.mdx index 060a321fe5..80881645d2 100644 --- a/www/apps/resources/app/commerce-modules/payment/payment-provider/stripe/page.mdx +++ b/www/apps/resources/app/commerce-modules/payment/payment-provider/stripe/page.mdx @@ -52,7 +52,7 @@ Make sure that the version added in `package.json` is `preview` to avoid errors Next, add the module to the array of providers passed to the Payment Module: ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... diff --git a/www/apps/resources/app/commerce-modules/tax/module-options/page.mdx b/www/apps/resources/app/commerce-modules/tax/module-options/page.mdx index 8402f2cf13..6f58db2e3e 100644 --- a/www/apps/resources/app/commerce-modules/tax/module-options/page.mdx +++ b/www/apps/resources/app/commerce-modules/tax/module-options/page.mdx @@ -19,7 +19,7 @@ The `providers` option is an array of either tax module providers, tax plugins, When the Medusa application starts, these providers are registered and can be used to retrieve tax lines. ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... diff --git a/www/apps/resources/app/commerce-modules/user/module-options/page.mdx b/www/apps/resources/app/commerce-modules/user/module-options/page.mdx index a37dd43d58..ed62b29149 100644 --- a/www/apps/resources/app/commerce-modules/user/module-options/page.mdx +++ b/www/apps/resources/app/commerce-modules/user/module-options/page.mdx @@ -15,7 +15,7 @@ In this document, you'll learn about the options of the User Module. ## Module Options ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... diff --git a/www/apps/resources/app/deployment/medusa-application/railway/page.mdx b/www/apps/resources/app/deployment/medusa-application/railway/page.mdx index 733445bf8b..29f67c591b 100644 --- a/www/apps/resources/app/deployment/medusa-application/railway/page.mdx +++ b/www/apps/resources/app/deployment/medusa-application/railway/page.mdx @@ -143,7 +143,7 @@ For example, add the following dependencies in `package.json` for the Cache, Eve Then, add these modules in `medusa-config.js`: ```js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") module.exports = defineConfig({ // ... 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 337e5c2953..6329bd35e9 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 @@ -1506,9 +1506,7 @@ Finally, register the module provider in `medusa-config.js`: ```js title="medusa-config.js" // other imports... -import { - Modules, -} from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") module.exports = defineConfig({ modules: { 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 eb05da2a00..324e566374 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 @@ -51,7 +51,7 @@ 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: \`\`\`js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... 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 71d2afa488..9c32596e54 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 @@ -57,7 +57,7 @@ The File Module accepts one provider only. \`\`\`js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... 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 20821f2990..25f42c7196 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 @@ -51,7 +51,7 @@ 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: \`\`\`js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... 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 531df09646..02607b05e5 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 @@ -61,7 +61,7 @@ The Notification Module accepts one provider per channel. \`\`\`js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ... 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 496a0bd526..926202d9c8 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 @@ -60,7 +60,7 @@ 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: \`\`\`js title="medusa-config.js" -import { Modules } from "@medusajs/utils" +const { Modules } = require("@medusajs/utils") // ...