mirror of
https://github.com/wavetermdev/wails.git
synced 2026-04-22 15:26:15 -07:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f89fdea4b | |||
| 2c29e1ca76 | |||
| 5a57ee99ac | |||
| 735b6b6c87 | |||
| 7ea0601fc6 | |||
| 99537f2816 | |||
| b384bb885b | |||
| 2255af1c45 | |||
| f55b781d86 | |||
| 38d9a9551f | |||
| c38cee0a4a | |||
| 0f9c7b1bbf | |||
| 32ddbd8e05 | |||
| 67c493f1a8 | |||
| 69c513e33d | |||
| 82b910dd6d |
@@ -72,25 +72,27 @@ jobs:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
|
||||
- name: Run tests (mac) | v2
|
||||
if: ${{ matrix.os == 'macos-latest' && github.base_ref == 'master' }}
|
||||
if: ${{ matrix.os == 'macos-latest' && github.event.pull_request.base.ref == 'master' }}
|
||||
env:
|
||||
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
|
||||
CGO_CFLAGS: -mmacosx-version-min=10.13
|
||||
working-directory: ./v2
|
||||
run: go test -v ./...
|
||||
|
||||
- name: Run tests (!mac) | v2
|
||||
if: ${{ matrix.os != 'macos-latest' && github.base_ref == 'master' }}
|
||||
if: ${{ matrix.os != 'macos-latest' && github.event.pull_request.base.ref == 'master' }}
|
||||
working-directory: ./v2
|
||||
run: go test -v ./...
|
||||
|
||||
- name: Run tests (mac) | v3
|
||||
if: ${{ matrix.os == 'macos-latest' && github.base_ref == 'v3-alpha' }}
|
||||
if: ${{ matrix.os == 'macos-latest' && github.event.pull_request.base.ref == 'v3-alpha' }}
|
||||
env:
|
||||
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
|
||||
CGO_CFLAGS: -mmacosx-version-min=10.13
|
||||
working-directory: ./v3
|
||||
run: go test -v ./...
|
||||
|
||||
- name: Run tests (!mac) | v3
|
||||
if: ${{ matrix.os != 'macos-latest' && github.base_ref == 'v3-alpha' }}
|
||||
if: ${{ matrix.os != 'macos-latest' && github.event.pull_request.base.ref == 'v3-alpha' }}
|
||||
working-directory: ./v3
|
||||
run: go test -v ./...
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
on:
|
||||
push:
|
||||
branches: ['v3-alpha']
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "20"
|
||||
- run: npm ci
|
||||
working-directory: v3/internal/runtime/desktop/@wailsio/runtime
|
||||
|
||||
- uses: JS-DevTools/npm-publish@v3
|
||||
with:
|
||||
package: v3/internal/runtime/desktop/@wailsio/runtime
|
||||
access: public
|
||||
token: ${{ secrets.NPM_TOKEN }}
|
||||
@@ -32,6 +32,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Add ESM exports from the bundled JS runtime script by [@fbbdev](https://github.com/fbbdev) in [#3295](https://github.com/wailsapp/wails/pull/3295)
|
||||
- Add binding generator flag for using the bundled JS runtime script instead of the npm package by [@fbbdev](https://github.com/fbbdev) in [#3334](https://github.com/wailsapp/wails/pull/3334)
|
||||
- Implement `setIcon` on linux by [@abichinger](https://github.com/abichinger) in [#3354](https://github.com/wailsapp/wails/pull/3354)
|
||||
- Add flag `-port` to dev command and support environment variable `WAILS_VITE_PORT` by [@abichinger](https://github.com/abichinger) in [#3429](https://github.com/wailsapp/wails/pull/3429)
|
||||
- Add tests for bound method calls by [@abichinger](https://github.com/abichinger) in [#3431](https://github.com/wailsapp/wails/pull/3431)
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -59,6 +61,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Fix the import paths of model files in JS code produced by the binding generator by [@fbbdev](https://github.com/fbbdev) in [#3334](https://github.com/wailsapp/wails/pull/3334)
|
||||
- Fix drag-n-drop on some linux distros by [@abichinger](https://github.com/abichinger) in [#3346](https://github.com/wailsapp/wails/pull/3346)
|
||||
- Fix missing task for macOS when using `wails3 task dev` by [@hfoxy](https://github.com/hfoxy) in [#3417](https://github.com/wailsapp/wails/pull/3417)
|
||||
- Fix registering events causing a nil map assignment by [@hfoxy](https://github.com/hfoxy) in [#3426](https://github.com/wailsapp/wails/pull/3426)
|
||||
- Fix unmarshaling of bound method parameters by [@fbbdev](https://github.com/fbbdev) in [#3431](https://github.com/wailsapp/wails/pull/3431)
|
||||
- Fix handling of multiple return values from bound methods by [@fbbdev](https://github.com/fbbdev) in [#3431](https://github.com/wailsapp/wails/pull/3431)
|
||||
|
||||
### Changed
|
||||
|
||||
|
||||
+22
-3
@@ -132,12 +132,28 @@ tasks:
|
||||
- task: format
|
||||
# - task: docs:update:api
|
||||
|
||||
test:example:
|
||||
test:example:darwin:
|
||||
dir: 'examples/{{.DIR}}'
|
||||
platforms:
|
||||
- darwin
|
||||
cmds:
|
||||
- echo "Building example {{.DIR}}"
|
||||
- go mod tidy
|
||||
- go build -o "testbuild-{{.DIR}}{{exeExt}}"
|
||||
env:
|
||||
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
|
||||
CGO_CFLAGS: -mmacosx-version-min=10.13
|
||||
|
||||
test:example:notdarwin:
|
||||
dir: 'examples/{{.DIR}}'
|
||||
platforms:
|
||||
- linux
|
||||
- windows
|
||||
cmds:
|
||||
- echo "Building example {{.DIR}}"
|
||||
- go mod tidy
|
||||
- go build -o "testbuild-{{.DIR}}{{exeExt}}"
|
||||
|
||||
|
||||
test:examples:
|
||||
summary: Builds the examples
|
||||
@@ -155,7 +171,6 @@ tasks:
|
||||
hide-window
|
||||
keybindings
|
||||
menu
|
||||
oauth
|
||||
plain
|
||||
screen
|
||||
show-macos-toolbar
|
||||
@@ -166,6 +181,10 @@ tasks:
|
||||
wml
|
||||
cmds:
|
||||
- for: { var: EXAMPLEDIRS }
|
||||
task: test:example
|
||||
task: test:example:darwin
|
||||
vars:
|
||||
DIR: "{{.ITEM}}"
|
||||
- for: { var: EXAMPLEDIRS }
|
||||
task: test:example:notdarwin
|
||||
vars:
|
||||
DIR: "{{.ITEM}}"
|
||||
|
||||
@@ -1,17 +1,26 @@
|
||||
package main
|
||||
|
||||
import "github.com/wailsapp/wails/v3/examples/binding/data"
|
||||
import (
|
||||
"context"
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
)
|
||||
|
||||
// GreetService is a service that greets people
|
||||
type GreetService struct {
|
||||
}
|
||||
|
||||
// Greet greets a person
|
||||
func (*GreetService) Greet(name string) string {
|
||||
return "Hello " + name
|
||||
func (*GreetService) Greet(win application.Window, name string) string {
|
||||
return "Hello " + name + " on " + win.Name()
|
||||
}
|
||||
|
||||
// GreetPerson greets a person
|
||||
func (*GreetService) GreetPerson(person data.Person) string {
|
||||
return "Hello " + person.Name
|
||||
// GreetWithCtx greets a person
|
||||
func (*GreetService) GreetWithCtx(ctx context.Context, name string) string {
|
||||
win := ctx.Value("window").(application.Window)
|
||||
return "[ctx] Hello " + name + " on " + win.Name()
|
||||
}
|
||||
|
||||
// GreetWithCtx greets a person
|
||||
func (*GreetService) GreetWithBoth(_ context.Context, win application.Window, name string) string {
|
||||
return "[ctx+win] Hello " + name + " on " + win.Name()
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Ă‚ MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// Person holds someone's most important attributes
|
||||
export const Person = class {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @constructor
|
||||
* @param {Object} source - The source object to create the Person.
|
||||
* @param {string} source.Name
|
||||
*/
|
||||
constructor(source = {}) {
|
||||
const { name = "" } = source;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Person instance from a string or object.
|
||||
* @param {string|object} source - The source data to create a Person instance from.
|
||||
* @returns {Person} A new Person instance.
|
||||
*/
|
||||
static createFrom(source) {
|
||||
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
|
||||
return new Person(parsedSource);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -19,10 +19,20 @@ export async function Greet(name) {
|
||||
|
||||
/**
|
||||
* GreetPerson greets a person
|
||||
* @function GreetPerson
|
||||
* @param person {dataPerson}
|
||||
* @function GreetWithCtx
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
export async function GreetPerson(person) {
|
||||
return Call.ByName("main.GreetService.GreetPerson", ...Array.prototype.slice.call(arguments, 0));
|
||||
export async function GreetWithCtx(name) {
|
||||
return Call.ByName("main.GreetService.GreetWithCtx", ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* GreetPerson greets a person
|
||||
* @function GreetWithBoth
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
export async function GreetWithBoth(name) {
|
||||
return Call.ByName("main.GreetService.GreetWithBoth", ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
|
||||
@@ -83,9 +83,19 @@
|
||||
<script type="module">
|
||||
import * as GreetService from "./bindings/main/GreetService.js";
|
||||
|
||||
let state = 0;
|
||||
async function greet() {
|
||||
document.getElementById("result").innerHTML =
|
||||
await GreetService.Greet(document.getElementById("name").value);
|
||||
if(state % 3 === 0) {
|
||||
document.getElementById("result").innerHTML =
|
||||
await GreetService.Greet(document.getElementById("name").value);
|
||||
} else if(state % 3 === 1) {
|
||||
document.getElementById("result").innerHTML =
|
||||
await GreetService.GreetWithCtx(document.getElementById("name").value);
|
||||
} else {
|
||||
document.getElementById("result").innerHTML =
|
||||
await GreetService.GreetWithBoth(document.getElementById("name").value);
|
||||
}
|
||||
state++;
|
||||
}
|
||||
|
||||
document.getElementById("greet-btn").onclick = greet;
|
||||
|
||||
@@ -26,6 +26,8 @@ func main() {
|
||||
|
||||
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
URL: "/",
|
||||
Name: "Window 1",
|
||||
Title: "Window 1",
|
||||
DevToolsEnabled: true,
|
||||
})
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
body {
|
||||
padding-top: 75px;
|
||||
margin: 0 auto;
|
||||
color: white;
|
||||
background-color: white;
|
||||
color: black;
|
||||
text-align: -webkit-center;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif
|
||||
}
|
||||
@@ -54,9 +55,7 @@
|
||||
html += "<tr><td>Debug</td><td>"+ result.Debug +"</td></tr>";
|
||||
if(result.PlatformInfo) {
|
||||
for (let key in result.PlatformInfo) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
html += "<tr><td>"+key+"</td><td>"+ result.PlatformInfo[key] +"</td></tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
html += "</table>";
|
||||
|
||||
@@ -3,7 +3,7 @@ module github.com/wailsapp/wails/v3
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/atterpac/refresh v0.7.3
|
||||
github.com/atterpac/refresh v0.8.0
|
||||
github.com/bep/debounce v1.2.1
|
||||
github.com/ebitengine/purego v0.4.0-alpha.4
|
||||
github.com/go-git/go-git/v5 v5.11.0
|
||||
@@ -13,8 +13,6 @@ require (
|
||||
github.com/google/go-cmp v0.6.0
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
|
||||
github.com/google/uuid v1.3.0
|
||||
github.com/gorilla/pat v1.0.1
|
||||
github.com/gorilla/sessions v1.2.1
|
||||
github.com/jackmordaunt/icns/v2 v2.2.1
|
||||
github.com/jaypipes/ghw v0.12.0
|
||||
github.com/leaanthony/clir v1.6.0
|
||||
@@ -22,11 +20,10 @@ require (
|
||||
github.com/leaanthony/gosod v1.0.3
|
||||
github.com/leaanthony/u v1.1.0
|
||||
github.com/leaanthony/winicon v1.0.0
|
||||
github.com/lmittmann/tint v1.0.3
|
||||
github.com/markbates/goth v1.77.0
|
||||
github.com/lmittmann/tint v1.0.4
|
||||
github.com/matryer/is v1.4.0
|
||||
github.com/mattn/go-colorable v0.1.13
|
||||
github.com/mattn/go-isatty v0.0.19
|
||||
github.com/mattn/go-isatty v0.0.20
|
||||
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pterm/pterm v0.12.51
|
||||
@@ -34,7 +31,7 @@ require (
|
||||
github.com/tc-hib/winres v0.1.6
|
||||
github.com/wailsapp/go-webview2 v1.0.9
|
||||
github.com/wailsapp/mimetype v1.4.1
|
||||
golang.org/x/sys v0.18.0
|
||||
golang.org/x/sys v0.19.0
|
||||
modernc.org/sqlite v1.21.0
|
||||
)
|
||||
|
||||
@@ -48,9 +45,9 @@ require (
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
|
||||
github.com/StackExchange/wmi v1.2.1 // indirect
|
||||
github.com/cloudflare/circl v1.3.7 // indirect
|
||||
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
|
||||
github.com/containerd/console v1.0.4 // indirect
|
||||
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
|
||||
github.com/dustin/go-humanize v1.0.0 // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/emirpasic/gods v1.18.1 // indirect
|
||||
github.com/fatih/color v1.15.0 // indirect
|
||||
github.com/ghodss/yaml v1.0.0 // indirect
|
||||
@@ -58,11 +55,7 @@ require (
|
||||
github.com/go-git/go-billy/v5 v5.5.0 // indirect
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/protobuf v1.4.2 // indirect
|
||||
github.com/gookit/color v1.5.2 // indirect
|
||||
github.com/gorilla/context v1.1.1 // indirect
|
||||
github.com/gorilla/mux v1.6.2 // indirect
|
||||
github.com/gorilla/securecookie v1.1.1 // indirect
|
||||
github.com/jaypipes/pcidb v1.0.0 // indirect
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
|
||||
@@ -92,13 +85,10 @@ require (
|
||||
golang.org/x/image v0.15.0 // indirect
|
||||
golang.org/x/mod v0.12.0 // indirect
|
||||
golang.org/x/net v0.21.0 // indirect
|
||||
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 // indirect
|
||||
golang.org/x/sync v0.4.0 // indirect
|
||||
golang.org/x/term v0.18.0 // indirect
|
||||
golang.org/x/sync v0.7.0 // indirect
|
||||
golang.org/x/term v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
golang.org/x/tools v0.13.0 // indirect
|
||||
google.golang.org/appengine v1.6.6 // indirect
|
||||
google.golang.org/protobuf v1.25.0 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,35 +0,0 @@
|
||||
[config]
|
||||
root_path = "."
|
||||
# debug | info | warn | error | mute
|
||||
# Defaults to Info if not provided
|
||||
log_level = "warn"
|
||||
# Debounce setting for ignoring reptitive file system notifications
|
||||
debounce = 1000 # Milliseconds
|
||||
# Sets what files the watcher should ignore
|
||||
[config.ignore]
|
||||
# Directories to ignore
|
||||
dir = [".git", "node_modules", "frontend", "bin"]
|
||||
# Files to ignore
|
||||
file = [".DS_Store", ".gitignore", ".gitkeep"]
|
||||
# File extensions to watch
|
||||
watched_extension = ["*.go"]
|
||||
# Add .gitignore paths to ignore
|
||||
git_ignore = true
|
||||
|
||||
[config.background]
|
||||
cmd = "wails3 task dev:frontend"
|
||||
|
||||
[[config.executes]]
|
||||
cmd = "go mod tidy"
|
||||
blocking = true
|
||||
|
||||
[[config.executes]]
|
||||
cmd = "wails3 task build"
|
||||
blocking = true
|
||||
|
||||
[[config.executes]]
|
||||
cmd = "KILL_STALE"
|
||||
|
||||
[[config.executes]]
|
||||
cmd = "wails3 task run"
|
||||
primary = true
|
||||
@@ -0,0 +1,28 @@
|
||||
config:
|
||||
root_path: .
|
||||
log_level: warn
|
||||
debounce: 1000
|
||||
ignore:
|
||||
dir:
|
||||
- .git
|
||||
- node_modules
|
||||
- frontend
|
||||
- bin
|
||||
file:
|
||||
- .DS_Store
|
||||
- .gitignore
|
||||
- .gitkeep
|
||||
watched_extension:
|
||||
- "*.go"
|
||||
git_ignore: true
|
||||
executes:
|
||||
- cmd: wails3 task install:frontend:deps
|
||||
type: once
|
||||
- cmd: wails3 task dev:frontend
|
||||
type: background
|
||||
- cmd: go mod tidy
|
||||
type: blocking
|
||||
- cmd: wails3 task build
|
||||
type: blocking
|
||||
- cmd: wails3 task run
|
||||
type: primary
|
||||
@@ -0,0 +1,53 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/wailsapp/wails/v3/internal/flags"
|
||||
)
|
||||
|
||||
const defaultVitePort = 9245
|
||||
const wailsVitePort = "WAILS_VITE_PORT"
|
||||
|
||||
type DevOptions struct {
|
||||
flags.Common
|
||||
|
||||
Config string `description:"The config file including path" default:"./build/devmode.config.yaml"`
|
||||
VitePort int `name:"port" description:"Specify the vite dev server port"`
|
||||
}
|
||||
|
||||
func Dev(options *DevOptions) error {
|
||||
host := "localhost"
|
||||
|
||||
// flag takes precedence over environment variable
|
||||
var port int
|
||||
if options.VitePort != 0 {
|
||||
port = options.VitePort
|
||||
} else if p, err := strconv.Atoi(os.Getenv(wailsVitePort)); err == nil {
|
||||
port = p
|
||||
} else {
|
||||
port = defaultVitePort
|
||||
}
|
||||
|
||||
// check if port is already in use
|
||||
l, err := net.Listen("tcp", fmt.Sprintf("%s:%d", host, port))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = l.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Set environment variable for the dev:frontend task
|
||||
os.Setenv(wailsVitePort, strconv.Itoa(port))
|
||||
|
||||
// Set url of frontend dev server
|
||||
os.Setenv("FRONTEND_DEVSERVER_URL", fmt.Sprintf("http://%s:%d", host, port))
|
||||
|
||||
return Watcher(&WatcherOptions{
|
||||
Config: options.Config,
|
||||
})
|
||||
}
|
||||
@@ -1,19 +1,16 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/pterm/pterm"
|
||||
"github.com/wailsapp/wails/v3/internal/flags"
|
||||
"os"
|
||||
)
|
||||
|
||||
func Build(_ *flags.Build) error {
|
||||
return wrapTask("build")
|
||||
}
|
||||
|
||||
func Dev(_ *flags.Dev) error {
|
||||
return wrapTask("dev")
|
||||
}
|
||||
|
||||
func Package(_ *flags.Package) error {
|
||||
return wrapTask("package")
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ type WatcherOptions struct {
|
||||
|
||||
func Watcher(options *WatcherOptions) error {
|
||||
stopChan := make(chan struct{})
|
||||
watcherEngine, err := engine.NewEngineFromTOML(options.Config)
|
||||
watcherEngine, err := engine.NewEngineFromYAML(options.Config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user