panel — open-source game server manager (public release)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
// Command module-meta-dump loads ./modules via the same loader the
|
||||
// controller uses (module.LoadDir) and prints the WI-07 UI-metadata
|
||||
// enrichment as JSON — used by controller/.test/wi07-diff-maps.mjs to
|
||||
// prove the manifest-derived values match the dashboard's old inline
|
||||
// maps. Run from the repo root: go run ./tools/module-meta-dump
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
module "github.com/dbledeez/panel/pkg/module"
|
||||
)
|
||||
|
||||
type meta struct {
|
||||
ID string `json:"id"`
|
||||
Ports []module.Port `json:"ports,omitempty"`
|
||||
BrowseableRoots []module.BrowseableRoot `json:"browseable_roots,omitempty"`
|
||||
ReadyPattern string `json:"ready_pattern,omitempty"`
|
||||
Appearance *module.Appearance `json:"appearance,omitempty"`
|
||||
}
|
||||
|
||||
func main() {
|
||||
dir := "./modules"
|
||||
if len(os.Args) > 1 {
|
||||
dir = os.Args[1]
|
||||
}
|
||||
ms, err := module.LoadDir(dir)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "load:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
out := map[string]meta{}
|
||||
for _, m := range ms {
|
||||
e := meta{ID: m.ID, Ports: m.Ports, ReadyPattern: m.ReadyPattern, Appearance: m.Appearance}
|
||||
if m.Runtime.Docker != nil {
|
||||
e.BrowseableRoots = m.Runtime.Docker.BrowseableRoots
|
||||
}
|
||||
out[m.ID] = e
|
||||
}
|
||||
enc := json.NewEncoder(os.Stdout)
|
||||
enc.SetIndent("", " ")
|
||||
enc.Encode(out)
|
||||
}
|
||||
Reference in New Issue
Block a user