feat(admin, admin-ui, medusa-js, medusa-react, medusa): Support Admin Extensions (#4761)
Co-authored-by: Rares Stefan <948623+StephixOne@users.noreply.github.com> Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
co-authored by
Rares Stefan
Oli Juhl
parent
26c78bbc03
commit
f1a05f4725
@@ -1,42 +1,2 @@
|
||||
import dns from "dns"
|
||||
import fse from "fs-extra"
|
||||
import { resolve } from "path"
|
||||
import vite from "vite"
|
||||
import { AdminBuildConfig } from "./types"
|
||||
import { AdminDevConfig } from "./types/dev"
|
||||
import { getCustomViteConfig, getCustomViteDevConfig } from "./utils"
|
||||
|
||||
async function build(options?: AdminBuildConfig) {
|
||||
const config = getCustomViteConfig(options)
|
||||
|
||||
await vite.build(config).catch((_err) => {
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
await fse.writeJSON(
|
||||
resolve(config.build.outDir, "build-manifest.json"),
|
||||
options
|
||||
)
|
||||
}
|
||||
|
||||
async function watch() {
|
||||
throw new Error("Not implemented")
|
||||
}
|
||||
|
||||
async function clean() {
|
||||
throw new Error("Not implemented")
|
||||
}
|
||||
|
||||
async function dev(options: AdminDevConfig) {
|
||||
// Resolve localhost for Node v16 and older.
|
||||
// @see https://vitejs.dev/config/server-options.html#server-host.
|
||||
dns.setDefaultResultOrder("verbatim")
|
||||
|
||||
const server = await vite.createServer(getCustomViteDevConfig(options))
|
||||
await server.listen()
|
||||
|
||||
server.printUrls()
|
||||
}
|
||||
|
||||
export { build, dev, watch, clean }
|
||||
export type { AdminBuildConfig, AdminDevConfig }
|
||||
export * from "./client"
|
||||
export * from "./node"
|
||||
|
||||
Reference in New Issue
Block a user