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:
Kasper Fabricius Kristensen
2023-08-17 14:14:45 +02:00
committed by GitHub
parent 26c78bbc03
commit f1a05f4725
189 changed files with 14570 additions and 12773 deletions

View File

@@ -1,47 +1,34 @@
import { Command } from "commander"
import build from "./build"
import dev from "./dev"
import eject from "./eject"
import { bundle } from "./bundle"
import develop from "./develop"
export async function createCli(): Promise<Command> {
const program = new Command()
const buildCommand = program.command("build")
buildCommand.description("Build the admin dashboard")
program
.command("bundle")
.description("Bundle extensions to the admin dashboard")
.action(bundle)
buildCommand.option(
"--deployment",
"Build for deploying to and external host (e.g. Vercel)"
)
program
.command("develop")
.description("Start the admin dashboard in development mode")
.option("--port <port>", "Port to run the admin dashboard on")
.option("--path <path>", "Public path to serve the admin dashboard on")
.option("--backend <url>", "URL to the Medusa backend")
.action(develop)
buildCommand.option("-o, --out-dir <path>", "Output directory")
buildCommand.option("-b, --backend <url>", "Backend URL")
buildCommand.option(
"-i, --include [paths...]]",
"Paths to files that should be included in the build"
)
buildCommand.option(
"-d, --include-dist <path>",
"Path to where the files specified in the include option should be placed. Relative to the root of the build directory."
)
buildCommand.action(build)
const devCommand = program.command("dev")
devCommand.description("Start the admin dashboard in development mode")
devCommand.option("-p, --port <port>", "Port (default: 7001))")
devCommand.option(
"-b, --backend <url>",
"Backend URL (default http://localhost:9000)"
)
devCommand.action(dev)
const deployCommand = program.command("eject")
deployCommand.description(
"Eject the admin dashboard source code to a custom directory"
)
deployCommand.option("-o, --out-dir <path>", "Output directory")
deployCommand.action(eject)
program
.command("build")
.description("Build the admin dashboard for production")
.option("--path <path>", "Public path to serve the admin dashboard on")
.option("--backend <url>", "URL to the Medusa backend")
.option(
"--deployment",
"Build the admin dashboard for deployment to an exernal host"
)
.action(build)
return program
}