docs: add documentation for v1.8 (#3669)

This commit is contained in:
Shahed Nasser authored and GitHub committed 2023-04-03 13:50:59 +02:00
1 parent 0cca13779d
commit c6bfad14d8
123 files changed
+7610 -2697

No files matched your search

@@ -0,0 +1,48 @@
---
description: "Migrate from the GitHub repository to the NPM package."
---
# Medusa Admin: 1.0.0
Medusa Admin has been moved from being hosted on a GitHub repository to being published as an NPM package that can be installed in the same project as the Medusa backend. This upgrade guide will help you find the right resources to make the upgrade.
:::note
If you made customizations to the admin and you want to preserve these customization, then it's recommended not to update to use the new admin plugin. You can learn more in [this section](#preserving-customizations-in-the-admin).
:::
## Overview
The Admin is now composed of two packages `@medusajs/admin` and `@medusajs/admin-ui`. The `@medusajs/admin` package is the plugin that can be installed in the Medusa server project. The `@medusajs/admin-ui` package is the UI that is served by the plugin.
This guide will cover three cases where the move might affect your current setup:
- Updating your existing project to use the plugin
- Replacing your already deployed admin with the plugin
- Preserving customizations in the plugin
## Actions required
### Updating your existing project to use the plugin
As mentioned, Medusa Admin is now distributed via NPM and installed as a plugins. To replace your existing admin, you first need to install the plugin in your Medusa server project.
Follow the [admin quickstart guide](../../admin/quickstart.mdx) to learn how to set up the plugin with the Medusa backend.
### Deploy the New Admin Plugin
The move to an NPM package has implications for the workflow to deploy the Admin. The plugin offers to ways to deploy the admin, either by serving the Admin directly from the Medusa server, or by deploying the Admin to a separate hosting platform.
To host the Admin directly from your Medusa server, you can follow the [Admin Quickstart Guide](../../admin/quickstart.mdx).
You can learn how to deploy the Admin to a host through the [Vercel Deployment Guide](../../deployments/admin/deploying-on-vercel.md). The process is similar for other Git based hosting platforms.
### Preserving Customizations in the Admin
If you have made customizations to the Admin, it is recommend that you keep your current setup and wait for the next minor release of Medusa Admin, that will introduce a more seamless way to extend the UI. Migrating customizations to the new admin plugin is not supported, and will require manaully patching any changes or forking the Admin plugin. The current Admin repository will still receive critical bug fixes while in maintenance, but it will not be updated with new features. If you can forego the latest features introduced in 1.8 you can continue to use the standalone admin repository for now.
While it's generally not recommended, if you want to maintain your customizations while upgrading to the latest version of Medusa Admin, you have two options:
1. Fork the @medusajs/admin plugin and @medusajs/admin-ui, and manually patch in your customizations.
2. Use the medusa-admin eject -o <output_directory> command to eject the Admin UI from the plugin and use it as a separate project. This way, you can make your customizations and deploy them to a separate hosting platform.
+2 -2
View File
@@ -22,8 +22,8 @@ Find in this page the upgrade guides that require necessary steps when upgrading
item={getFirstCategoryItem('Medusa React')}
/>
## Admin
## Admin Dashboard
<DocCard
item={getFirstCategoryItem('Medusa Admin')}
item={getFirstCategoryItem('Admin Dashboard')}
/>
@@ -0,0 +1,89 @@
---
description: 'Actions required for v1.8'
sidebar_custom_props:
iconName: 'server-stack-solid'
---
# v1.8
Medusa v1.8 comes with many new features while introducing architectural changes contributing toward making Medusa more modular and portable to new, modern environments.
This has led to breaking changes and this document will guide you through the required actions.
Please note that by upgrading to v1.8 of Medusa, you must also upgrade your admin to become a plugin as explained in the [admin upgrade guide](../admin/1-0-0.md). If you've made customizations to your admin, please refer to [this section of the admin upgrade guide](../admin/1-0-0.md#preserving-customizations-in-the-admin) before considering updating to v1.8 of Medusa.
## Required Actions
:::note
It's recommended to use yarn when updating the following dependency to avoid any unexpected errors.
:::
### Step 1: Update Typeorm
To get started using Medusa v1.8, you first need to upgrade your version of Typeorm:
```bash
yarn add typeorm@0.3.11
```
The dependency on Typeorm has been upgraded from 0.2.31 to 0.3.11, which comes with significant breaking changes. Follow Typeorm's upgrade guide to refactor your custom code.
### Step 2: Update Core Package
Install version 1.8 of the core:
```bash
yarn add @medusajs/medusa@1.8.0
```
### Step 3: Install Required Modules
The core engine doesn't come with a Redis caching mechanism and Redis events system any longer. Instead the core relies on the Module API for those two sub-systems.
As a result, you are required to install and use those modules to ensure your application works as expected.
Install the new Redis cache module with the following command:
```bash
yarn add @medusajs/cache-redis@1.8.0
```
Install the new Redis event bus module with the following command:
```bash
yarn add @medusajs/event-bus-redis@1.8.0
```
Then, add both modules to the exported configuration in `medusa-config.js`.
```js title=medusa-config.js
module.exports = {
// ...
modules: {
eventBus: {
resolve: "@medusajs/event-bus-redis",
options: {
redisUrl: "your-redis-url",
},
},
cacheService: {
resolve: "@medusajs/cache-redis",
options: {
redisUrl: "your-redis-url",
},
},
},
}
```
Make sure to replace `your-redis-url` with the connection URL to your Redis installation.
### Step 4: Run Migrations
Finally, you should run migrations to ensure your database is up to date with our schema changes:
```bash
medusa migrations run
```
@@ -0,0 +1,5 @@
{
"position": 3,
"link": null,
"label": "Plugins"
}
@@ -0,0 +1,71 @@
---
description: 'Actions Required for v.1.0.0'
sidebar_label: 'v1.0.0'
---
# Algolia: v1.0.0
Version 1.0.0 of the official Algolia plugin comes with breaking changes to the plugin options that are passed to the Algolia service through `medusa-config.js`.
## Overview
In the new version of the Algolia search plugin, two new plugin configuration properties are introduced; `transformer` and `primaryKey`. As a result, the way indexes in Algolia are configured has changed. Additionally, the existing settings have been changed to follow a camel casing - though with backward compatibility.
---
## How to Update
Run the following command in the root directory of your Medusa Backend:
```bash npm2yarn
npm install medusa-plugin-algolia@1.0.0
```
---
## Actions required
As you can see from the new object shape, the property `indexSettings` has been introduced to hold the settings specific to Algolia’s index options. This has been done to make space for the `transformer`.
Previously, you might have configured the Algolia plugin as seen below:
```js title=medusa-config.js
const plugins = [
// ...
{
application_id: "someId",
admin_api_key: "someApiKey",
settings: {
// example
products: {
searchableAttributes: ["title", "description"],
attributesToRetrieve: ["title", "description"],
},
},
},
]
```
In the above example, an index `products` has been configured with two options `searchableAttributes` and `attributesToRetrieve`. Updating to v1.0.0 requires you to nest these within the `indexSettings`. Additionally, the admin API key and application ID options should now be in camel case, as the snake-cased version will be deprecated.
The updated plugin options would look like so:
```js title=medusa-config.js
const plugins = [
// ...
{
applicationId: "someId",
adminApiKey: "someApiKey",
settings: {
products: {
indexSettings: {
searchableAttributes: ["title", "description"],
attributesToRetrieve: ["title", "description"],
},
},
},
},
]
```
You can learn more about the new plugin options in the [Algolia plugin documentation](../../../plugins/search/algolia.md).
@@ -0,0 +1,6 @@
{
"label": "Algolia",
"customProps": {
"reverse": true
}
}
@@ -0,0 +1,74 @@
---
description: 'Actions Required for v.1.0.0'
sidebar_label: 'v1.0.0'
---
# Meilisearch: v1.0.0
Version 1.0.0 of the official Meilisearch plugin comes with breaking changes to the plugin options that are passed to the Meilisearch service through `medusa-config.js`.
## Overview
In the new version of the Meilisearch search plugin, two new plugin configuration properties are introduced; `transformer` and `primaryKey`. As a result, the way indexes in Meilisearch are configured has changed.
---
## How to Update
Run the following command in the root directory of your Medusa Backend:
```bash npm2yarn
npm install medusa-plugin-meilisearch@1.0.0
```
---
## Actions required
As you can see from the new object shape, the property `indexSettings` has been introduced to hold the settings specific to Meilisearch’s index options. This has been done to make space for new settings like `transformer` and `primaryKey`.
Previously, your Meilisearch plugin configurations were something like this:
```js title=medusa-config.js
const plugins = [
// ...
{
config: {
host: "https://search-api-example.com",
apiKey: "some_key",
},
settings: {
products: {
searchableAttributes: ["title", "description"],
attributesToRetrieve: ["title", "description"],
},
},
},
]
```
In the above example, an index `products` has been configured with the two options `searchableAttributes` and `attributesToRetrieve`. Updating to 1.0.0 requires you to nest these options within the `indexSettings`.
The updated plugin options would look like so:
```js
const plugins = [
// ...
{
config: {
host: "https://search-api-example.com",
apiKey: "some_key",
},
settings: {
products: {
indexSettings: {
searchableAttributes: ["title", "description"],
attributesToRetrieve: ["title", "description"],
},
},
},
},
]
```
You can learn more about the new settings in the [MeiliSearch plugin documentation](../../../plugins/search/meilisearch.md)
@@ -0,0 +1,6 @@
{
"label": "MeiliSearch",
"customProps": {
"reverse": true
}
}