package main

// Thin CLI wrapper around kjol/jsbundler. The bundler wires its own Go-native
// Solid JSX compiler (see jsbundler.Build), so this wrapper carries no build logic.

import (
	"flag"
	"fmt"
	"os"

	"kjol/jsbundler"
)

func main() {
	app := flag.String("app", "frontend", "App frontend source root (relative to cwd).")
	web := flag.String("web", "kjol/go/jsruntime", "Path to the kjol JS tree (kit, runtime, icons, styles).")
	out := flag.String("out", "wwwroot", "Build output directory.")
	genGo := flag.String("gen-go", "internal/handlers", "Directory for generated Go files.")
	genTS := flag.String("gen-ts", "", "Directory for the generated TS icon registry (default <app>/src/ui/generated).")
	flag.Parse()

	cfg := jsbundler.Config{
		AppFrontend: *app,
		WebDir:      *web,
		Output:      *out,
		GenGoDir:    *genGo,
		GenTSDir:    *genTS,
	}
	if err := jsbundler.Build(cfg); err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
}
