5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 20:03:01 +08:00

ignore frontend files when using wails serve

This commit is contained in:
Lea Anthony 2019-03-08 20:38:55 +11:00
parent 7f54ca4ac3
commit 24e4fbfb68
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405

View File

@ -5,11 +5,11 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"os/exec" "os/exec"
"path"
"path/filepath" "path/filepath"
"runtime" "runtime"
"time" "time"
mewn "github.com/leaanthony/mewn"
"github.com/leaanthony/slicer" "github.com/leaanthony/slicer"
"github.com/leaanthony/spinner" "github.com/leaanthony/spinner"
) )
@ -77,7 +77,13 @@ func BuildApplication(binaryName string, forceRebuild bool, buildMode string, pa
packSpinner.Start() packSpinner.Start()
buildCommand := slicer.String() buildCommand := slicer.String()
buildCommand.AddSlice([]string{"mewn", "build"}) buildCommand.Add("mewn")
if buildMode == BuildModeBridge {
// Ignore errors
buildCommand.Add("-i")
}
buildCommand.Add("build")
if binaryName != "" { if binaryName != "" {
buildCommand.Add("-o") buildCommand.Add("-o")
@ -240,10 +246,10 @@ func InstallFrontendDeps(projectDir string, projectOptions *ProjectOptions, forc
} }
// Copy bridge to project // Copy bridge to project
_, filename, _, _ := runtime.Caller(1) bridgeAssets := mewn.Group("../wailsruntimeassets/bridge/")
bridgeFileSource := filepath.Join(path.Dir(filename), "..", "..", "wailsruntimeassets", "bridge", bridgeFile) bridgeFileData := bridgeAssets.Bytes(bridgeFile)
bridgeFileTarget := filepath.Join(projectDir, projectOptions.FrontEnd.Dir, projectOptions.FrontEnd.Bridge, "wailsbridge.js") bridgeFileTarget := filepath.Join(projectDir, projectOptions.FrontEnd.Dir, projectOptions.FrontEnd.Bridge, "wailsbridge.js")
err = fs.CopyFile(bridgeFileSource, bridgeFileTarget) err = fs.CreateFile(bridgeFileTarget, bridgeFileData)
if err != nil { if err != nil {
return err return err
} }