Compare commits

...

6 Commits

Author SHA1 Message Date
Lea Anthony
2729081f2c [v2] v2.0.0-beta.8 2021-10-09 07:57:23 +11:00
Lea Anthony
cad1317fc8 [v2] Tags passthrough for wails generate module 2021-10-09 07:56:19 +11:00
Lea Anthony
1368c20029 [website] v2.0.0-beta.7 2021-10-09 00:06:39 +11:00
Lea Anthony
0acfdd1516 [website] v2.0.0-beta.6 2021-10-09 00:03:35 +11:00
Lea Anthony
212a20626a [website] Update go webview 2021-10-09 00:02:53 +11:00
Lea Anthony
722ecc969b [website] Update docs to v2.0.0-beta.5 2021-10-08 20:27:10 +11:00
11 changed files with 48 additions and 29 deletions

View File

@@ -120,7 +120,11 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
return err
}
err = runCommand(cwd, true, "wails", "generate", "module")
if flags.tags != "" {
err = runCommand(cwd, true, "wails", "generate", "module", "-tags", flags.tags)
} else {
err = runCommand(cwd, true, "wails", "generate", "module")
}
if err != nil {
return err
}
@@ -134,7 +138,7 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
buildOptions := generateBuildOptions(flags)
buildOptions.Logger = logger
buildOptions.UserTags = parseUserTags(flags.tags)
buildOptions.UserTags = internal.ParseUserTags(flags.tags)
var debugBinaryProcess *process.Process = nil
@@ -266,18 +270,6 @@ func generateBuildOptions(flags devFlags) *build.Options {
}
}
// parseUserTags takes the string form of tags and converts to a slice of strings
func parseUserTags(tagString string) []string {
userTags := make([]string, 0)
for _, tag := range strings.Split(tagString, " ") {
thisTag := strings.TrimSpace(tag)
if thisTag != "" {
userTags = append(userTags, thisTag)
}
}
return userTags
}
// loadAndMergeProjectConfig reconciles flags passed to the CLI with project config settings and updates
// the project config if necessary
func loadAndMergeProjectConfig(cwd string, flags *devFlags) (*project.Project, error) {

View File

@@ -2,17 +2,21 @@ package generate
import (
"github.com/leaanthony/clir"
"github.com/wailsapp/wails/v2/cmd/wails/internal"
"github.com/wailsapp/wails/v2/internal/shell"
"io"
"os"
"path/filepath"
"runtime"
"strings"
)
// AddModuleCommand adds the `module` subcommand for the `generate` command
func AddModuleCommand(app *clir.Cli, parent *clir.Command, w io.Writer) error {
command := parent.NewSubCommand("module", "Generate wailsjs modules")
var tags string
command.StringFlag("tags", "tags to pass to Go compiler (quoted and space separated)", &tags)
command.Action(func() error {
@@ -29,7 +33,10 @@ func AddModuleCommand(app *clir.Cli, parent *clir.Command, w io.Writer) error {
return err
}
_, _, err = shell.RunCommand(cwd, "go", "build", "-tags", "bindings", "-o", filename)
tagList := internal.ParseUserTags(tags)
tagList = append(tagList, "bindings")
_, _, err = shell.RunCommand(cwd, "go", "build", "-tags", strings.Join(tagList, ","), "-o", filename)
if err != nil {
return err
}

View File

@@ -0,0 +1,15 @@
package internal
import "strings"
// ParseUserTags takes the string form of tags and converts to a slice of strings
func ParseUserTags(tagString string) []string {
userTags := make([]string, 0)
for _, tag := range strings.Split(tagString, " ") {
thisTag := strings.TrimSpace(tag)
if thisTag != "" {
userTags = append(userTags, thisTag)
}
}
return userTags
}

View File

@@ -1,3 +1,3 @@
package internal
var Version = "v2.0.0-beta.5"
var Version = "v2.0.0-beta.8"

View File

@@ -21,7 +21,7 @@ require (
github.com/leaanthony/debme v1.2.1
github.com/leaanthony/go-ansi-parser v1.0.1
github.com/leaanthony/go-common-file-dialog v1.0.3
github.com/leaanthony/go-webview2 v0.0.0-20210928094513-a94a08b538bd
github.com/leaanthony/go-webview2 v0.0.0-20211007095229-b1759d2e4ec7
github.com/leaanthony/gosod v1.0.3
github.com/leaanthony/idgen v1.0.0
github.com/leaanthony/slicer v1.5.0

View File

@@ -117,6 +117,8 @@ github.com/leaanthony/go-common-file-dialog v1.0.3 h1:O0uGjKnWtdEADGrkg+TyAAbZyl
github.com/leaanthony/go-common-file-dialog v1.0.3/go.mod h1:TGhEc9eSJgRsupZ+iH1ZgAOnEo9zp05cRH2j08RPrF0=
github.com/leaanthony/go-webview2 v0.0.0-20210928094513-a94a08b538bd h1:6m4zZ/esiByaDbzgdvDxjsOaIDgtuG1q2cyhjAi6uAg=
github.com/leaanthony/go-webview2 v0.0.0-20210928094513-a94a08b538bd/go.mod h1:lS5ds4bruPk9d7lzdF/OH31Z0YCerI6MmHNFGsWoUnM=
github.com/leaanthony/go-webview2 v0.0.0-20211007095229-b1759d2e4ec7 h1:qw9f/UqPp2GQ318n8G0Ikawe8GRkdPpUNJMuYeeafGA=
github.com/leaanthony/go-webview2 v0.0.0-20211007095229-b1759d2e4ec7/go.mod h1:lS5ds4bruPk9d7lzdF/OH31Z0YCerI6MmHNFGsWoUnM=
github.com/leaanthony/gosod v1.0.3 h1:Fnt+/B6NjQOVuCWOKYRREZnjGyvg+mEhd1nkkA04aTQ=
github.com/leaanthony/gosod v1.0.3/go.mod h1:BJ2J+oHsQIyIQpnLPjnqFGTMnOZXDbvWtRCSG7jGxs4=
github.com/leaanthony/idgen v1.0.0 h1:IZreR+JGEzFV4yeVuBZA25gM0keUoFy+RDUldncQ+Jw=

View File

@@ -10,7 +10,7 @@ const basic string = `module changeme
go 1.17
require github.com/wailsapp/wails/v2 v2.0.0-beta.4
require github.com/wailsapp/wails/v2 v2.0.0-beta.8
require (
github.com/andybalholm/brotli v1.0.2 // indirect
@@ -44,7 +44,7 @@ require (
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
)
//replace github.com/wailsapp/wails/v2 v2.0.0-beta.4 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2
//replace github.com/wailsapp/wails/v2 v2.0.0-beta.8 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2
`
func TestGetWailsVersion(t *testing.T) {
@@ -54,7 +54,7 @@ func TestGetWailsVersion(t *testing.T) {
want *semver.Version
wantErr bool
}{
{"basic", []byte(basic), semver.MustParse("v2.0.0-beta.4"), false},
{"basic", []byte(basic), semver.MustParse("v2.0.0-beta.8"), false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -74,7 +74,7 @@ const basicUpdated string = `module changeme
go 1.17
require github.com/wailsapp/wails/v2 v2.0.0-beta.5
require github.com/wailsapp/wails/v2 v2.0.0-beta.8
require (
github.com/andybalholm/brotli v1.0.2 // indirect
@@ -108,7 +108,7 @@ require (
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
)
//replace github.com/wailsapp/wails/v2 v2.0.0-beta.4 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2
//replace github.com/wailsapp/wails/v2 v2.0.0-beta.8 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2
`
func TestUpdateGoModVersion(t *testing.T) {
@@ -122,7 +122,7 @@ func TestUpdateGoModVersion(t *testing.T) {
want []byte
wantErr bool
}{
{"basic", args{[]byte(basic), "v2.0.0-beta.5"}, []byte(basicUpdated), false},
{"basic", args{[]byte(basic), "v2.0.0-beta.8"}, []byte(basicUpdated), false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

View File

@@ -62,7 +62,7 @@ import TabItem from "@theme/TabItem";
## Installing Wails
Run `go install github.com/wailsapp/wails/v2/cmd/wails@v2.0.0-beta.4` to install the Wails CLI.
Run `go install github.com/wailsapp/wails/v2/cmd/wails@v2.0.0-beta.8` to install the Wails CLI.
## System Check

View File

@@ -133,9 +133,10 @@ Your system is ready for Wails development!
| -v | Verbosity level (0 - silent, 1 - standard, 2 - verbose) | 1 |
| -wailsjsdir | The directory to generate the generated Wails JS modules | Value in `wails.json` |
| -debounce | The time to wait for reload after an asset change is detected | 100 (milliseconds) |
| -devserverurl "url" | Use 3rd party dev server url, EG Vite | "http://localhost:34115" |
If the `-assetdir` or `-wailsjsdir` flags are provided on the command line, they are saved in `wails.json`, and become
the defaults for subsequent invocations.
If the `assetdir`, `wailsjsdir`, `debounce` or `devserverurl` flags are provided on the command line, they are saved in
`wails.json`, and become the defaults for subsequent invocations.
Example:

View File

@@ -12,14 +12,16 @@ The project config resides in the `wails.json` file in the project directory. Th
"assetdir": "[Relative path to your assets directory]",
"frontend:install": "[The command to install node dependencies, run in the frontend directory - often `npm install`]",
"frontend:build": "[The command to build the assets, run in the frontend directory - often `npm run build`]",
"frontend:dev": "[This command is run in a separate process on `wails dev`. Useful for 3rd party watchers]",
"wailsjsdir": "[Relative path to the directory that the auto-generated JS modules will be created]",
"version": "[Project config version]",
"outputfilename": "[The name of the binary]",
"debounceMS": 100, // The default time the dev server waits to reload when it detects a vhange in assets
"devserverurl": "[URL to the dev server serving local assets. Default: http://localhost:34115]"
}
```
This file is read by the Wails CLI when running `wails build` or `wails dev`.
The `assetdir` and `wailsjsdir` flags in `wails build/dev` will update the project config and thus become defaults for
subsequent runs.
The `assetdir`, `wailsjsdir`, `debounceMS` and `devserverurl` flags in `wails build/dev` will update the project config
and thus become defaults for subsequent runs.

View File

@@ -63,7 +63,7 @@ import TabItem from "@theme/TabItem";
## 安装 Wails
运行 `go install github.com/wailsapp/wails/v2/cmd/wails@v2.0.0-beta.4` 安装 Wails CLI。
运行 `go install github.com/wailsapp/wails/v2/cmd/wails@v2.0.0-beta.8` 安装 Wails CLI。
## 系统检查