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

Merge pull request #35 from wailsapp/Make-Serve-command

Add helpful message after serving
This commit is contained in:
Lea Anthony 2019-01-31 18:59:37 +11:00 committed by GitHub
commit 243d738d64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 0 deletions

View File

@ -20,6 +20,7 @@ type frontend struct {
Install string `json:"install"`
Build string `json:"build"`
Bridge string `json:"bridge"`
Serve string `json:"serve"`
}
type framework struct {
@ -274,6 +275,7 @@ func (po *ProjectOptions) PromptForInputs() error {
}
po.FrontEnd.Build = templateMetadata["build"].(string)
}
if templateMetadata["bridge"] != nil {
if po.FrontEnd == nil {
return fmt.Errorf("bridge set in template metadata but not frontenddir")
@ -281,6 +283,13 @@ func (po *ProjectOptions) PromptForInputs() error {
po.FrontEnd.Bridge = templateMetadata["bridge"].(string)
}
if templateMetadata["serve"] != nil {
if po.FrontEnd == nil {
return fmt.Errorf("serve set in template metadata but not frontenddir")
}
po.FrontEnd.Serve = templateMetadata["serve"].(string)
}
return nil
}

View File

@ -7,5 +7,6 @@
"frontenddir": "frontend",
"install": "npm install",
"build": "npm run build",
"serve": "npm run serve",
"bridge": "src"
}

View File

@ -6,6 +6,7 @@ import (
"path"
"path/filepath"
"runtime"
"time"
"github.com/leaanthony/slicer"
"github.com/leaanthony/spinner"
@ -216,6 +217,10 @@ func init() {
// Run the App
logger.Yellow("Awesome! Project '%s' built!", projectOptions.Name)
go func() {
time.Sleep(2 * time.Second)
logger.Green(">>>>> To connect, you will need to run '" + projectOptions.FrontEnd.Serve + "' in the '" + projectOptions.FrontEnd.Dir + "' directory <<<<<")
}()
logger.Yellow("Serving Application: " + projectOptions.BinaryName)
cmd := exec.Command(projectOptions.BinaryName)
cmd.Stdout = os.Stdout