feat(admin): Improve DX for deploying admin externally (#3418)

* init deploy command

* add include flag

* add 'shortcut' flag

* add dev command, fix var replacement, change default behaviour

* cleanup params of build command

* fix defaults when using the plugin to serve admin

* add changeset

* fix globals

* update README

* throw error on no build found

---------

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Kasper Fabricius Kristensen
2023-03-17 13:18:51 +01:00
committed by GitHub
parent 9ad15d3a88
commit 8a7421db5b
20 changed files with 358 additions and 85 deletions

View File

@@ -15,6 +15,7 @@ export const loadConfig = () => {
let defaultConfig: PluginOptions = {
serve: true,
autoRebuild: false,
path: "app",
}
@@ -22,8 +23,8 @@ export const loadConfig = () => {
const { options } = plugin as { options: PluginOptions }
defaultConfig = {
serve: options.serve ?? defaultConfig.serve,
autoRebuild: options.autoRebuild ?? defaultConfig.autoRebuild,
path: options.path ?? defaultConfig.path,
backend: options.backend ?? defaultConfig.backend,
outDir: options.outDir ?? defaultConfig.outDir,
}
}

View File

@@ -1,4 +1,8 @@
export const validatePath = (path: string) => {
export const validatePath = (path?: string) => {
if (!path) {
return
}
if (path.startsWith("/")) {
throw new Error(`Path cannot start with a slash.`)
}