couple of fixes
This commit is contained in:
parent
22a9ef8659
commit
6b4ccf7604
3 changed files with 15 additions and 0 deletions
|
|
@ -17,6 +17,12 @@ func HasFileFromRoot(file string) bool {
|
|||
return err == nil
|
||||
}
|
||||
|
||||
func CreateDirFromRoot(dir string) error {
|
||||
cwd := process.GetWorkingDir()
|
||||
path := filepath.Join(cwd, dir)
|
||||
return os.MkdirAll(path, 0700)
|
||||
}
|
||||
|
||||
func CopyDir(srcDir, dstDir string, predicate func(path string, exists bool) bool) error {
|
||||
// Walk the source directory tree.
|
||||
return filepath.Walk(srcDir, func(srcPath string, info os.FileInfo, err error) error {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"github.com/maddalax/htmgo/cli/htmgo/internal"
|
||||
"github.com/maddalax/htmgo/cli/htmgo/internal/dirutil"
|
||||
"github.com/maddalax/htmgo/cli/htmgo/tasks/astgen"
|
||||
"github.com/maddalax/htmgo/cli/htmgo/tasks/copyassets"
|
||||
"github.com/maddalax/htmgo/cli/htmgo/tasks/css"
|
||||
|
|
@ -56,6 +57,10 @@ func main() {
|
|||
slog.Debug("Running task:", slog.String("task", taskName))
|
||||
slog.Debug("working dir:", slog.String("dir", process.GetWorkingDir()))
|
||||
|
||||
if !dirutil.HasFileFromRoot("__htmgo") {
|
||||
dirutil.CreateDirFromRoot("__htmgo")
|
||||
}
|
||||
|
||||
if taskName == "watch" {
|
||||
fmt.Printf("Running in watch mode\n")
|
||||
os.Setenv("ENV", "development")
|
||||
|
|
|
|||
|
|
@ -90,6 +90,10 @@ func downloadTailwindCli() {
|
|||
filepath.Join(process.GetWorkingDir(), fileName),
|
||||
newPath)
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("Error moving file: %s\n", err.Error())
|
||||
}
|
||||
|
||||
if os != "windows" {
|
||||
err = process.Run(process.NewRawCommand("chmod-tailwind-cli",
|
||||
fmt.Sprintf(`chmod +x %s`, newPath),
|
||||
|
|
|
|||
Loading…
Reference in a new issue