Files
lst/controller/build_v2app.go

26 lines
570 B
Go

package main
import (
"os"
"os/exec"
"path/filepath"
)
// ---- Run npm build ----
func runNpmV2Build() error {
cmd := exec.Command("npm", "run", "newBuild")
if os.Getenv("RUNNING_IN_DOCKER") == "true" {
cmd.Dir = "/app"
}else {
// Go three directories up from the current working directory
cwd, err := os.Getwd()
if err != nil {
return err
}
dir := filepath.Join(cwd, "..", "..", "lstV2")
cmd.Dir = dir
}
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
}