Skip to content

Commit

Permalink
Adds webpack-dev-server to houndd --dev
Browse files Browse the repository at this point in the history
  • Loading branch information
despeset committed Jul 20, 2018
1 parent b70a5e1 commit ddd39c7
Show file tree
Hide file tree
Showing 4 changed files with 2,563 additions and 1,346 deletions.
20 changes: 18 additions & 2 deletions cmds/houndd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import (
"log"
"net/http"
"os"
"os/exec"
"os/signal"
"path/filepath"
"runtime"
"strings"
"syscall"
Expand All @@ -20,8 +22,10 @@ import (
const gracefulShutdownSignal = syscall.SIGTERM

var (
info_log *log.Logger
error_log *log.Logger
info_log *log.Logger
error_log *log.Logger
_, b, _, _ = runtime.Caller(0)
basepath = filepath.Dir(b)
)

func makeSearchers(cfg *config.Config) (map[string]*searcher.Searcher, bool, error) {
Expand Down Expand Up @@ -144,6 +148,18 @@ func main() {
host = "localhost" + host
}

if *flagDev {
info_log.Printf("[DEV] starting webpack-dev-server at localhost:8080...")
webpack := exec.Command("./node_modules/.bin/webpack-dev-server", "--mode", "development")
webpack.Dir = basepath + "/../../"
webpack.Stdout = os.Stdout
webpack.Stderr = os.Stderr
err = webpack.Start()
if err != nil {
error_log.Println(err)
}
}

info_log.Printf("running server at http://%s...\n", host)

if err := runHttp(*flagAddr, *flagDev, &cfg, idx); err != nil {
Expand Down
Loading

0 comments on commit ddd39c7

Please sign in to comment.