Skip to content

Commit e991615

Browse files
committed
Add badge options. Add new example.
1 parent 52df483 commit e991615

37 files changed

+1549
-21
lines changed

v3/examples/badge-custom/README.md

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Welcome to Your New Wails3 Project!
2+
3+
Congratulations on generating your Wails3 application! This README will guide you through the next steps to get your project up and running.
4+
5+
## Getting Started
6+
7+
1. Navigate to your project directory in the terminal.
8+
9+
2. To run your application in development mode, use the following command:
10+
11+
```
12+
wails3 dev
13+
```
14+
15+
This will start your application and enable hot-reloading for both frontend and backend changes.
16+
17+
3. To build your application for production, use:
18+
19+
```
20+
wails3 build
21+
```
22+
23+
This will create a production-ready executable in the `build` directory.
24+
25+
## Exploring Wails3 Features
26+
27+
Now that you have your project set up, it's time to explore the features that Wails3 offers:
28+
29+
1. **Check out the examples**: The best way to learn is by example. Visit the `examples` directory in the `v3/examples` directory to see various sample applications.
30+
31+
2. **Run an example**: To run any of the examples, navigate to the example's directory and use:
32+
33+
```
34+
go run .
35+
```
36+
37+
Note: Some examples may be under development during the alpha phase.
38+
39+
3. **Explore the documentation**: Visit the [Wails3 documentation](https://v3.wails.io/) for in-depth guides and API references.
40+
41+
4. **Join the community**: Have questions or want to share your progress? Join the [Wails Discord](https://discord.gg/JDdSxwjhGf) or visit the [Wails discussions on GitHub](https://github.com/wailsapp/wails/discussions).
42+
43+
## Project Structure
44+
45+
Take a moment to familiarize yourself with your project structure:
46+
47+
- `frontend/`: Contains your frontend code (HTML, CSS, JavaScript/TypeScript)
48+
- `main.go`: The entry point of your Go backend
49+
- `app.go`: Define your application structure and methods here
50+
- `wails.json`: Configuration file for your Wails project
51+
52+
## Next Steps
53+
54+
1. Modify the frontend in the `frontend/` directory to create your desired UI.
55+
2. Add backend functionality in `main.go`.
56+
3. Use `wails3 dev` to see your changes in real-time.
57+
4. When ready, build your application with `wails3 build`.
58+
59+
Happy coding with Wails3! If you encounter any issues or have questions, don't hesitate to consult the documentation or reach out to the Wails community.

v3/examples/badge-custom/Taskfile.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: '3'
2+
3+
includes:
4+
common: ./build/Taskfile.yml
5+
windows: ./build/windows/Taskfile.yml
6+
darwin: ./build/darwin/Taskfile.yml
7+
linux: ./build/linux/Taskfile.yml
8+
9+
vars:
10+
APP_NAME: "badge"
11+
BIN_DIR: "bin"
12+
VITE_PORT: '{{.WAILS_VITE_PORT | default 9245}}'
13+
14+
tasks:
15+
build:
16+
summary: Builds the application
17+
cmds:
18+
- task: "{{OS}}:build"
19+
20+
package:
21+
summary: Packages a production build of the application
22+
cmds:
23+
- task: "{{OS}}:package"
24+
25+
run:
26+
summary: Runs the application
27+
cmds:
28+
- task: "{{OS}}:run"
29+
30+
dev:
31+
summary: Runs the application in development mode
32+
cmds:
33+
- wails3 dev -config ./build/config.yml -port {{.VITE_PORT}}
34+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
version: '3'
2+
3+
tasks:
4+
go:mod:tidy:
5+
summary: Runs `go mod tidy`
6+
internal: true
7+
cmds:
8+
- go mod tidy
9+
10+
install:frontend:deps:
11+
summary: Install frontend dependencies
12+
dir: frontend
13+
sources:
14+
- package.json
15+
- package-lock.json
16+
generates:
17+
- node_modules/*
18+
preconditions:
19+
- sh: npm version
20+
msg: "Looks like npm isn't installed. Npm is part of the Node installer: https://nodejs.org/en/download/"
21+
cmds:
22+
- npm install
23+
24+
build:frontend:
25+
label: build:frontend (PRODUCTION={{.PRODUCTION}})
26+
summary: Build the frontend project
27+
dir: frontend
28+
sources:
29+
- "**/*"
30+
generates:
31+
- dist/**/*
32+
deps:
33+
- task: install:frontend:deps
34+
- task: generate:bindings
35+
vars:
36+
BUILD_FLAGS:
37+
ref: .BUILD_FLAGS
38+
cmds:
39+
- npm run {{.BUILD_COMMAND}} -q
40+
env:
41+
PRODUCTION: '{{.PRODUCTION | default "false"}}'
42+
vars:
43+
BUILD_COMMAND: '{{if eq .PRODUCTION "true"}}build{{else}}build:dev{{end}}'
44+
45+
46+
generate:bindings:
47+
label: generate:bindings (BUILD_FLAGS={{.BUILD_FLAGS}})
48+
summary: Generates bindings for the frontend
49+
deps:
50+
- task: go:mod:tidy
51+
sources:
52+
- "**/*.[jt]s"
53+
- exclude: frontend/**/*
54+
- frontend/bindings/**/* # Rerun when switching between dev/production mode causes changes in output
55+
- "**/*.go"
56+
- go.mod
57+
- go.sum
58+
generates:
59+
- frontend/bindings/**/*
60+
cmds:
61+
- wails3 generate bindings -f '{{.BUILD_FLAGS}}' -clean=true -ts
62+
63+
generate:icons:
64+
summary: Generates Windows `.ico` and Mac `.icns` files from an image
65+
dir: build
66+
sources:
67+
- "appicon.png"
68+
generates:
69+
- "darwin/icons.icns"
70+
- "windows/icon.ico"
71+
cmds:
72+
- wails3 generate icons -input appicon.png -macfilename darwin/icons.icns -windowsfilename windows/icon.ico
73+
74+
dev:frontend:
75+
summary: Runs the frontend in development mode
76+
dir: frontend
77+
deps:
78+
- task: install:frontend:deps
79+
cmds:
80+
- npm run dev -- --port {{.VITE_PORT}} --strictPort
81+
82+
update:build-assets:
83+
summary: Updates the build assets
84+
dir: build
85+
cmds:
86+
- wails3 update build-assets -name "{{.APP_NAME}}" -binaryname "{{.APP_NAME}}" -config config.yml -dir .
130 KB
Loading
+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# This file contains the configuration for this project.
2+
# When you update `info` or `fileAssociations`, run `wails3 task common:update:build-assets` to update the assets.
3+
# Note that this will overwrite any changes you have made to the assets.
4+
version: '3'
5+
6+
# This information is used to generate the build assets.
7+
info:
8+
companyName: "My Company" # The name of the company
9+
productName: "My Product" # The name of the application
10+
productIdentifier: "com.mycompany.myproduct" # The unique product identifier
11+
description: "A program that does X" # The application description
12+
copyright: "(c) 2025, My Company" # Copyright text
13+
comments: "Some Product Comments" # Comments
14+
version: "0.0.1" # The application version
15+
16+
# Dev mode configuration
17+
dev_mode:
18+
root_path: .
19+
log_level: warn
20+
debounce: 1000
21+
ignore:
22+
dir:
23+
- .git
24+
- node_modules
25+
- frontend
26+
- bin
27+
file:
28+
- .DS_Store
29+
- .gitignore
30+
- .gitkeep
31+
watched_extension:
32+
- "*.go"
33+
git_ignore: true
34+
executes:
35+
- cmd: wails3 task common:install:frontend:deps
36+
type: once
37+
- cmd: wails3 task common:dev:frontend
38+
type: background
39+
- cmd: go mod tidy
40+
type: blocking
41+
- cmd: wails3 task build
42+
type: blocking
43+
- cmd: wails3 task run
44+
type: primary
45+
46+
# File Associations
47+
# More information at: https://v3.wails.io/noit/done/yet
48+
fileAssociations:
49+
# - ext: wails
50+
# name: Wails
51+
# description: Wails Application File
52+
# iconName: wailsFileIcon
53+
# role: Editor
54+
# - ext: jpg
55+
# name: JPEG
56+
# description: Image File
57+
# iconName: jpegFileIcon
58+
# role: Editor
59+
# mimeType: image/jpeg # (optional)
60+
61+
# Other data
62+
other:
63+
- name: My Other Data
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
2+
<plist version="1.0">
3+
<dict>
4+
<key>CFBundlePackageType</key>
5+
<string>APPL</string>
6+
<key>CFBundleName</key>
7+
<string>My Product</string>
8+
<key>CFBundleExecutable</key>
9+
<string>badge</string>
10+
<key>CFBundleIdentifier</key>
11+
<string>com.wails.badge</string>
12+
<key>CFBundleVersion</key>
13+
<string>0.1.0</string>
14+
<key>CFBundleGetInfoString</key>
15+
<string>This is a comment</string>
16+
<key>CFBundleShortVersionString</key>
17+
<string>0.1.0</string>
18+
<key>CFBundleIconFile</key>
19+
<string>icons</string>
20+
<key>LSMinimumSystemVersion</key>
21+
<string>10.15.0</string>
22+
<key>NSHighResolutionCapable</key>
23+
<string>true</string>
24+
<key>NSHumanReadableCopyright</key>
25+
<string>© now, My Company</string>
26+
<key>NSAppTransportSecurity</key>
27+
<dict>
28+
<key>NSAllowsLocalNetworking</key>
29+
<true/>
30+
</dict>
31+
</dict>
32+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
2+
<plist version="1.0">
3+
<dict>
4+
<key>CFBundlePackageType</key>
5+
<string>APPL</string>
6+
<key>CFBundleName</key>
7+
<string>My Product</string>
8+
<key>CFBundleExecutable</key>
9+
<string>badge</string>
10+
<key>CFBundleIdentifier</key>
11+
<string>com.wails.badge</string>
12+
<key>CFBundleVersion</key>
13+
<string>0.1.0</string>
14+
<key>CFBundleGetInfoString</key>
15+
<string>This is a comment</string>
16+
<key>CFBundleShortVersionString</key>
17+
<string>0.1.0</string>
18+
<key>CFBundleIconFile</key>
19+
<string>icons</string>
20+
<key>LSMinimumSystemVersion</key>
21+
<string>10.15.0</string>
22+
<key>NSHighResolutionCapable</key>
23+
<string>true</string>
24+
<key>NSHumanReadableCopyright</key>
25+
<string>© now, My Company</string>
26+
</dict>
27+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
version: '3'
2+
3+
includes:
4+
common: ../Taskfile.yml
5+
6+
tasks:
7+
build:
8+
summary: Creates a production build of the application
9+
deps:
10+
- task: common:go:mod:tidy
11+
- task: common:build:frontend
12+
vars:
13+
BUILD_FLAGS:
14+
ref: .BUILD_FLAGS
15+
PRODUCTION:
16+
ref: .PRODUCTION
17+
- task: common:generate:icons
18+
cmds:
19+
- go build {{.BUILD_FLAGS}} -o {{.OUTPUT}}
20+
vars:
21+
BUILD_FLAGS: '{{if eq .PRODUCTION "true"}}-tags production -trimpath -buildvcs=false -ldflags="-w -s"{{else}}-buildvcs=false -gcflags=all="-l"{{end}}'
22+
DEFAULT_OUTPUT: '{{.BIN_DIR}}/{{.APP_NAME}}'
23+
OUTPUT: '{{ .OUTPUT | default .DEFAULT_OUTPUT }}'
24+
env:
25+
GOOS: darwin
26+
CGO_ENABLED: 1
27+
GOARCH: '{{.ARCH | default ARCH}}'
28+
CGO_CFLAGS: "-mmacosx-version-min=10.15"
29+
CGO_LDFLAGS: "-mmacosx-version-min=10.15"
30+
MACOSX_DEPLOYMENT_TARGET: "10.15"
31+
PRODUCTION: '{{.PRODUCTION | default "false"}}'
32+
33+
build:universal:
34+
summary: Builds darwin universal binary (arm64 + amd64)
35+
deps:
36+
- task: build
37+
vars:
38+
ARCH: amd64
39+
OUTPUT: "{{.BIN_DIR}}/{{.APP_NAME}}-amd64"
40+
- task: build
41+
vars:
42+
ARCH: arm64
43+
OUTPUT: "{{.BIN_DIR}}/{{.APP_NAME}}-arm64"
44+
cmds:
45+
- lipo -create -output "{{.BIN_DIR}}/{{.APP_NAME}}" "{{.BIN_DIR}}/{{.APP_NAME}}-amd64" "{{.BIN_DIR}}/{{.APP_NAME}}-arm64"
46+
- rm "{{.BIN_DIR}}/{{.APP_NAME}}-amd64" "{{.BIN_DIR}}/{{.APP_NAME}}-arm64"
47+
48+
package:
49+
summary: Packages a production build of the application into a `.app` bundle
50+
deps:
51+
- task: build
52+
vars:
53+
PRODUCTION: "true"
54+
cmds:
55+
- task: create:app:bundle
56+
57+
package:universal:
58+
summary: Packages darwin universal binary (arm64 + amd64)
59+
deps:
60+
- task: build:universal
61+
cmds:
62+
- task: create:app:bundle
63+
64+
65+
create:app:bundle:
66+
summary: Creates an `.app` bundle
67+
cmds:
68+
- mkdir -p {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/{MacOS,Resources}
69+
- cp build/darwin/icons.icns {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/Resources
70+
- cp {{.BIN_DIR}}/{{.APP_NAME}} {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/MacOS
71+
- cp build/darwin/Info.plist {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents
72+
- codesign --force --deep --sign - {{.BIN_DIR}}/{{.APP_NAME}}.app
73+
74+
run:
75+
cmds:
76+
- mkdir -p {{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/{MacOS,Resources}
77+
- cp build/darwin/icons.icns {{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/Resources
78+
- cp {{.BIN_DIR}}/{{.APP_NAME}} {{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/MacOS
79+
- cp build/darwin/Info.dev.plist {{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/Info.plist
80+
- codesign --force --deep --sign - {{.BIN_DIR}}/{{.APP_NAME}}.dev.app
81+
- '{{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/MacOS/{{.APP_NAME}}'
Binary file not shown.

0 commit comments

Comments
 (0)