feat(admin,admin-ui,medusa): Add Medusa Admin plugin (#3334)

This commit is contained in:
Kasper Fabricius Kristensen
2023-03-03 10:09:16 +01:00
committed by GitHub
parent d6b1ad1ccd
commit 40de54b010
928 changed files with 85441 additions and 384 deletions

View File

@@ -0,0 +1,32 @@
import { getConfigFile } from "medusa-core-utils"
import { ConfigModule, PluginOptions } from "../types"
export const loadConfig = () => {
const { configModule } = getConfigFile<ConfigModule>(
process.cwd(),
"medusa-config"
)
const plugin = configModule.plugins.find(
(p) =>
(typeof p === "string" && p === "@medusajs/admin") ||
(typeof p === "object" && p.resolve === "@medusajs/admin")
)
let defaultConfig: PluginOptions = {
serve: true,
path: "app",
}
if (typeof plugin !== "string") {
const { options } = plugin as { options: PluginOptions }
defaultConfig = {
serve: options.serve ?? defaultConfig.serve,
path: options.path ?? defaultConfig.path,
backend: options.backend ?? defaultConfig.backend,
outDir: options.outDir ?? defaultConfig.outDir,
}
}
return defaultConfig
}