mirror of
https://github.com/wavetermdev/wails.git
synced 2026-04-22 15:26:15 -07:00
Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 27ab3cf4e7 | |||
| 31b609dff0 | |||
| fbf75b1d14 | |||
| e9aa0d5c5a | |||
| cdfd70d3f7 | |||
| 7287fcc170 | |||
| c378d935f3 | |||
| 8eae31d865 | |||
| c7c068ade0 | |||
| b02dbfaddf | |||
| c63b1f1981 | |||
| 944494c4ef | |||
| a971751dab | |||
| 6ec670129b | |||
| 4506da041a | |||
| e9962198d0 | |||
| 82cb3b99e5 | |||
| dfb3ab0681 | |||
| 5b60fcc8f6 | |||
| 9e08fd668c | |||
| 513c1fd981 | |||
| 3866da944c | |||
| 613a9e3143 | |||
| ff8e701793 | |||
| 451b0c1e15 | |||
| 8ce9ee8e41 | |||
| 9593ea95f7 | |||
| c872802ced | |||
| a445db1b7b | |||
| fff838d7c6 |
@@ -6,15 +6,9 @@ labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
#####################################################
|
||||
**V1 users: If you have a technical issue, please do not open a bug this way!**
|
||||
Please use the `wails issue` command!
|
||||
If you do not do this then the issue may be closed automatically.
|
||||
|
||||
NOTE: If your bug is related to Windows, make sure you read
|
||||
the [Windows Developer Guide](https://wails.app/guides/windows/)
|
||||
#####################################################
|
||||
<!---
|
||||
*** Please note: No new bug reports are being accepted for Wails v1 ***
|
||||
--->
|
||||
|
||||
**Description**
|
||||
A clear and concise description of what the bug is.
|
||||
@@ -33,9 +27,7 @@ A clear and concise description of what you expected to happen.
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**System Details**
|
||||
V2 users: Please add the output of `wails doctor`.
|
||||
Please add the output of `wails doctor`.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
|
||||
- [ ] This issue is for Windows and I have read the [Windows Developer Guide](https://wails.app/guides/windows/)
|
||||
|
||||
@@ -6,6 +6,9 @@ labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
<!---
|
||||
*** Please note: No new feature requests are being accepted for Wails v1 ***
|
||||
--->
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<p align="center" style="text-align: center">
|
||||
<img src="logo.png" width="55%"><br/>
|
||||
<img src="logo-universal.png" width="55%"><br/>
|
||||
</p>
|
||||
<p align="center">
|
||||
Build desktop applications using Go & Web Technologies.<br/><br/>
|
||||
@@ -79,12 +79,18 @@ approach: it provides the ability to wrap both Go code and a web frontend into a
|
||||
make this easy for you by handling project creation, compilation and bundling. All you have to do is get creative!
|
||||
|
||||
<span id="nav-3-1"></span>
|
||||
<hr/>
|
||||
<h3><strong>PLEASE NOTE: As we are approaching the v2 release, we are not accepting any new feature requests or bug reports for v1. If you have a critical issue, please open a ticket and state why it is critical.</strong></h3>
|
||||
<hr/>
|
||||
|
||||
### Official Website
|
||||
### Version 2
|
||||
|
||||
The official docs can be found at [https://wails.app](https://wails.app).
|
||||
Wails v2 has been released in Beta for all 3 platforms. Check out the [new website](https://wails.io) if you are
|
||||
interested in trying it out.
|
||||
|
||||
Click [here](https://wails.io) if you are interested in trying out v2 Beta for Windows.
|
||||
### Legacy v1 Website
|
||||
|
||||
The legacy v1 docs can be found at [https://wails.app](https://wails.app).
|
||||
|
||||
<span id="nav-4"></span>
|
||||
|
||||
|
||||
+6
-2
@@ -1,5 +1,5 @@
|
||||
<p align="center" style="text-align: center">
|
||||
<img src="logo.png" width="55%"><br/>
|
||||
<img src="logo-universal.png" width="55%"><br/>
|
||||
</p>
|
||||
<p align="center">
|
||||
使用 Go 和 Web 技术构建桌面应用程序。<br/><br/>
|
||||
@@ -81,9 +81,13 @@
|
||||
|
||||
### 官方网站
|
||||
|
||||
#### v1
|
||||
|
||||
官方文档可以在 [https://wails.app](https://wails.app) 中找到。
|
||||
|
||||
如果您对适用于 Windows 的 v2 测试版感兴趣,可以点击[此处](https://wails.io)查看。
|
||||
#### v2
|
||||
|
||||
Wails v2 已针对所有 3 个平台发布了 Beta 版。如果您有兴趣尝试一下,请查看[新网站](https://wails.io)。
|
||||
|
||||
镜像网站:
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 147 KiB |
@@ -93,6 +93,9 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
||||
debug := false
|
||||
command.BoolFlag("debug", "Retains debug data in the compiled application", &debug)
|
||||
|
||||
nsis := false
|
||||
command.BoolFlag("nsis", "Generate NSIS installer for Windows", &nsis)
|
||||
|
||||
command.Action(func() error {
|
||||
|
||||
quiet := verbosity == 0
|
||||
@@ -117,20 +120,12 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
||||
}
|
||||
|
||||
// Tags
|
||||
experimental := false
|
||||
userTags := []string{}
|
||||
for _, tag := range strings.Split(tags, " ") {
|
||||
thisTag := strings.TrimSpace(tag)
|
||||
if thisTag != "" {
|
||||
userTags = append(userTags, thisTag)
|
||||
}
|
||||
if thisTag == "exp" {
|
||||
experimental = true
|
||||
}
|
||||
}
|
||||
|
||||
if runtime.GOOS == "linux" && !experimental {
|
||||
return fmt.Errorf("Linux version coming soon!")
|
||||
}
|
||||
|
||||
// Webview2 installer strategy (download by default)
|
||||
@@ -214,6 +209,9 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
||||
return err
|
||||
}
|
||||
projectOptions, err := project.Load(cwd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Check platform
|
||||
validPlatformArch := slicer.String([]string{
|
||||
@@ -229,7 +227,15 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
||||
"windows/arm64",
|
||||
})
|
||||
|
||||
outputBinaries := map[string]string{}
|
||||
|
||||
// Allows cancelling the build after the first error. It would be nice if targets.Each would support funcs
|
||||
// returning an error.
|
||||
var targetErr error
|
||||
targets.Each(func(platform string) {
|
||||
if targetErr != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if !validPlatformArch.Contains(platform) {
|
||||
buildOptions.Logger.Println("platform '%s' is not supported - skipping. Supported platforms: %s", platform, validPlatformArch.Join(","))
|
||||
@@ -301,18 +307,35 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
||||
|
||||
outputFilename, err := build.Build(buildOptions)
|
||||
if err != nil {
|
||||
logger.Println("Error: ", err.Error())
|
||||
logger.Println("Error: %s", err.Error())
|
||||
targetErr = err
|
||||
return
|
||||
}
|
||||
|
||||
// Subsequent iterations
|
||||
buildOptions.IgnoreFrontend = true
|
||||
buildOptions.CleanBuildDirectory = false
|
||||
|
||||
// Output stats
|
||||
buildOptions.Logger.Println(fmt.Sprintf("Built '%s' in %s.\n", outputFilename, time.Since(start).Round(time.Millisecond).String()))
|
||||
|
||||
outputBinaries[platform] = outputFilename
|
||||
})
|
||||
|
||||
if targetErr != nil {
|
||||
return targetErr
|
||||
}
|
||||
|
||||
if nsis {
|
||||
amd64Binary := outputBinaries["windows/amd64"]
|
||||
arm64Binary := outputBinaries["windows/arm64"]
|
||||
if amd64Binary == "" && arm64Binary == "" {
|
||||
return fmt.Errorf("cannot build nsis installer - no windows targets")
|
||||
}
|
||||
|
||||
if err := build.GenerateNSISInstaller(buildOptions, amd64Binary, arm64Binary); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -103,20 +103,12 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||
logger := clilogger.New(w)
|
||||
app.PrintBanner()
|
||||
|
||||
experimental := false
|
||||
userTags := []string{}
|
||||
for _, tag := range strings.Split(flags.tags, " ") {
|
||||
thisTag := strings.TrimSpace(tag)
|
||||
if thisTag != "" {
|
||||
userTags = append(userTags, thisTag)
|
||||
}
|
||||
if thisTag == "exp" {
|
||||
experimental = true
|
||||
}
|
||||
}
|
||||
|
||||
if runtime.GOOS == "linux" && !experimental {
|
||||
return fmt.Errorf("Linux version coming soon!")
|
||||
}
|
||||
|
||||
cwd, err := os.Getwd()
|
||||
@@ -150,10 +142,10 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// frontend:dev server command
|
||||
if projectConfig.DevCommand != "" {
|
||||
// frontend:dev:watcher command.
|
||||
if command := projectConfig.DevWatcherCommand; command != "" {
|
||||
var devCommandWaitGroup sync.WaitGroup
|
||||
closer := runFrontendDevCommand(cwd, projectConfig.DevCommand, &devCommandWaitGroup)
|
||||
closer := runFrontendDevWatcherCommand(cwd, command, &devCommandWaitGroup)
|
||||
defer closer(&devCommandWaitGroup)
|
||||
}
|
||||
|
||||
@@ -376,9 +368,9 @@ func loadAndMergeProjectConfig(cwd string, flags *devFlags) (*project.Project, e
|
||||
return projectConfig, nil
|
||||
}
|
||||
|
||||
// runFrontendDevCommand will run the `frontend:dev` command if it was given, ex- `npm run dev`
|
||||
func runFrontendDevCommand(cwd string, devCommand string, wg *sync.WaitGroup) func(group *sync.WaitGroup) {
|
||||
LogGreen("Running frontend dev command: '%s'", devCommand)
|
||||
// runFrontendDevWatcherCommand will run the `frontend:dev:watcher` command if it was given, ex- `npm run dev`
|
||||
func runFrontendDevWatcherCommand(cwd string, devCommand string, wg *sync.WaitGroup) func(group *sync.WaitGroup) {
|
||||
LogGreen("Running frontend dev watcher command: '%s'", devCommand)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
dir := filepath.Join(cwd, "frontend")
|
||||
cmdSlice := strings.Split(devCommand, " ")
|
||||
|
||||
@@ -26,6 +26,13 @@ func (a App) domReady(ctx context.Context) {
|
||||
// Add your action here
|
||||
}
|
||||
|
||||
// beforeClose is called when the application is about to quit,
|
||||
// either by clicking the window close button or calling runtime.Quit.
|
||||
// Returning true will cause the application to continue, false will continue shutdown as normal.
|
||||
func (a *App) beforeClose(ctx context.Context) (prevent bool) {
|
||||
return false
|
||||
}
|
||||
|
||||
// shutdown is called at application termination
|
||||
func (a *App) shutdown(ctx context.Context) {
|
||||
// Perform your teardown here
|
||||
|
||||
@@ -7,23 +7,27 @@ import (
|
||||
"github.com/wailsapp/wails/v2"
|
||||
"github.com/wailsapp/wails/v2/pkg/logger"
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/mac"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/windows"
|
||||
)
|
||||
|
||||
//go:embed frontend/dist
|
||||
var assets embed.FS
|
||||
|
||||
//go:embed build/appicon.png
|
||||
var icon []byte
|
||||
|
||||
func main() {
|
||||
// Create an instance of the app structure
|
||||
app := NewApp()
|
||||
|
||||
// Create application with options
|
||||
err := wails.Run(&options.App{
|
||||
Title: "{{.ProjectName}}",
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
// MinWidth: 720,
|
||||
// MinHeight: 570,
|
||||
Title: "{{.ProjectName}}",
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
MinWidth: 1024,
|
||||
MinHeight: 768,
|
||||
// MaxWidth: 1280,
|
||||
// MaxHeight: 740,
|
||||
DisableResize: false,
|
||||
@@ -31,12 +35,16 @@ func main() {
|
||||
Frameless: false,
|
||||
StartHidden: false,
|
||||
HideWindowOnClose: false,
|
||||
RGBA: &options.RGBA{255, 255, 255, 255},
|
||||
RGBA: &options.RGBA{R: 255, G: 255, B: 255, A: 255},
|
||||
Assets: assets,
|
||||
Menu: nil,
|
||||
Logger: nil,
|
||||
LogLevel: logger.DEBUG,
|
||||
OnStartup: app.startup,
|
||||
OnDomReady: app.domReady,
|
||||
OnBeforeClose: app.beforeClose,
|
||||
OnShutdown: app.shutdown,
|
||||
WindowStartState: options.Normal,
|
||||
Bind: []interface{}{
|
||||
app,
|
||||
},
|
||||
@@ -45,6 +53,27 @@ func main() {
|
||||
WebviewIsTransparent: false,
|
||||
WindowIsTranslucent: false,
|
||||
DisableWindowIcon: false,
|
||||
// DisableFramelessWindowDecorations: false,
|
||||
WebviewUserDataPath: "",
|
||||
},
|
||||
// Mac platform specific options
|
||||
Mac: &mac.Options{
|
||||
TitleBar: &mac.TitleBar{
|
||||
TitlebarAppearsTransparent: true,
|
||||
HideTitle: false,
|
||||
HideTitleBar: false,
|
||||
FullSizeContent: false,
|
||||
UseToolbar: false,
|
||||
HideToolbarSeparator: true,
|
||||
},
|
||||
Appearance: mac.NSAppearanceNameDarkAqua,
|
||||
WebviewIsTransparent: true,
|
||||
WindowIsTranslucent: true,
|
||||
About: &mac.AboutInfo{
|
||||
Title: "{{.ProjectName}}",
|
||||
Message: "",
|
||||
Icon: icon,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"name": "{{.ProjectName}}",
|
||||
"author": "",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"install": "go install github.com/wailsapp/wails/v2/cmd/wails@latest",
|
||||
"build": "wails build --clean",
|
||||
"build:macos": "npm run build -- --platform darwin/universal",
|
||||
"build:macos-arm": "npm run build -- --platform darwin/arm64",
|
||||
"build:macos-intel": "npm run build -- --platform darwin",
|
||||
"build:windows": "npm run build -- --platform windows/amd64"
|
||||
},
|
||||
"workspaces": [
|
||||
"frontend"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#! /bin/bash
|
||||
|
||||
echo -e "Start running the script..."
|
||||
cd ../
|
||||
|
||||
echo -e "Start building the app for macos platform..."
|
||||
wails build --clean --platform darwin/arm64
|
||||
|
||||
echo -e "End running the script!"
|
||||
@@ -0,0 +1,9 @@
|
||||
#! /bin/bash
|
||||
|
||||
echo -e "Start running the script..."
|
||||
cd ../
|
||||
|
||||
echo -e "Start building the app for macos platform..."
|
||||
wails build --clean --platform darwin
|
||||
|
||||
echo -e "End running the script!"
|
||||
@@ -0,0 +1,9 @@
|
||||
#! /bin/bash
|
||||
|
||||
echo -e "Start running the script..."
|
||||
cd ../
|
||||
|
||||
echo -e "Start building the app for macos platform..."
|
||||
wails build --clean --platform darwin/universal
|
||||
|
||||
echo -e "End running the script!"
|
||||
@@ -0,0 +1,9 @@
|
||||
#! /bin/bash
|
||||
|
||||
echo -e "Start running the script..."
|
||||
cd ../
|
||||
|
||||
echo -e "Start building the app for windows platform..."
|
||||
wails build --clean --platform windows/amd64
|
||||
|
||||
echo -e "End running the script!"
|
||||
@@ -0,0 +1,9 @@
|
||||
#! /bin/bash
|
||||
|
||||
echo -e "Start running the script..."
|
||||
cd ../
|
||||
|
||||
echo -e "Start building the app..."
|
||||
wails build --clean
|
||||
|
||||
echo -e "End running the script!"
|
||||
@@ -0,0 +1,14 @@
|
||||
#! /bin/bash
|
||||
|
||||
echo -e "Start running the script..."
|
||||
cd ../
|
||||
|
||||
echo -e "Current Go version: \c"
|
||||
go version
|
||||
|
||||
echo -e "Install the Wails command line tool..."
|
||||
go install github.com/wailsapp/wails/v2/cmd/wails@latest
|
||||
|
||||
echo -e "Successful installation!"
|
||||
|
||||
echo -e "End running the script!"
|
||||
@@ -2,8 +2,6 @@ package initialise
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/flytam/filenamify"
|
||||
"github.com/leaanthony/slicer"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
@@ -11,6 +9,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/flytam/filenamify"
|
||||
"github.com/leaanthony/slicer"
|
||||
|
||||
"github.com/wailsapp/wails/v2/pkg/buildassets"
|
||||
|
||||
"github.com/wailsapp/wails/v2/cmd/wails/internal/commands/initialise/templates"
|
||||
@@ -149,7 +150,7 @@ func initProject(options *templates.Options, quiet bool) error {
|
||||
}
|
||||
|
||||
// Install the default assets
|
||||
err = buildassets.Install(options.TargetDir, options.ProjectName)
|
||||
err = buildassets.Install(options.TargetDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/go-git/go-git/v5"
|
||||
"github.com/go-git/go-git/v5/plumbing"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/leaanthony/debme"
|
||||
@@ -295,9 +296,17 @@ func gitclone(options *Options) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
_, err = git.PlainClone(dirname, false, &git.CloneOptions{
|
||||
URL: options.TemplateName,
|
||||
})
|
||||
|
||||
// Parse remote template url and version number
|
||||
templateInfo := strings.Split(options.TemplateName, "@")
|
||||
cloneOption := &git.CloneOptions{
|
||||
URL: templateInfo[0],
|
||||
}
|
||||
if len(templateInfo) > 1 {
|
||||
cloneOption.ReferenceName = plumbing.NewTagReferenceName(templateInfo[1])
|
||||
}
|
||||
|
||||
_, err = git.PlainClone(dirname, false, cloneOption)
|
||||
|
||||
return dirname, err
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user