docs: update imports and package names across docs (#9375)

* docs: update imports and package names across docs
+ reference configs

* generate files

* fix import

* change preview to rc
This commit is contained in:
Shahed Nasser
2024-10-01 11:03:42 +02:00
committed by GitHub
parent c726ed54f5
commit 2e16949979
196 changed files with 1379 additions and 1491 deletions
@@ -16,11 +16,11 @@ Start by creating a new directory for your module. For example, `src/modules/my-
Create the file `src/modules/my-event/service.ts` that holds the implementation of the event service.
The Event Module's main service must extend the `AbstractEventBusModuleService` class imported from `@medusajs/utils`:
The Event Module's main service must extend the `AbstractEventBusModuleService` class imported from `@medusajs/framework/utils`:
```ts title="src/modules/my-event/service.ts"
import { EmitData, Message } from "@medusajs/types"
import { AbstractEventBusModuleService } from "@medusajs/utils"
import { EmitData, Message } from "@medusajs/framework/types"
import { AbstractEventBusModuleService } from "@medusajs/framework/utils"
class MyEventService extends AbstractEventBusModuleService {
emit<T>(eventName: string, data: T, options: Record<string, unknown>): Promise<void>;
@@ -90,7 +90,7 @@ Create the file `src/modules/my-event/index.ts` with the following content:
```ts title="src/modules/my-event/index.ts"
import MyEventService from "./service"
import { Module } from "@medusajs/utils"
import { Module } from "@medusajs/framework/utils"
export default Module("my-event", {
service: MyEventService,
@@ -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"
const { Modules } = require("@medusajs/utils")
const { Modules } = require("@medusajs/framework/utils")
// ...
@@ -12,30 +12,18 @@ For production, its recommended to use modules like [Redis Event Bus Module](
---
## Install the Local Event Bus Module
## Register the Local Event Bus Module
<Note>
The Local Event Bus Module is installed by default in your application.
The Local Event Bus Module is registered by default in your application.
</Note>
To install Local Event Bus Module, run the following command in the directory of your Medusa application:
```bash npm2yarn
npm install @medusajs/event-bus-local@preview
```
<Note>
Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future.
</Note>
Next, 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.js`:
```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils")
const { Modules } = require("@medusajs/framework/utils")
// ...
@@ -14,7 +14,7 @@ In production, it's recommended to use this module.
---
## Install the Redis Events Bus Module
## Register the Redis Events Bus Module
<Prerequisites items={[
{
@@ -23,26 +23,14 @@ In production, it's recommended to use this module.
}
]} />
To install Redis Event Bus Module, run the following command in the directory of your Medusa application:
```bash npm2yarn
npm install @medusajs/event-bus-redis@preview
```
<Note>
Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future.
</Note>
Next, 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.js`:
export const highlights = [
["11", "redisUrl", "The Redis connection URL."]
]
```js title="medusa-config.js"
const { Modules } = require("@medusajs/utils")
const { Modules } = require("@medusajs/framework/utils")
// ...
@@ -50,7 +38,7 @@ module.exports = defineConfig({
// ...
modules: {
[Modules.EVENT_BUS]: {
resolve: "@medusajs/event-bus-redis",
resolve: "@medusajs/medusa/event-bus-redis",
options: {
redisUrl: process.env.EVENTS_REDIS_URL,
},