This commit is contained in:
maddalax 2024-09-21 13:20:34 -05:00
parent f482f8f88a
commit 8a8844c6a3
3 changed files with 11 additions and 11 deletions

View file

@ -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)

View file

@ -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))
}

View file

@ -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