From 4541cf0b3a5a4980d4fe18daae431934c707fb1f Mon Sep 17 00:00:00 2001 From: josc146 Date: Sun, 16 Mar 2025 18:26:26 +0800 Subject: [PATCH 01/10] add -skipembedcreate cli option --- v2/cmd/wails/build.go | 1 + v2/cmd/wails/flags/buildcommon.go | 19 ++++++++++--------- v2/cmd/wails/flags/dev.go | 31 ++++++++++++++++--------------- v2/pkg/commands/build/build.go | 7 +++++-- 4 files changed, 32 insertions(+), 26 deletions(-) diff --git a/v2/cmd/wails/build.go b/v2/cmd/wails/build.go index 7364df8ba..05f235078 100644 --- a/v2/cmd/wails/build.go +++ b/v2/cmd/wails/build.go @@ -85,6 +85,7 @@ func buildApplication(f *flags.Build) error { GarbleArgs: f.GarbleArgs, SkipBindings: f.SkipBindings, ProjectData: projectOptions, + SkipEmbedCreate: f.SkipEmbedCreate, } tableData := pterm.TableData{ diff --git a/v2/cmd/wails/flags/buildcommon.go b/v2/cmd/wails/flags/buildcommon.go index 4bbc4c62c..a22f7a502 100644 --- a/v2/cmd/wails/flags/buildcommon.go +++ b/v2/cmd/wails/flags/buildcommon.go @@ -1,15 +1,16 @@ package flags type BuildCommon struct { - LdFlags string `description:"Additional ldflags to pass to the compiler"` - Compiler string `description:"Use a different go compiler to build, eg go1.15beta1"` - SkipBindings bool `description:"Skips generation of bindings"` - RaceDetector bool `name:"race" description:"Build with Go's race detector"` - SkipFrontend bool `name:"s" description:"Skips building the frontend"` - Verbosity int `name:"v" description:"Verbosity level (0 = quiet, 1 = normal, 2 = verbose)"` - Tags string `description:"Build tags to pass to Go compiler. Must be quoted. Space or comma (but not both) separated"` - NoSyncGoMod bool `description:"Don't sync go.mod"` - SkipModTidy bool `name:"m" description:"Skip mod tidy before compile"` + LdFlags string `description:"Additional ldflags to pass to the compiler"` + Compiler string `description:"Use a different go compiler to build, eg go1.15beta1"` + SkipBindings bool `description:"Skips generation of bindings"` + RaceDetector bool `name:"race" description:"Build with Go's race detector"` + SkipFrontend bool `name:"s" description:"Skips building the frontend"` + Verbosity int `name:"v" description:"Verbosity level (0 = quiet, 1 = normal, 2 = verbose)"` + Tags string `description:"Build tags to pass to Go compiler. Must be quoted. Space or comma (but not both) separated"` + NoSyncGoMod bool `description:"Don't sync go.mod"` + SkipModTidy bool `name:"m" description:"Skip mod tidy before compile"` + SkipEmbedCreate bool `description:"Skips creation of embed files"` } func (c BuildCommon) Default() BuildCommon { diff --git a/v2/cmd/wails/flags/dev.go b/v2/cmd/wails/flags/dev.go index 501450a98..b2ae1c04f 100644 --- a/v2/cmd/wails/flags/dev.go +++ b/v2/cmd/wails/flags/dev.go @@ -117,21 +117,22 @@ func (d *Dev) loadAndMergeProjectConfig() error { // GenerateBuildOptions creates a build.Options using the flags func (d *Dev) GenerateBuildOptions() *build.Options { result := &build.Options{ - OutputType: "dev", - Mode: build.Dev, - Devtools: true, - Arch: runtime.GOARCH, - Pack: true, - Platform: runtime.GOOS, - LDFlags: d.LdFlags, - Compiler: d.Compiler, - ForceBuild: d.ForceBuild, - IgnoreFrontend: d.SkipFrontend, - SkipBindings: d.SkipBindings, - Verbosity: d.Verbosity, - WailsJSDir: d.WailsJSDir, - RaceDetector: d.RaceDetector, - ProjectData: d.projectConfig, + OutputType: "dev", + Mode: build.Dev, + Devtools: true, + Arch: runtime.GOARCH, + Pack: true, + Platform: runtime.GOOS, + LDFlags: d.LdFlags, + Compiler: d.Compiler, + ForceBuild: d.ForceBuild, + IgnoreFrontend: d.SkipFrontend, + SkipBindings: d.SkipBindings, + Verbosity: d.Verbosity, + WailsJSDir: d.WailsJSDir, + RaceDetector: d.RaceDetector, + ProjectData: d.projectConfig, + SkipEmbedCreate: d.SkipEmbedCreate, } return result diff --git a/v2/pkg/commands/build/build.go b/v2/pkg/commands/build/build.go index f247f2db1..ca128ae9c 100644 --- a/v2/pkg/commands/build/build.go +++ b/v2/pkg/commands/build/build.go @@ -69,6 +69,7 @@ type Options struct { Obfuscated bool // Indicates that bound methods should be obfuscated GarbleArgs string // The arguments for Garble SkipBindings bool // Skip binding generation + SkipEmbedCreate bool // Skip embed creation when in development mode } // Build the project! @@ -120,8 +121,10 @@ func Build(options *Options) (string, error) { } // Create embed directories if they don't exist - if err := CreateEmbedDirectories(cwd, options); err != nil { - return "", err + if !options.SkipEmbedCreate { + if err := CreateEmbedDirectories(cwd, options); err != nil { + return "", err + } } // Generate bindings From ecf1c41db49da05e0db3cbac8341710408618bee Mon Sep 17 00:00:00 2001 From: josc146 Date: Sun, 16 Mar 2025 19:32:31 +0800 Subject: [PATCH 02/10] improve comment --- v2/pkg/commands/build/build.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2/pkg/commands/build/build.go b/v2/pkg/commands/build/build.go index ca128ae9c..b4e83dd69 100644 --- a/v2/pkg/commands/build/build.go +++ b/v2/pkg/commands/build/build.go @@ -69,7 +69,7 @@ type Options struct { Obfuscated bool // Indicates that bound methods should be obfuscated GarbleArgs string // The arguments for Garble SkipBindings bool // Skip binding generation - SkipEmbedCreate bool // Skip embed creation when in development mode + SkipEmbedCreate bool // Skip creation of embed files } // Build the project! From 6bf875f2a25cd6956929e3c044569e7433732722 Mon Sep 17 00:00:00 2001 From: josc146 Date: Wed, 19 Mar 2025 15:04:21 +0800 Subject: [PATCH 03/10] Update changelog --- website/src/pages/changelog.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/website/src/pages/changelog.mdx b/website/src/pages/changelog.mdx index 05128a6f3..754b4a03e 100644 --- a/website/src/pages/changelog.mdx +++ b/website/src/pages/changelog.mdx @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added "Branding" section to `wails doctor` to correctly identify Windows 11 [#3891](https://github.com/wailsapp/wails/pull/3891) by [@ronen25](https://github.com/ronen25) +- Added `-skipembedcreate` flag to build and dev command to improve compile and recompile speed [#4143](https://github.com/wailsapp/wails/pull/4143) by @josStorer ## v2.10.1 - 2025-02-24 From ae5e3f47a73c8b8618d58eb4cc66acd0a69269cd Mon Sep 17 00:00:00 2001 From: josc146 Date: Wed, 19 Mar 2025 15:16:27 +0800 Subject: [PATCH 04/10] update cli doc for -skipembedcreate --- website/docs/reference/cli.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/docs/reference/cli.mdx b/website/docs/reference/cli.mdx index dc816a56b..84aba8fd8 100644 --- a/website/docs/reference/cli.mdx +++ b/website/docs/reference/cli.mdx @@ -73,6 +73,7 @@ If you are unsure about a template, inspect `package.json` and `wails.json` for | -race | Build with Go's race detector | | | -s | Skip building the frontend | | | -skipbindings | Skip bindings generation | | +| -skipembedcreate | Skip automatic creation of non-existent embed directories and gitkeep files | | | -tags "extra tags" | Build tags to pass to Go compiler. Must be quoted. Space or comma (but not both) separated | | | -trimpath | Remove all file system paths from the resulting executable. | | | -u | Updates your project's `go.mod` to use the same version of Wails as the CLI | | @@ -203,6 +204,7 @@ Your system is ready for Wails development! | -s | Skip building the frontend | false | | -save | Saves the given `assetdir`, `reloaddirs`, `wailsjsdir`, `debounce`, `devserver` and `frontenddevserverurl` flags in `wails.json` to become the defaults for subsequent invocations. | | | -skipbindings | Skip bindings generation | | +| -skipembedcreate | Skip automatic creation of non-existent embed directories and gitkeep files | | | -tags "extra tags" | Build tags to pass to compiler (quoted and space separated) | | | -v | Verbosity level (0 - silent, 1 - standard, 2 - verbose) | 1 | | -wailsjsdir | The directory to generate the generated Wails JS modules | Value in `wails.json` | From 9c7dc05ceae4defbf5caf63af62827efb350d830 Mon Sep 17 00:00:00 2001 From: "B.T" <52111440+brianetaveras@users.noreply.github.com> Date: Tue, 25 Mar 2025 08:10:44 -0400 Subject: [PATCH 05/10] Update options docs to clarify linux webview gpu defaults --- website/versioned_docs/version-v2.10/reference/options.mdx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/website/versioned_docs/version-v2.10/reference/options.mdx b/website/versioned_docs/version-v2.10/reference/options.mdx index efcc67961..40299e300 100644 --- a/website/versioned_docs/version-v2.10/reference/options.mdx +++ b/website/versioned_docs/version-v2.10/reference/options.mdx @@ -126,7 +126,7 @@ func main() { Linux: &linux.Options{ Icon: icon, WindowIsTranslucent: false, - WebviewGpuPolicy: linux.WebviewGpuPolicyAlways, + WebviewGpuPolicy: linux.WebviewGpuPolicyNever, ProgramName: "wails" }, Debug: options.Debug{ @@ -1066,7 +1066,8 @@ This option is used for determining the webview's hardware acceleration policy. Name: WebviewGpuPolicy
Type: [`options.WebviewGpuPolicy`](#webviewgpupolicy-type)
-Default: `WebviewGpuPolicyAlways` +Default (Windows, macOS): `WebviewGpuPolicyAlways`
+Default (Linux): `WebviewGpuPolicyNever`
##### WebviewGpuPolicy type From 2acf32cd36bd59f84878785ba2ffe2b81a3c0af6 Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 27 Mar 2025 12:49:10 +0800 Subject: [PATCH 06/10] doc/howdoesitwork: fix indentation --- website/versioned_docs/version-v2.10/howdoesitwork.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/versioned_docs/version-v2.10/howdoesitwork.mdx b/website/versioned_docs/version-v2.10/howdoesitwork.mdx index 48243f4eb..69134ac24 100644 --- a/website/versioned_docs/version-v2.10/howdoesitwork.mdx +++ b/website/versioned_docs/version-v2.10/howdoesitwork.mdx @@ -33,7 +33,7 @@ import ( "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2/pkg/options" - "github.com/wailsapp/wails/v2/pkg/options/assetserver" + "github.com/wailsapp/wails/v2/pkg/options/assetserver" ) //go:embed all:frontend/dist @@ -150,7 +150,7 @@ import ( "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2/pkg/options" - "github.com/wailsapp/wails/v2/pkg/options/assetserver" + "github.com/wailsapp/wails/v2/pkg/options/assetserver" ) //go:embed all:frontend/dist From 9763cd3465e9fb328af10d0701603fc6b705a1bf Mon Sep 17 00:00:00 2001 From: brian Date: Mon, 31 Mar 2025 19:56:45 -0400 Subject: [PATCH 07/10] Added updates to the changelog --- website/src/pages/changelog.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/website/src/pages/changelog.mdx b/website/src/pages/changelog.mdx index 754b4a03e..f099673dc 100644 --- a/website/src/pages/changelog.mdx +++ b/website/src/pages/changelog.mdx @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Updated recommendation for Svelte router in [#4085](https://github.com/wailsapp/wails/pull/4085) by [@benmccann](https://github.com/benmccann) +- Updated documentation to clarify `WebviewGpuPolicy` default behavior on Linux in [#4162](https://github.com/wailsapp/wails/pull/4162) by [@brianetaveras](https://github.com/brianetaveras) ### Added - Added "Branding" section to `wails doctor` to correctly identify Windows 11 [#3891](https://github.com/wailsapp/wails/pull/3891) by [@ronen25](https://github.com/ronen25) From e7643b860564d00d1b0f244a344cfd4f47976a6b Mon Sep 17 00:00:00 2001 From: brian Date: Mon, 31 Mar 2025 20:08:45 -0400 Subject: [PATCH 08/10] Added more information to the documentation --- website/versioned_docs/version-v2.10/reference/options.mdx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website/versioned_docs/version-v2.10/reference/options.mdx b/website/versioned_docs/version-v2.10/reference/options.mdx index 40299e300..ed7ccda01 100644 --- a/website/versioned_docs/version-v2.10/reference/options.mdx +++ b/website/versioned_docs/version-v2.10/reference/options.mdx @@ -1067,7 +1067,9 @@ This option is used for determining the webview's hardware acceleration policy. Name: WebviewGpuPolicy
Type: [`options.WebviewGpuPolicy`](#webviewgpupolicy-type)
Default (Windows, macOS): `WebviewGpuPolicyAlways`
-Default (Linux): `WebviewGpuPolicyNever`
+Default (Linux): Due to [#2977](https://github.com/wailsapp/wails/issues/2977,), if `options.Linux` is nil + in the call to `wails.Run()`, `WebviewGpuPolicy` is set by default to `WebviewGpuPolicyNever`. You can override this behavior by passing a non-nil `Options` and set `WebviewGpuPolicy` as needed. + ##### WebviewGpuPolicy type From 92a25c7dfdb5a3972a92ee344a29f701fb3d7c80 Mon Sep 17 00:00:00 2001 From: "dingda.li" Date: Tue, 1 Apr 2025 15:19:27 +0800 Subject: [PATCH 09/10] fix: suppress excessive console logs after updating to v2.10.1 --- v2/internal/app/app_dev.go | 29 +++++++++++++++++++---------- website/src/pages/changelog.mdx | 2 ++ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/v2/internal/app/app_dev.go b/v2/internal/app/app_dev.go index 89265c9b9..4e668bc9a 100644 --- a/v2/internal/app/app_dev.go +++ b/v2/internal/app/app_dev.go @@ -46,7 +46,12 @@ func CreateApp(appoptions *options.App) (*App, error) { ctx = context.WithValue(ctx, "debug", true) ctx = context.WithValue(ctx, "devtoolsEnabled", true) - // Set up logger + // Set up logger if the appoptions.LogLevel is an invalid value, set it to the default log level + appoptions.LogLevel, err = pkglogger.StringToLogLevel(appoptions.LogLevel.String()) + if err != nil { + return nil, err + } + myLogger := logger.New(appoptions.Logger) myLogger.SetLogLevel(appoptions.LogLevel) @@ -91,15 +96,8 @@ func CreateApp(appoptions *options.App) (*App, error) { if frontendDevServerURLFlag != nil { frontendDevServerURL = *frontendDevServerURLFlag } - // Only override LogLevel if the flag was explicitly set - if loglevelFlag != nil && devFlags.Lookup("loglevel").Value.String() != appoptions.LogLevel.String() { - loggerLevel, err := pkglogger.StringToLogLevel(*loglevelFlag) - if err != nil { - return nil, err - } - if loggerLevel != appoptions.LogLevel { - myLogger.SetLogLevel(loggerLevel) - } + if loglevelFlag != nil { + loglevel = *loglevelFlag } } @@ -176,6 +174,17 @@ func CreateApp(appoptions *options.App) (*App, error) { ctx = context.WithValue(ctx, "devserver", devServer) } + if loglevel != "" { + level, err := pkglogger.StringToLogLevel(loglevel) + if err != nil { + return nil, err + } + // Only set the log level if it's different from the appoptions.LogLevel + if level != appoptions.LogLevel { + myLogger.SetLogLevel(level) + } + } + // Attach logger to context ctx = context.WithValue(ctx, "logger", myLogger) ctx = context.WithValue(ctx, "buildtype", "dev") diff --git a/website/src/pages/changelog.mdx b/website/src/pages/changelog.mdx index 754b4a03e..01bc757ae 100644 --- a/website/src/pages/changelog.mdx +++ b/website/src/pages/changelog.mdx @@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added "Branding" section to `wails doctor` to correctly identify Windows 11 [#3891](https://github.com/wailsapp/wails/pull/3891) by [@ronen25](https://github.com/ronen25) - Added `-skipembedcreate` flag to build and dev command to improve compile and recompile speed [#4143](https://github.com/wailsapp/wails/pull/4143) by @josStorer +### Fixed +- Fixed excessive console logging after updating to v2.10.1 by @superDingda in [#4111](https://github.com/wailsapp/wails/issues/4111) ## v2.10.1 - 2025-02-24 From 6ac0bcdf7f18d9420435e9936a98cc8ce0467b86 Mon Sep 17 00:00:00 2001 From: darkb0ts Date: Mon, 7 Apr 2025 12:26:06 +0530 Subject: [PATCH 10/10] new template for wails 2025 react-ts and typescript --- website/docs/community/templates.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/community/templates.mdx b/website/docs/community/templates.mdx index fdd2778c4..088b64a68 100644 --- a/website/docs/community/templates.mdx +++ b/website/docs/community/templates.mdx @@ -41,6 +41,7 @@ If you are unsure about a template, inspect `package.json` and `wails.json` for - [wails-template-nextjs](https://github.com/LGiki/wails-template-nextjs) - A template using Next.js and TypeScript - [wails-template-nextjs-app-router](https://github.com/thisisvk-in/wails-template-nextjs-app-router) - A template using Next.js and TypeScript with App router - [wails-vite-react-ts-tailwind-template](https://github.com/hotafrika/wails-vite-react-ts-tailwind-template) - A template for React + TypeScript + Vite + TailwindCSS +- [Wails-vite-ts-tailwindcss-shadcn-template-2025](https://github.com/darkb0ts/Wails-vite-ts-tailwindcss-shadcn-template-2025) - A template for React + TypeScript + Vite - [wails-vite-react-ts-tailwind-shadcnui-template](https://github.com/Mahcks/wails-vite-react-tailwind-shadcnui-ts) - A template with Vite, React, TypeScript, TailwindCSS, and shadcn/ui - [wails-nextjs-tailwind-template](https://github.com/kairo913/wails-nextjs-tailwind-template) - A template using Next.js and Typescript with TailwindCSS