docs: added upgrade guide for admin (#2816)

This commit is contained in:
Shahed Nasser
2022-12-16 11:26:30 +02:00
committed by GitHub
parent e5e13cc40e
commit f2cb0cf683
5 changed files with 85 additions and 2 deletions

View File

@@ -0,0 +1,57 @@
---
description: 'Actions Required for Vite Update'
---
# Updating Medusa Admin from Gatsby to Vite
Medusa Admin has been updated to Vite. Learn about breaking changes since the update.
## Overview
Medusa Admin previously was built using Gatsby. As of a recent update, the Admin is now migrated to Vite 3.
This introduced breaking changes related to environment variables used and the published directory. Read below for actions required following this update.
## Required Node.js Version
<!-- vale docs.Numbers = NO -->
Following the change to Vite 3, the required Node.js version for the Admin has changed. [Vite 3](https://vitejs.dev/guide/#scaffolding-your-first-vite-project) requires versions 14.8+ or 16+ of Node.js.
<!-- vale docs.Numbers = YES -->
## Changed Environment Variables
Previously, the Medusa Admin used the environment variables `GATSBY_MEDUSA_BACKEND_URL` or `GATSBY_STORE_URL` to store the Medusa servers URL.
After the update to Vite, the environment variable name changed to `MEDUSA_BACKEND_URL`.
The Medusa admin remains backward compatible, which means you can still use the same environment variables. However, it is advised to make the change to the new variable.
### Actions Required
Change your `GATSBY_MEDUSA_BACKEND_URL` or `GATSBY_STORE_URL` environment variables to be `MEDUSA_BACKEND_URL`:
```bash
MEDUSA_BACKEND_URL=<YOUR_MEDUSA_SERVER_URL>
```
## Changed Publish Directory
Previously, the build output of the Medusa Admin was placed in the `dist` directory. After this update, the build output is placed in the `public` directory.
For local usage and development, this shouldnt have an effect. However, this is a breaking change if you deployed Medusa admin.
### Actions Required
If you deployed your Medusa admin, you must change the Publish directory in your hosting.
For Netlify, you can do that by following these steps:
1. On your Medusa admin dashboard, click on “Site settings”.
2. From the sidebar, choose “Build & deploy”.
3. Find the “Build settings” section and click on the “Edit settings” button.
4. Change the “Publish directory” field to `public`.
5. Click on the Save button.
This should trigger a new deployment of your Medusa admin. If not, you must redeploy it manually for changes to take effect.

View File

@@ -1,8 +1,19 @@
---
hide_table_of_contents: true
---
import DocCardList from '@theme/DocCardList';
import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
import filterListItems from '@site/src/utils/filterListItems';
# Upgrade Guides
Find in this page the upgrade guides that require necessary steps when upgrading to a new version.
<DocCardList items={useCurrentSidebarCategory().items}/>
## Server
<DocCardList items={filterListItems(useCurrentSidebarCategory().items, /^(?!.*\/admin\/).*$/)}/>
## Admin
<DocCardList items={filterListItems(useCurrentSidebarCategory().items, /\/admin\//)}/>

View File

@@ -1,4 +1,5 @@
(?i)Medusa
(?i)Qovery
(?i)Netlify
(?i)s3
(?i)s3
(?i)vite

View File

@@ -199,6 +199,11 @@ module.exports = {
id: "advanced/backend/upgrade-guides/1-7-0",
label: "v1.7.0"
},
{
type: "doc",
id: "advanced/backend/upgrade-guides/admin/admin-vite",
label: "Medusa Admin: Vite"
},
]
},
{

View File

@@ -0,0 +1,9 @@
export default function filterListItems (items: any[], pathPattern: string | RegExp) {
if (!items.length) {
return items
}
let pattern = new RegExp(pathPattern)
return items.filter((item) => pattern.test(item.href))
}