Initial push
This commit is contained in:
+11
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="color-scheme" content="dark light" />
|
||||
<title>docker-migrate</title>
|
||||
<script type="module" crossorigin src="/assets/index-BJYzrqMo.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-BYoxln0e.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,35 @@
|
||||
// Package webui embeds the built web application into the binary so the tool
|
||||
// ships as a single file with no runtime assets to install.
|
||||
package webui
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
)
|
||||
|
||||
//go:embed all:dist
|
||||
var dist embed.FS
|
||||
|
||||
// FS returns the built web app rooted at its index.html, or nil when the
|
||||
// frontend has not been built into this binary.
|
||||
func FS() fs.FS {
|
||||
sub, err := fs.Sub(dist, "dist")
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
if _, err := fs.Stat(sub, "index.html"); err != nil {
|
||||
return nil
|
||||
}
|
||||
return sub
|
||||
}
|
||||
|
||||
// Built reports whether a real UI is embedded, as opposed to the placeholder
|
||||
// that keeps the package compiling before the frontend is built.
|
||||
func Built() bool {
|
||||
sub := FS()
|
||||
if sub == nil {
|
||||
return false
|
||||
}
|
||||
_, err := fs.Stat(sub, "assets")
|
||||
return err == nil
|
||||
}
|
||||
Reference in New Issue
Block a user