docs: create docs workspace (#5174)

* docs: migrate ui docs to docs universe

* created yarn workspace

* added eslint and tsconfig configurations

* fix eslint configurations

* fixed eslint configurations

* shared tailwind configurations

* added shared ui package

* added more shared components

* migrating more components

* made details components shared

* move InlineCode component

* moved InputText

* moved Loading component

* Moved Modal component

* moved Select components

* Moved Tooltip component

* moved Search components

* moved ColorMode provider

* Moved Notification components and providers

* used icons package

* use UI colors in api-reference

* moved Navbar component

* used Navbar and Search in UI docs

* added Feedback to UI docs

* general enhancements

* fix color mode

* added copy colors file from ui-preset

* added features and enhancements to UI docs

* move Sidebar component and provider

* general fixes and preparations for deployment

* update docusaurus version

* adjusted versions

* fix output directory

* remove rootDirectory property

* fix yarn.lock

* moved code component

* added vale for all docs MD and MDX

* fix tests

* fix vale error

* fix deployment errors

* change ignore commands

* add output directory

* fix docs test

* general fixes

* content fixes

* fix announcement script

* added changeset

* fix vale checks

* added nofilter option

* fix vale error
This commit is contained in:
Shahed Nasser
2023-09-21 20:57:15 +03:00
committed by GitHub
parent 19c5d5ba36
commit fa7c94b4cc
3209 changed files with 32188 additions and 31018 deletions

View File

@@ -0,0 +1,70 @@
---
description: 'In this document, youll learn about the in-memory cache module and how you can install it in your Medusa backend.'
---
# In-Memory Cache Module
In this document, youll learn about the in-memory cache module and how you can install it in your Medusa backend.
## Overview
Medusas modular architecture allows developers to extend or completely replace the logic used for caching. You can create a custom module, or you can use the modules Medusa provides.
Medusas default starter project uses the in-memory cache module. The in-memory cache module uses a plain JavaScript Map object to store the cache data.
This module is helpful for development or when youre testing out Medusa, but its not recommended to be used in production. For production, its recommended to use modules like [Redis Cache Module](./redis.md).
This document will guide you through installing the in-memory cache module.
---
## Prerequisites
### Medusa Backend
Its assumed you already have a Medusa backend installed. If not, you can learn how to install it by following [this guide](../../backend/install.mdx).
---
## Step 1: Install the Module
In the root directory of your Medusa backend, install the in-memory cache module with the following command:
```bash npm2yarn
npm install @medusajs/cache-inmemory
```
---
## Step 2: Add Configuration
In `medusa-config.js`, add the following to the exported object:
```js title=medusa-config.js
module.exports = {
// ...
modules: {
// ...
cacheService: {
resolve: "@medusajs/cache-inmemory",
options: {
ttl: 30,
},
},
},
}
```
This registers the in-memory cache module as the main cache service to use. You pass it the option `ttl`. This means time-to-live, and it indicates the number of seconds an item can live in the cache before its removed.
---
## Step 3: Test Module
To test the module, run the following command to start the Medusa backend:
```bash npm2yarn
npx medusa develop
```
The backend should then start with no errors, indicating that the module was installed successfully.

View File

@@ -0,0 +1,92 @@
---
description: 'In this document, youll learn about the Redis cache module and how you can install it in your Medusa backend.'
---
# Redis Cache Module
In this document, youll learn about the Redis cache module and how you can install it in your Medusa backend.
## Overview
Medusas modular architecture allows developers to extend or replace the logic used for [caching](../overview.mdx). You can create a custom module, or you can use the modules Medusa provides.
One of these modules is the Redis module. This module allows you to utilize Redis for the caching functionality. This document will you guide you through installing the Redis module.
---
## Prerequisites
### Medusa Backend
Its assumed you already have a Medusa backend installed. If not, you can learn how to install it by following [this guide](../../backend/install.mdx).
### Redis
You must have Redis installed and configured in your Medusa backend. You can learn how to install it from the [Redis documentation](https://redis.io/docs/getting-started/installation/).
---
## Step 1: Install the Module
In the root directory of your Medusa backend, install the Redis cache module with the following command:
```bash npm2yarn
npm install @medusajs/cache-redis
```
---
## Step 2: Add Environment Variable
The Redis cache module requires a connection URL to Redis as part of its options. If you dont already have an environment variable set for a Redis URL, make sure to add one:
```bash
CACHE_REDIS_URL=<YOUR_REDIS_URL>
```
Where `<YOUR_REDIS_URL>` is a connection URL to your Redis instance.
---
## Step 3: Add Configuration
In `medusa-config.js`, add the following to the exported object:
```js title=medusa-config.js
module.exports = {
// ...
modules: {
// ...
cacheService: {
resolve: "@medusajs/cache-redis",
options: {
redisUrl: process.env.CACHE_REDIS_URL,
ttl: 30,
},
},
},
}
```
This registers the Redis cache module as the main cache service to use. In the options, you pass `redisUrl` with the value being the environment variable you set. You also pass the option `ttl`. This means time-to-live, and it indicates the number of seconds an item can live in the cache before its removed.
Other available options include:
- `redisOptions`: an object containing options for the Redis instance. You can learn about available options in [io-rediss documentation](https://luin.github.io/ioredis/index.html#RedisOptions). By default, its an empty object.
- `namespace`: a string used to prefix event keys. By default, it's `medusa`.
---
## Step 4: Test Module
To test the module, run the following command to start the Medusa backend:
```bash npm2yarn
npx medusa develop
```
If the module was installed successfully, you should see the following message in the logs:
```bash noCopy noReport
Connection to Redis in module 'cache-redis' established
```