chore: Update admin build/serve configuration (#9584)

**Breaking changes**

The `outDir` has been deprecated and wont be used anymore, instead all the path are computed internally following these rules
- if admin is not `disabled` and the `build` command is run without the `--admin-only` flag, then the admin output dir will be `.medusa/server/public/admin` and it will be served from that same location from the medusa instance.
- if admin is not `disabled` and the `build` command is run with the `--admin-only` flag, then the admin output dir will be `.medusa/admin` with the purpose of deploying the admin separately. ⚠️ (expect to receive a warning log)
- if the admin is `disabled` and the `build` command is run with the `--admin-only` flag, then fallback to rule number 2

| admin enabled  | medusa build --admin-only  | output dir |
|---|---|---|
| true  | true  | `.medusa/admin` ⚠️ (expect to receive a warning log) |
| true  | false  | `.medusa/server/public/admin`  |
| false  | true  | `.medusa/admin`  |
| false  | false  | none |

```diff
// medusa-config.ts

{
  // ...
  admin: {
-    outDir: 'some/path'
  }
}
```


cc @kasperkristensen @sradevski @olivermrbl
This commit is contained in:
Adrien de Peretti
2024-10-15 17:59:47 +02:00
committed by GitHub
parent 4a03bdbb86
commit 84fa6ccde5
9 changed files with 95 additions and 48 deletions

View File

@@ -7,7 +7,6 @@ describe("defineConfig", function () {
{
"admin": {
"backendUrl": "http://localhost:9000",
"outDir": ".medusa/admin",
"path": "/app",
},
"featureFlags": {},
@@ -154,7 +153,6 @@ describe("defineConfig", function () {
{
"admin": {
"backendUrl": "http://localhost:9000",
"outDir": ".medusa/admin",
"path": "/app",
},
"featureFlags": {},
@@ -307,7 +305,6 @@ describe("defineConfig", function () {
{
"admin": {
"backendUrl": "http://localhost:9000",
"outDir": ".medusa/admin",
"path": "/app",
},
"featureFlags": {},
@@ -466,7 +463,6 @@ describe("defineConfig", function () {
{
"admin": {
"backendUrl": "http://localhost:9000",
"outDir": ".medusa/admin",
"path": "/app",
},
"featureFlags": {},
@@ -621,7 +617,6 @@ describe("defineConfig", function () {
{
"admin": {
"backendUrl": "http://localhost:9000",
"outDir": ".medusa/admin",
"path": "/app",
},
"featureFlags": {},
@@ -771,7 +766,6 @@ describe("defineConfig", function () {
{
"admin": {
"backendUrl": "http://localhost:9000",
"outDir": ".medusa/admin",
"path": "/app",
},
"featureFlags": {},

View File

@@ -90,7 +90,6 @@ export function defineConfig(config: Config = {}): ConfigModule {
*/
const admin: ConfigModule["admin"] = {
backendUrl: process.env.MEDUSA_BACKEND_URL || DEFAULT_ADMIN_URL,
outDir: ".medusa/admin",
path: "/app",
...config.admin,
}