chore(framework): update TSDocs for medusa config (#9559)

* chore(framework): update TSDocs for medusa config

* update modules tsdocs
This commit is contained in:
Shahed Nasser
2024-10-14 13:45:50 +03:00
committed by GitHub
parent b6df24463d
commit 6829d3b162
+51 -53
View File
@@ -18,7 +18,7 @@ export type AdminOptions = {
* in both development and production environments. The default value is `false`. * in both development and production environments. The default value is `false`.
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* admin: { * admin: {
* disable: process.env.ADMIN_DISABLED === "true" || * disable: process.env.ADMIN_DISABLED === "true" ||
@@ -46,7 +46,7 @@ export type AdminOptions = {
* ::: * :::
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* admin: { * admin: {
* path: process.env.ADMIN_PATH || `/app`, * path: process.env.ADMIN_PATH || `/app`,
@@ -61,7 +61,7 @@ export type AdminOptions = {
* The default value is `./build`. * The default value is `./build`.
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* admin: { * admin: {
* outDir: process.env.ADMIN_BUILD_DIR || `./build`, * outDir: process.env.ADMIN_BUILD_DIR || `./build`,
@@ -75,7 +75,7 @@ export type AdminOptions = {
* The URL of your Medusa application. This is useful to set when you deploy the Medusa application. * The URL of your Medusa application. This is useful to set when you deploy the Medusa application.
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* admin: { * admin: {
* backendUrl: process.env.MEDUSA_BACKEND_URL || * backendUrl: process.env.MEDUSA_BACKEND_URL ||
@@ -173,7 +173,7 @@ export type ProjectConfigOptions = {
* [PostgreSQL's documentation](https://www.postgresql.org/docs/current/sql-createdatabase.html). * [PostgreSQL's documentation](https://www.postgresql.org/docs/current/sql-createdatabase.html).
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* databaseName: process.env.DATABASE_NAME || * databaseName: process.env.DATABASE_NAME ||
@@ -210,9 +210,9 @@ export type ProjectConfigOptions = {
* DATABASE_URL=postgres://postgres@localhost/medusa-store * DATABASE_URL=postgres://postgres@localhost/medusa-store
* ``` * ```
* *
* Then, use the value in `medusa-config.js`: * Then, use the value in `medusa-config.ts`:
* *
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* databaseUrl: process.env.DATABASE_URL, * databaseUrl: process.env.DATABASE_URL,
@@ -227,7 +227,7 @@ export type ProjectConfigOptions = {
/** /**
* The database schema to connect to. This is not required to provide if youre using the default schema, which is `public`. * The database schema to connect to. This is not required to provide if youre using the default schema, which is `public`.
* *
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* databaseSchema: process.env.DATABASE_SCHEMA || * databaseSchema: process.env.DATABASE_SCHEMA ||
@@ -244,7 +244,7 @@ export type ProjectConfigOptions = {
* This configuration specifies whether database messages should be logged. * This configuration specifies whether database messages should be logged.
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* databaseLogging: false * databaseLogging: false
@@ -279,7 +279,7 @@ export type ProjectConfigOptions = {
* ::: * :::
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* databaseDriverOptions: process.env.NODE_ENV !== "development" ? * databaseDriverOptions: process.env.NODE_ENV !== "development" ?
@@ -322,7 +322,7 @@ export type ProjectConfigOptions = {
* For a local Redis installation, the connection URL should be `redis://localhost:6379` unless youve made any changes to the Redis configuration during installation. * For a local Redis installation, the connection URL should be `redis://localhost:6379` unless youve made any changes to the Redis configuration during installation.
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* redisUrl: process.env.REDIS_URL || * redisUrl: process.env.REDIS_URL ||
@@ -341,7 +341,7 @@ export type ProjectConfigOptions = {
* If this configuration option is provided, it is prepended to `sess:`. * If this configuration option is provided, it is prepended to `sess:`.
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* redisPrefix: process.env.REDIS_URL || "medusa:", * redisPrefix: process.env.REDIS_URL || "medusa:",
@@ -358,7 +358,7 @@ export type ProjectConfigOptions = {
* for the list of available options. * for the list of available options.
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* redisOptions: { * redisOptions: {
@@ -377,7 +377,7 @@ export type ProjectConfigOptions = {
* This configuration defines additional options to pass to [express-session](https://www.npmjs.com/package/express-session), which is used to store the Medusa server's session. * This configuration defines additional options to pass to [express-session](https://www.npmjs.com/package/express-session), which is used to store the Medusa server's session.
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* sessionOptions: { * sessionOptions: {
@@ -408,7 +408,7 @@ export type ProjectConfigOptions = {
* Configure the number of staged jobs that are polled from the database. Default is `1000`. * Configure the number of staged jobs that are polled from the database. Default is `1000`.
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* jobsBatchSize: 100 * jobsBatchSize: 100
@@ -446,7 +446,7 @@ export type ProjectConfigOptions = {
* 2. Another having the `workerMode` configuration set to `worker`. * 2. Another having the `workerMode` configuration set to `worker`.
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* workerMode: process.env.WORKER_MODE || "shared" * workerMode: process.env.WORKER_MODE || "shared"
@@ -462,7 +462,7 @@ export type ProjectConfigOptions = {
* This property configures the application's http-specific settings. * This property configures the application's http-specific settings.
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* http: { * http: {
@@ -485,7 +485,7 @@ export type ProjectConfigOptions = {
* error is thrown and the application crashes. * error is thrown and the application crashes.
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* http: { * http: {
@@ -504,7 +504,7 @@ export type ProjectConfigOptions = {
* If not provided, the default value is `24h`. * If not provided, the default value is `24h`.
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* http: { * http: {
@@ -524,7 +524,7 @@ export type ProjectConfigOptions = {
* the application crashes. * the application crashes.
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* http: { * http: {
@@ -561,9 +561,9 @@ export type ProjectConfigOptions = {
* AUTH_CORS=/http:\/\/.+/ * AUTH_CORS=/http:\/\/.+/
* ``` * ```
* *
* Then, set the configuration in `medusa-config.js`: * Then, set the configuration in `medusa-config.ts`:
* *
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* http: { * http: {
@@ -575,9 +575,9 @@ export type ProjectConfigOptions = {
* }) * })
* ``` * ```
* *
* If youre adding the value directly within `medusa-config.js`, make sure to add an extra escaping `/` for every backslash in the pattern. For example: * If youre adding the value directly within `medusa-config.ts`, make sure to add an extra escaping `/` for every backslash in the pattern. For example:
* *
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* http: { * http: {
@@ -599,7 +599,7 @@ export type ProjectConfigOptions = {
* Learn more in the [API Reference](https://docs.medusajs.com/v2/api/store#http-compression). * Learn more in the [API Reference](https://docs.medusajs.com/v2/api/store#http-compression).
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* http: { * http: {
@@ -641,9 +641,9 @@ export type ProjectConfigOptions = {
* STORE_CORS=/http:\/\/.+/ * STORE_CORS=/http:\/\/.+/
* ``` * ```
* *
* Then, set the configuration in `medusa-config.js`: * Then, set the configuration in `medusa-config.ts`:
* *
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* http: { * http: {
@@ -655,9 +655,9 @@ export type ProjectConfigOptions = {
* }) * })
* ``` * ```
* *
* If youre adding the value directly within `medusa-config.js`, make sure to add an extra escaping `/` for every backslash in the pattern. For example: * If youre adding the value directly within `medusa-config.ts`, make sure to add an extra escaping `/` for every backslash in the pattern. For example:
* *
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* http: { * http: {
@@ -695,9 +695,9 @@ export type ProjectConfigOptions = {
* ADMIN_CORS=/http:\/\/.+/ * ADMIN_CORS=/http:\/\/.+/
* ``` * ```
* *
* Then, set the configuration in `medusa-config.js`: * Then, set the configuration in `medusa-config.ts`:
* *
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* http: { * http: {
@@ -709,9 +709,9 @@ export type ProjectConfigOptions = {
* }) * })
* ``` * ```
* *
* If youre adding the value directly within `medusa-config.js`, make sure to add an extra escaping `/` for every backslash in the pattern. For example: * If youre adding the value directly within `medusa-config.ts`, make sure to add an extra escaping `/` for every backslash in the pattern. For example:
* *
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* http: { * http: {
@@ -734,9 +734,9 @@ export type ProjectConfigOptions = {
* @example * @example
* Some example values of common use cases: * Some example values of common use cases:
* *
* Then, set the configuration in `medusa-config.js`: * Then, set the configuration in `medusa-config.ts`:
* *
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* http: { * http: {
@@ -758,9 +758,9 @@ export type ProjectConfigOptions = {
/** /**
* @interface * @interface
* *
* The configurations for your Medusa application are in `medusa-config.js` located in the root of your Medusa project. The configurations include configurations for database, modules, and more. * The configurations for your Medusa application are in `medusa-config.ts` located in the root of your Medusa project. The configurations include configurations for database, modules, and more.
* *
* `medusa-config.js` exports the value returned by the `defineConfig` utility function imported from `@medusajs/framework/utils`. * `medusa-config.ts` exports the value returned by the `defineConfig` utility function imported from `@medusajs/framework/utils`.
* *
* `defineConfig` accepts as a parameter an object with the following properties: * `defineConfig` accepts as a parameter an object with the following properties:
* *
@@ -771,7 +771,7 @@ export type ProjectConfigOptions = {
* *
* For example: * For example:
* *
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* projectConfig: { * projectConfig: {
* // ... * // ...
@@ -792,7 +792,7 @@ export type ProjectConfigOptions = {
* *
* ## Environment Variables * ## Environment Variables
* *
* It's highly recommended to store the values of configurations in environment variables, then reference them within `medusa-config.js`. * It's highly recommended to store the values of configurations in environment variables, then reference them within `medusa-config.ts`.
* *
* During development, you can set your environment variables in the `.env` file at the root of your Medusa application project. In production, * During development, you can set your environment variables in the `.env` file at the root of your Medusa application project. In production,
* setting the environment variables depends on the hosting provider. * setting the environment variables depends on the hosting provider.
@@ -809,7 +809,7 @@ export type ConfigModule = {
* This property holds configurations for the Medusa Admin dashboard. * This property holds configurations for the Medusa Admin dashboard.
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* admin: { * admin: {
* backendUrl: process.env.MEDUSA_BACKEND_URL || * backendUrl: process.env.MEDUSA_BACKEND_URL ||
@@ -825,7 +825,7 @@ export type ConfigModule = {
* On your Medusa backend, you can use [Plugins](https://docs.medusajs.com/development/plugins/overview) to add custom features or integrate third-party services. * On your Medusa backend, you can use [Plugins](https://docs.medusajs.com/development/plugins/overview) to add custom features or integrate third-party services.
* For example, installing a plugin to use Stripe as a payment processor. * For example, installing a plugin to use Stripe as a payment processor.
* *
* Aside from installing the plugin with NPM, you need to pass the plugin you installed into the `plugins` array defined in `medusa-config.js`. * Aside from installing the plugin with NPM, you need to pass the plugin you installed into the `plugins` array defined in `medusa-config.ts`.
* *
* The items in the array can either be: * The items in the array can either be:
* *
@@ -835,7 +835,7 @@ export type ConfigModule = {
* - `options`: An object that includes the plugins options. These options vary for each plugin, and you should refer to the plugins documentation for available options. * - `options`: An object that includes the plugins options. These options vary for each plugin, and you should refer to the plugins documentation for available options.
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = { * module.exports = {
* plugins: [ * plugins: [
* `medusa-my-plugin-1`, * `medusa-my-plugin-1`,
@@ -875,21 +875,19 @@ export type ConfigModule = {
* *
* ::: * :::
* *
* The keys of the `modules` configuration object refer to the module's registration name. Its value can be one of the following: * `modules` is an array of objects, each holding a module's registration configurations. Each object has the following properties:
* *
* 1. A boolean value indicating whether the module type is enabled. This is only supported for Medusa's commerce and architectural modules; * 1. `resolve`: a string indicating the path to the module relative to `src`, or the module's NPM package name. For example, `./modules/my-module`.
* 2. Or an object having the following properties: * 2. `options`: (optional) an object indicating the options to pass to the module.
* 1. `resolve`: a string indicating the path to the module relative to `src`, or the module's NPM package name. For example, `./modules/my-module`.
* 2. `options`: (optional) an object indicating the options to pass to the module.
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* modules: { * modules: [
* helloModuleService: { * {
* resolve: "./modules/hello" * resolve: "./modules/hello"
* } * }
* } * ]
* // ... * // ...
* }) * })
* ``` * ```
@@ -903,14 +901,14 @@ export type ConfigModule = {
* Some features in the Medusa application are guarded by a feature flag. This ensures constant shipping of new features while maintaining the engines stability. * Some features in the Medusa application are guarded by a feature flag. This ensures constant shipping of new features while maintaining the engines stability.
* *
* You can enable a feature in your application by enabling its feature flag. Feature flags are enabled through either environment * You can enable a feature in your application by enabling its feature flag. Feature flags are enabled through either environment
* variables or through this configuration property exported in `medusa-config.js`. * variables or through this configuration property exported in `medusa-config.ts`.
* *
* The `featureFlags`'s value is an object. Its properties are the names of the feature flags, and their value is a boolean indicating whether the feature flag is enabled. * The `featureFlags`'s value is an object. Its properties are the names of the feature flags, and their value is a boolean indicating whether the feature flag is enabled.
* *
* You can find available feature flags and their key name [here](https://github.com/medusajs/medusa/tree/develop/packages/medusa/src/loaders/feature-flags). * You can find available feature flags and their key name [here](https://github.com/medusajs/medusa/tree/develop/packages/medusa/src/loaders/feature-flags).
* *
* @example * @example
* ```js title="medusa-config.js" * ```ts title="medusa-config.ts"
* module.exports = defineConfig({ * module.exports = defineConfig({
* featureFlags: { * featureFlags: {
* analytics: true, * analytics: true,