From 8a8844c6a35838956ce083d7e7f5b15fe65daf37 Mon Sep 17 00:00:00 2001 From: maddalax Date: Sat, 21 Sep 2024 13:20:34 -0500 Subject: [PATCH] woops --- cli/htmgo/runner.go | 14 ++++++-------- cli/htmgo/tasks/css/css.go | 7 +++++-- htmgo-site/Dockerfile | 1 - 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cli/htmgo/runner.go b/cli/htmgo/runner.go index dd6408d..25d31f6 100644 --- a/cli/htmgo/runner.go +++ b/cli/htmgo/runner.go @@ -54,9 +54,7 @@ func main() { slog.Debug("Running task:", slog.String("task", taskName)) slog.Debug("working dir:", slog.String("dir", process.GetWorkingDir())) - if taskName == "tailwind-cli" { - _ = css.DownloadTailwindCli() - } else if taskName == "watch" { + if taskName == "watch" { os.Setenv("ENV", "development") os.Setenv("WATCH_MODE", "true") copyassets.CopyAssets() @@ -71,18 +69,18 @@ func main() { }() startWatcher(reloader.OnFileChange) } else { - if taskName == "schema" { + if taskName == "tailwind-cli" { + css.DownloadTailwindCli() + } else if taskName == "schema" { reader := bufio.NewReader(os.Stdin) fmt.Print("Enter entity name:") text, _ := reader.ReadString('\n') text = strings.TrimSuffix(text, "\n") run.EntNewSchema(text) - } - if taskName == "generate" { + } else if taskName == "generate" { run.EntGenerate() astgen.GenAst(process.ExitOnError) - } - if taskName == "setup" { + } else if taskName == "setup" { run.Setup() } else if taskName == "css" { _ = css.GenerateCss(process.ExitOnError) diff --git a/cli/htmgo/tasks/css/css.go b/cli/htmgo/tasks/css/css.go index d151fd4..abc72e1 100644 --- a/cli/htmgo/tasks/css/css.go +++ b/cli/htmgo/tasks/css/css.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/maddalax/htmgo/cli/htmgo/tasks/process" "log" + "log/slog" "runtime" ) @@ -19,7 +20,7 @@ func GenerateCssWatch(flags ...process.RunFlag) error { }, append(flags, process.KillOnlyOnExit, process.Silent)...) } -func DownloadTailwindCli() error { +func DownloadTailwindCli() { distro := "" os := runtime.GOOS arch := runtime.GOARCH @@ -37,9 +38,11 @@ func DownloadTailwindCli() error { } fileName := fmt.Sprintf(`tailwindcss-%s`, distro) url := fmt.Sprintf(`https://github.com/tailwindlabs/tailwindcss/releases/latest/download/%s`, fileName) - return process.RunMany([]string{ + process.RunMany([]string{ fmt.Sprintf(`curl -LO %s`, url), fmt.Sprintf(`chmod +x %s`, fileName), fmt.Sprintf(`mv %s ./assets/css/tailwindcss`, fileName), }, process.ExitOnError) + + slog.Debug("Successfully downloaded Tailwind CLI", slog.String("url", url)) } diff --git a/htmgo-site/Dockerfile b/htmgo-site/Dockerfile index 719e64f..09f66da 100644 --- a/htmgo-site/Dockerfile +++ b/htmgo-site/Dockerfile @@ -18,7 +18,6 @@ RUN go mod download COPY . . # Build the Go binary for Linux -RUN GOPRIVATE=github.com/maddalax LOG_LEVEL=debug go run github.com/maddalax/htmgo/cli/htmgo@latest tailwind-cli RUN GOPRIVATE=github.com/maddalax LOG_LEVEL=debug go run github.com/maddalax/htmgo/cli/htmgo@latest build # Stage 2: Create the smallest possible image