From 11d50c32bd5b2b9b37b7fd7d4fd4353cc111b614 Mon Sep 17 00:00:00 2001 From: stffabi Date: Mon, 25 Jul 2022 14:03:39 +0200 Subject: [PATCH] [dev] Ignore empty install command, we also do ignore it during the build step (#1651) Otherwise we can't use `wails dev` for projects where `wails build` works, e.g. on the plain template. --- v2/cmd/wails/internal/commands/dev/dev.go | 37 +++++++++++------------ 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/v2/cmd/wails/internal/commands/dev/dev.go b/v2/cmd/wails/internal/commands/dev/dev.go index 24eb8a24..b17b7d43 100644 --- a/v2/cmd/wails/internal/commands/dev/dev.go +++ b/v2/cmd/wails/internal/commands/dev/dev.go @@ -4,7 +4,6 @@ import ( "context" "errors" "fmt" - "github.com/bitfield/script" "io" "net" "net/http" @@ -20,6 +19,7 @@ import ( "syscall" "time" + "github.com/bitfield/script" "github.com/google/shlex" "github.com/wailsapp/wails/v2/cmd/wails/internal" "github.com/wailsapp/wails/v2/internal/gomod" @@ -187,25 +187,22 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error { exitCodeChannel := make(chan int, 1) // Install if needed - installCommand := projectConfig.GetDevInstallerCommand() - if installCommand == "" { - return fmt.Errorf("no `frontend:dev` or `frontend:install` defined. Please add one of these to your wails.json") - } - - // Install initial frontend dev dependencies - err = os.Chdir(filepath.Join(cwd, "frontend")) - if err != nil { - return err - } - LogGreen("Installing frontend dependencies...") - pipe := script.Exec(installCommand) - pipe.Wait() - if pipe.Error() != nil { - return pipe.Error() - } - err = os.Chdir(cwd) - if err != nil { - return err + if installCommand := projectConfig.GetDevInstallerCommand(); installCommand != "" { + // Install initial frontend dev dependencies + err = os.Chdir(filepath.Join(cwd, "frontend")) + if err != nil { + return err + } + LogGreen("Installing frontend dependencies...") + pipe := script.Exec(installCommand) + pipe.Wait() + if pipe.Error() != nil { + return pipe.Error() + } + err = os.Chdir(cwd) + if err != nil { + return err + } } // frontend:dev:watcher command.