From aa6b67734b690d49e6911971b6c33c2b8cfce200 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Tue, 8 Jan 2019 17:48:37 +1100 Subject: [PATCH] Initial Port Updated templates --- cmd/templates.go | 3 +-- cmd/templates/basic/go.mod.template | 1 + cmd/templates/basic/{main.go => main.go.template} | 9 +++++++-- cmd/templates/custom/go.mod.template | 1 + cmd/templates/custom/{main.go => main.go.template} | 9 +++++++-- .../frontend/{package.json => package.json.template} | 5 +++-- cmd/templates/vuewebpack/go.mod.template | 1 + cmd/templates/vuewebpack/{main.go => main.go.template} | 2 +- cmd/wails/3_build.go | 2 +- 9 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 cmd/templates/basic/go.mod.template rename cmd/templates/basic/{main.go => main.go.template} (60%) create mode 100644 cmd/templates/custom/go.mod.template rename cmd/templates/custom/{main.go => main.go.template} (58%) rename cmd/templates/vuewebpack/frontend/{package.json => package.json.template} (79%) create mode 100644 cmd/templates/vuewebpack/go.mod.template rename cmd/templates/vuewebpack/{main.go => main.go.template} (93%) diff --git a/cmd/templates.go b/cmd/templates.go index d206ee448..81f9d3d2f 100644 --- a/cmd/templates.go +++ b/cmd/templates.go @@ -10,8 +10,7 @@ import ( "path/filepath" "runtime" "strings" - - "github.com/alecthomas/template" + "text/template" ) const templateSuffix = ".template" diff --git a/cmd/templates/basic/go.mod.template b/cmd/templates/basic/go.mod.template new file mode 100644 index 000000000..5c2676020 --- /dev/null +++ b/cmd/templates/basic/go.mod.template @@ -0,0 +1 @@ +module {{.BinaryName}} \ No newline at end of file diff --git a/cmd/templates/basic/main.go b/cmd/templates/basic/main.go.template similarity index 60% rename from cmd/templates/basic/main.go rename to cmd/templates/basic/main.go.template index 269b1d396..965aa0c0f 100644 --- a/cmd/templates/basic/main.go +++ b/cmd/templates/basic/main.go.template @@ -4,7 +4,12 @@ import ( wails "github.com/wailsapp/wails" ) -var html = `

Basic Template

` +var html = ` +
+

Basic Template

+Welcome to your basic Wails app! +
+` func main() { @@ -12,7 +17,7 @@ func main() { app := wails.CreateApp(&wails.AppConfig{ Width: 1024, Height: 768, - Title: "My Project", + Title: "{{.Name}}", HTML: html, }) app.Run() diff --git a/cmd/templates/custom/go.mod.template b/cmd/templates/custom/go.mod.template new file mode 100644 index 000000000..5c2676020 --- /dev/null +++ b/cmd/templates/custom/go.mod.template @@ -0,0 +1 @@ +module {{.BinaryName}} \ No newline at end of file diff --git a/cmd/templates/custom/main.go b/cmd/templates/custom/main.go.template similarity index 58% rename from cmd/templates/custom/main.go rename to cmd/templates/custom/main.go.template index 5b6a0932f..d23e2cd9b 100644 --- a/cmd/templates/custom/main.go +++ b/cmd/templates/custom/main.go.template @@ -4,7 +4,12 @@ import ( wails "github.com/wailsapp/wails" ) -var html = `

Custom Project

` +var html = ` +
+

Custom

+Welcome to your basic Wails app with added CSS! +
+` func main() { @@ -12,7 +17,7 @@ func main() { app := wails.CreateApp(&wails.AppConfig{ Width: 800, Height: 600, - Title: "My Project", + Title: "{{.Name}}", HTML: html, }) app.Run() diff --git a/cmd/templates/vuewebpack/frontend/package.json b/cmd/templates/vuewebpack/frontend/package.json.template similarity index 79% rename from cmd/templates/vuewebpack/frontend/package.json rename to cmd/templates/vuewebpack/frontend/package.json.template index 7d05448d7..cbde6f6a7 100644 --- a/cmd/templates/vuewebpack/frontend/package.json +++ b/cmd/templates/vuewebpack/frontend/package.json.template @@ -1,5 +1,6 @@ { - "name": "frontend", + "name": "{{.NPMProjectName}}", + "author": "{{.Author.Name}}<{{.Author.Email}}>", "version": "0.1.0", "private": true, "scripts": { @@ -14,4 +15,4 @@ "@vue/cli-service": "^3.1.4", "vue-template-compiler": "^2.5.17" } -} +} \ No newline at end of file diff --git a/cmd/templates/vuewebpack/go.mod.template b/cmd/templates/vuewebpack/go.mod.template new file mode 100644 index 000000000..5c2676020 --- /dev/null +++ b/cmd/templates/vuewebpack/go.mod.template @@ -0,0 +1 @@ +module {{.BinaryName}} \ No newline at end of file diff --git a/cmd/templates/vuewebpack/main.go b/cmd/templates/vuewebpack/main.go.template similarity index 93% rename from cmd/templates/vuewebpack/main.go rename to cmd/templates/vuewebpack/main.go.template index 088100122..3390fc746 100644 --- a/cmd/templates/vuewebpack/main.go +++ b/cmd/templates/vuewebpack/main.go.template @@ -12,7 +12,7 @@ func main() { app := wails.CreateApp(&wails.AppConfig{ Width: 1024, Height: 768, - Title: "Vue Simple", + Title: "{{.Name}}", JS: assets.String("app.js"), CSS: assets.String("app.css"), }) diff --git a/cmd/wails/3_build.go b/cmd/wails/3_build.go index deb4282cd..2557ffb12 100644 --- a/cmd/wails/3_build.go +++ b/cmd/wails/3_build.go @@ -91,7 +91,7 @@ func init() { } // Check if frontend deps have been updated - buildSpinner.Start("Installing frontend dependencies...") + buildSpinner.Start("Installing frontend dependencies (This may take a while)...") requiresNPMInstall := true