Skip to content

Commit

Permalink
Frontend builds now use vite environment "development" or "production…
Browse files Browse the repository at this point in the history
…" depending on build type

Fix windows webview2 bootstrapper path issue
  • Loading branch information
leaanthony committed Jan 13, 2025
1 parent 10002d8 commit 8b64705
Show file tree
Hide file tree
Showing 25 changed files with 64 additions and 32 deletions.
2 changes: 2 additions & 0 deletions docs/src/content/docs/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Common taskfile now defaults to generating Typescript bindings for Typescript templates by [@leaanthony](https://github.com/leaanthony)
- Fix Close application on WM_CLOSE message when no windows are open/systray only by [@mmalcek](https://github.com/mmalcek) in [#3990](https://github.com/wailsapp/wails/pull/3990)
- Fixed garble build by @5aaee9 in [#3192](https://github.com/wailsapp/wails/pull/3192)
- Fixed windows nsis builds by [@leaanthony](https://github.com/leaanthony)


### Changed
Expand All @@ -68,6 +69,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [Windows] Reduced flicker when opening a window by [@leaanthony](https://github.com/leaanthony)
- Removed `Window.Destroy` as this was intended to be an internal function by [@leaanthony](https://github.com/leaanthony)
- Renamed `WindowClose` events to `WindowClosing` by [@leaanthony](https://github.com/leaanthony)
- Frontend builds now use vite environment "development" or "production" depending on build type by [@leaanthony](https://github.com/leaanthony)

## v3.0.0-alpha.8.3 - 2024-12-07

Expand Down
13 changes: 8 additions & 5 deletions v3/internal/commands/build_assets/Taskfile.tmpl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ tasks:
go:mod:tidy:
summary: Runs `go mod tidy`
internal: true
generates:
- go.sum
sources:
- go.mod
cmds:
- go mod tidy

Expand Down Expand Up @@ -36,10 +32,17 @@ tasks:
- task: install:frontend:deps
- task: generate:bindings
cmds:
- npm run build -q
- npm run {{ "{{.BUILD_COMMAND}}" }} -q
env:
PRODUCTION: {{ "'{{.PRODUCTION | default \"false\"}}'" }}
vars:
BUILD_COMMAND: {{ "'{{if eq .PRODUCTION \"true\"}}build{{else}}build:dev{{end}}'" }}


generate:bindings:
summary: Generates bindings for the frontend
deps:
- task: go:mod:tidy
sources:
- "**/*.go"
- go.mod
Expand Down
4 changes: 3 additions & 1 deletion v3/internal/commands/build_assets/windows/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ tasks:
deps:
- task: common:go:mod:tidy
- task: common:build:frontend
vars:
PRODUCTION: '{{.PRODUCTION}}'
- task: common:generate:icons
cmds:
- task: generate:syso
Expand Down Expand Up @@ -47,7 +49,7 @@ tasks:
PRODUCTION: "true"
cmds:
# Create the Microsoft WebView2 bootstrapper if it doesn't exist
- wails3 generate webview2bootstrapper -dir {{.ROOT_DIR}}/build/windows/nsis
- wails3 generate webview2bootstrapper -dir "{{.ROOT_DIR}}\build\windows\nsis"
- makensis -DARG_WAILS_{{.ARG_FLAG}}_BINARY="{{.ROOT_DIR}}\{{.BIN_DIR}}\{{.APP_NAME}}.exe" project.nsi
vars:
ARCH: '{{.ARCH | default ARCH}}'
Expand Down
6 changes: 5 additions & 1 deletion v3/internal/commands/generate_webview2.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ import (
var webview2Bootstrapper []byte

type GenerateWebView2Options struct {
Directory string `json:"directory"`
Directory string `name:"dir" json:"directory"`
}

func GenerateWebView2Bootstrapper(options *GenerateWebView2Options) error {
println("options.Directory", options.Directory)
options.Directory = filepath.Clean(options.Directory)
println("cleaned options.Directory", options.Directory)

// If the file already exists, exit early
if _, err := os.Stat(filepath.Join(options.Directory, "MicrosoftEdgeWebview2Setup.exe")); err == nil {
return nil
Expand Down
4 changes: 2 additions & 2 deletions v3/internal/templates/base/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build --minify false --mode development",
"build:prod": "vite build --mode production",
"build:dev": "vite build --minify false --mode development",
"build": "vite build --mode production",
"preview": "vite preview"
},
"devDependencies": {
Expand Down
4 changes: 3 additions & 1 deletion v3/internal/templates/lit-ts/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build"
"build:dev": "tsc && vite build --minify false --mode development",
"build": "tsc && vite build --mode production",
"preview": "vite preview"
},
"dependencies": {
"lit": "^3.1.0"
Expand Down
3 changes: 2 additions & 1 deletion v3/internal/templates/lit/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"build:dev": "vite build --minify false --mode development",
"build": "vite build --mode production",
"preview": "vite preview"
},
"dependencies": {
Expand Down
3 changes: 2 additions & 1 deletion v3/internal/templates/preact-ts/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"build:dev": "tsc && vite build --minify false --mode development",
"build": "tsc && vite build --mode production",
"preview": "vite preview"
},
"dependencies": {
Expand Down
3 changes: 2 additions & 1 deletion v3/internal/templates/preact/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"build:dev": "vite build --minify false --mode development",
"build": "vite build --mode production",
"preview": "vite preview"
},
"dependencies": {
Expand Down
3 changes: 2 additions & 1 deletion v3/internal/templates/qwik-ts/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"build:dev": "tsc && vite build --minify false --mode development",
"build": "tsc && vite build --mode production",
"preview": "vite preview"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion v3/internal/templates/qwik/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"build:dev": "vite build --minify false --mode development",
"build": "vite build --mode production",
"preview": "vite preview"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion v3/internal/templates/react-swc-ts/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"build:dev": "tsc && vite build --minify false --mode development",
"build": "tsc && vite build --mode production",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
Expand Down
3 changes: 2 additions & 1 deletion v3/internal/templates/react-swc/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"build:dev": "vite build --minify false --mode development",
"build": "vite build --mode production",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
Expand Down
3 changes: 2 additions & 1 deletion v3/internal/templates/react-ts/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"build:dev": "tsc && vite build --minify false --mode development",
"build": "tsc && vite build --mode production",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
Expand Down
3 changes: 2 additions & 1 deletion v3/internal/templates/react/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"build:dev": "vite build --minify false --mode development",
"build": "vite build --mode production",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
Expand Down
3 changes: 2 additions & 1 deletion v3/internal/templates/solid-ts/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"build:dev": "tsc && vite build --minify false --mode development",
"build": "tsc && vite build --mode production",
"preview": "vite preview"
},
"dependencies": {
Expand Down
3 changes: 2 additions & 1 deletion v3/internal/templates/solid/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"build:dev": "vite build --minify false --mode development",
"build": "vite build --mode production",
"preview": "vite preview"
},
"dependencies": {
Expand Down
3 changes: 2 additions & 1 deletion v3/internal/templates/svelte-ts/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"build:dev": "vite build --minify false --mode development",
"build": "vite build --mode production",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json"
},
Expand Down
3 changes: 2 additions & 1 deletion v3/internal/templates/svelte/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"build:dev": "vite build --minify false --mode development",
"build": "vite build --mode production",
"preview": "vite preview"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion v3/internal/templates/sveltekit-ts/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"build:dev": "vite build --minify false --mode development",
"build": "vite build --mode production",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
Expand Down
7 changes: 5 additions & 2 deletions v3/internal/templates/sveltekit/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview"
"build:dev": "vite build --minify false --mode development",
"build": "vite build --mode production",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions v3/internal/templates/vanilla-ts/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build --minify false --mode development",
"build:prod": "tsc && vite build --mode production",
"build:dev": "tsc && vite build --minify false --mode development",
"build": "tsc && vite build --mode production",
"preview": "vite preview"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions v3/internal/templates/vanilla/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build --minify false --mode development",
"build:prod": "vite build --mode production",
"build:dev": "vite build --minify false --mode development",
"build": "vite build --mode production",
"preview": "vite preview"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion v3/internal/templates/vue-ts/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc && vite build",
"build:dev": "vue-tsc && vite build --minify false --mode development",
"build": "vue-tsc && vite build --mode production",
"preview": "vite preview"
},
"dependencies": {
Expand Down
3 changes: 2 additions & 1 deletion v3/internal/templates/vue/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"build:dev": "vite build --minify false --mode development",
"build": "vite build --mode production",
"preview": "vite preview"
},
"dependencies": {
Expand Down

0 comments on commit 8b64705

Please sign in to comment.