copy assets on run if needed

This commit is contained in:
maddalax 2024-10-24 08:51:06 -05:00
parent 7af750b9e7
commit df490ae04b
3 changed files with 7 additions and 11 deletions

View file

@ -106,8 +106,7 @@ func main() {
} else if taskName == "ast" { } else if taskName == "ast" {
_ = astgen.GenAst(process.ExitOnError) _ = astgen.GenAst(process.ExitOnError)
} else if taskName == "run" { } else if taskName == "run" {
_ = astgen.GenAst(process.ExitOnError) run.MakeBuildable()
_ = css.GenerateCss(process.ExitOnError)
_ = run.Server(process.ExitOnError) _ = run.Server(process.ExitOnError)
} else if taskName == "template" { } else if taskName == "template" {
name := "" name := ""

View file

@ -9,10 +9,14 @@ import (
"os" "os"
) )
func Build() { func MakeBuildable() {
copyassets.CopyAssets() copyassets.CopyAssets()
astgen.GenAst(process.ExitOnError) astgen.GenAst(process.ExitOnError)
css.GenerateCss(process.ExitOnError) css.GenerateCss(process.ExitOnError)
}
func Build() {
MakeBuildable()
process.RunOrExit(process.NewRawCommand("", "mkdir -p ./dist")) process.RunOrExit(process.NewRawCommand("", "mkdir -p ./dist"))

View file

@ -1,19 +1,12 @@
package run package run
import ( import (
"github.com/maddalax/htmgo/cli/htmgo/tasks/astgen"
"github.com/maddalax/htmgo/cli/htmgo/tasks/copyassets"
"github.com/maddalax/htmgo/cli/htmgo/tasks/css"
"github.com/maddalax/htmgo/cli/htmgo/tasks/process" "github.com/maddalax/htmgo/cli/htmgo/tasks/process"
) )
func Setup() { func Setup() {
process.RunOrExit(process.NewRawCommand("", "go mod download")) process.RunOrExit(process.NewRawCommand("", "go mod download"))
process.RunOrExit(process.NewRawCommand("", "go mod tidy")) process.RunOrExit(process.NewRawCommand("", "go mod tidy"))
MakeBuildable()
copyassets.CopyAssets()
astgen.GenAst(process.ExitOnError)
css.GenerateCss(process.ExitOnError)
EntGenerate() EntGenerate()
} }