mirror of
https://github.com/wavetermdev/wails.git
synced 2026-04-22 15:26:15 -07:00
Compare commits
217 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b49dce8676 | |||
| 6a88568f0a | |||
| a10a9e5b36 | |||
| e7f9e2f267 | |||
| 316a24f6da | |||
| c874e30339 | |||
| 043d83e39e | |||
| 7e64038265 | |||
| d4ecaad0e1 | |||
| 953bc09343 | |||
| 935f6871ab | |||
| 0d793124fd | |||
| c97e1c50af | |||
| 35b1dfdd2a | |||
| e705c20de9 | |||
| ae25b38f9e | |||
| ec2202765c | |||
| e0e55e6e76 | |||
| 4d5f31ab84 | |||
| b84fd76e86 | |||
| 55115742c1 | |||
| f2f8ed2e99 | |||
| d59bec171e | |||
| bff0ece017 | |||
| 7c0d1019f2 | |||
| a3de4577dd | |||
| 4986f9cea5 | |||
| 0f2fc1ab7a | |||
| 5f612301f9 | |||
| 84b6273baf | |||
| 9c8a3a62da | |||
| 6224d3aa82 | |||
| 2d66d2146a | |||
| e5cc18cfc5 | |||
| 531d7cfb62 | |||
| 9c7ef2d47c | |||
| 490388ae8f | |||
| fac2a8ba3c | |||
| 912d7cf34b | |||
| 848ea88207 | |||
| 22d3f93b52 | |||
| d9120181b7 | |||
| 0a9ae0dff3 | |||
| 3dbe2a0942 | |||
| ac81d5aa3d | |||
| 2e1f758f20 | |||
| 41f9c07c88 | |||
| a8357a2459 | |||
| bd344bf32c | |||
| ded28cf9c2 | |||
| e7aa74905a | |||
| 781a0df72e | |||
| 8aaa0e0d9d | |||
| ef8dc44317 | |||
| 524411964f | |||
| 75ee36f8eb | |||
| 7f3f56663f | |||
| f6257d3d31 | |||
| 2e3c90c096 | |||
| 4e9eda8e1f | |||
| 02fcf738d3 | |||
| 053f2748d5 | |||
| ad6a7d5a8c | |||
| 93defccf4d | |||
| 5ffc815d34 | |||
| 4e03c84fbb | |||
| 7fbae0d333 | |||
| 82806d47b3 | |||
| cb2de2ad30 | |||
| 6d09a45a30 | |||
| 3fbe4f71c4 | |||
| 56206729ef | |||
| c70d93b482 | |||
| 5f596c7679 | |||
| ebf4cf13f2 | |||
| f08176079c | |||
| 65a97a668e | |||
| 0c244b1ce4 | |||
| 3b85c75359 | |||
| c3a98b058e | |||
| b94db409dd | |||
| 43f8a1f773 | |||
| dce5fd442f | |||
| f21c9ba880 | |||
| 55855ccc4d | |||
| eb97f53124 | |||
| f192cbd01b | |||
| 625eca27f6 | |||
| a65a40fb4c | |||
| 2465538448 | |||
| bb2da2f810 | |||
| 6b38f0c68e | |||
| 95b70de01f | |||
| 78c6705cc3 | |||
| 8bb3af2282 | |||
| 2c8d94ca48 | |||
| d5a8ee0132 | |||
| 55cec7af17 | |||
| 90fc96b494 | |||
| 8e8b88ef48 | |||
| 4a20655b29 | |||
| 4721949657 | |||
| d119fce3c3 | |||
| f6cdafa5ff | |||
| 7af39e4819 | |||
| 073f8202e5 | |||
| 8f860c9ea6 | |||
| f734d26adb | |||
| 7dd3f96915 | |||
| 584f88f727 | |||
| 2376062008 | |||
| 5ead563989 | |||
| f55f965b3d | |||
| a22383df07 | |||
| 65fb42d9e7 | |||
| 4cedfdc091 | |||
| 085d59612b | |||
| d8bcf7ac70 | |||
| ec31d49b59 | |||
| 6883337a18 | |||
| 3b81986bdd | |||
| ec59eff352 | |||
| b6de689400 | |||
| 1da68cfc7c | |||
| a5bf76b30f | |||
| c78ee7e49b | |||
| 7749980040 | |||
| 222deff03c | |||
| 6a3e73de3f | |||
| 498fa51605 | |||
| 92df5fabba | |||
| 983306c13d | |||
| e403ad8063 | |||
| 1f7b7f5e6c | |||
| 48254b73e5 | |||
| 2e21f25182 | |||
| 1f96484e8c | |||
| ccbfafd576 | |||
| 0053641796 | |||
| 55f2a24a94 | |||
| 2d2ee95c8a | |||
| 47bf92850c | |||
| f98571fae5 | |||
| e314c41337 | |||
| 2c65415268 | |||
| b002830897 | |||
| fcf52abec8 | |||
| 8e3cb27bfe | |||
| 78212603bc | |||
| 1996e8b2ba | |||
| d7395fc56a | |||
| a278c9e164 | |||
| 60c6dce07d | |||
| 3972093ede | |||
| e78557ec24 | |||
| ea4d479be3 | |||
| 15e5eb67f9 | |||
| 8aea6a3bfc | |||
| 9c5600d8f3 | |||
| 97b24a51a1 | |||
| 106ff03f2e | |||
| d9e5cce2b2 | |||
| daad8437c2 | |||
| 8037eab895 | |||
| 09756b5150 | |||
| a52d68438b | |||
| f4d1d02ded | |||
| 3d12935e2e | |||
| 64480ff1ab | |||
| abe8ba9266 | |||
| 1048782eb4 | |||
| 622c4adad6 | |||
| ae6da05e9d | |||
| ba0b173e02 | |||
| 9097c9086b | |||
| c5c0617c89 | |||
| d29e01d552 | |||
| 122806161b | |||
| 3a23662a34 | |||
| 659cc3ed61 | |||
| 2a096a6ff9 | |||
| 0c09fe4560 | |||
| 51dd1361e3 | |||
| a48ea8768f | |||
| 95d34c510e | |||
| d36e130315 | |||
| 7d8f2243ae | |||
| 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 |
@@ -1,41 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
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/)
|
||||
#####################################################
|
||||
|
||||
**Description**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behaviour:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behaviour**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**System Details**
|
||||
V2 users: 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/)
|
||||
@@ -0,0 +1,81 @@
|
||||
name: Bug Report
|
||||
description: Create a report to help us improve
|
||||
# title: ""
|
||||
labels: ["bug"]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
***Please note: No new bug reports are being accepted for Wails v1***
|
||||
Before submitting this issue, please do the following:
|
||||
- Do a web search for your error. This usually leads to a much better understanding of the issue.
|
||||
- Prove that the error is indeed a Wails bug and not an application bug, with a specific set of steps to reproduce.
|
||||
- Search both the issue tracker (even closed issues) and discussion forums.
|
||||
- Try to fix it yourself. Keep a list of things you have done to fix the problem.
|
||||
|
||||
If after doing all the above, the problem remains, please continue with this ticket providing *all* the information requested.
|
||||
|
||||
Bug reports that do not follow these steps will likely be closed, so please help us to help you.
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: A clear and concise description of what the bug is.
|
||||
placeholder: A clear and concise description of what the bug is.
|
||||
# value: ""
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduce
|
||||
attributes:
|
||||
label: To Reproduce
|
||||
description: Steps to reproduce the behaviour
|
||||
placeholder: |
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected-behaviour
|
||||
attributes:
|
||||
label: Expected behaviour
|
||||
description: A clear and concise description of what you expected to happen.
|
||||
placeholder: A clear and concise description of what you expected to happen.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: screenshots
|
||||
attributes:
|
||||
label: Screenshots
|
||||
description: If applicable, add screenshots to help explain your problem.
|
||||
placeholder: If applicable, add screenshots to help explain your problem.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: attempted-fixes
|
||||
attributes:
|
||||
label: Attempted Fixes
|
||||
description: A list of things you have tried to fix the problem, including search engine links.
|
||||
placeholder: A list of things you have tried to fix the problem, including search engine links.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: systemetails
|
||||
attributes:
|
||||
label: System Details
|
||||
description: Please add the output of `wails doctor`.
|
||||
render: shell
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: additional-context
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Add any other context about the problem here.
|
||||
placeholder: Add any other context about the problem here.
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: GitHub Community Discussions
|
||||
url: https://github.com/wailsapp/wails/discussions
|
||||
about: If your question is not a feature or a bug, please go to the discussion panel and retrieve if your question already exists before submitting.
|
||||
@@ -1,20 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**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 [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
@@ -0,0 +1,38 @@
|
||||
name: Feature request
|
||||
description: Suggest an idea for this project
|
||||
# title: ""
|
||||
labels: ["enhancement"]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
***Please note: No new feature requests are being accepted for Wails v1***
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Is your feature request related to a problem? Please describe.
|
||||
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Describe the solution you'd like
|
||||
description: A clear and concise description of what you want to happen.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Describe alternatives you've considered
|
||||
description: A clear and concise description of any alternative solutions or features you've considered.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Add any other context or screenshots about the feature request here.
|
||||
validations:
|
||||
required: false
|
||||
+4
-1
@@ -8,6 +8,7 @@ exemptLabels:
|
||||
- security
|
||||
- onhold
|
||||
- inprogress
|
||||
- "Selected For Development"
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: wontfix
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
@@ -16,4 +17,6 @@ markComment: >
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: false
|
||||
closeComment: false
|
||||
exemptMilestones: true
|
||||
exemptAssignees: true
|
||||
|
||||
@@ -31,3 +31,4 @@ v2/test/kitchensink/frontend/package.json.md5
|
||||
!v2/internal/ffenestri/windows/x64/webview2.dll
|
||||
!v2/internal/ffenestri/windows/x64/WebView2Loader.dll
|
||||
.idea/
|
||||
v2/cmd/wails/internal/commands/initialise/templates/testtemplates/
|
||||
|
||||
@@ -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/>
|
||||
@@ -52,53 +52,50 @@
|
||||
- [4. Features](#nav-4)
|
||||
- [5. Sponsors](#nav-5)
|
||||
- [6. Installation](#nav-6)
|
||||
- [6.1 MacOS](#nav-6-1)
|
||||
- [6.2 Linux](#nav-6-2)
|
||||
- [6.2.1 Debian/Ubuntu](#nav-6-2-1)
|
||||
- [6.2.2 Arch Linux / ArchLabs / Ctlos Linux](#nav-6-2-2)
|
||||
- [6.2.3 Centos](#nav-6-2-3)
|
||||
- [6.2.4 Fedora](#nav-6-2-4)
|
||||
- [6.2.5 VoidLinux & VoidLinux-musl](#nav-6-2-5)
|
||||
- [6.2.6 Gentoo](#nav-6-2-6)
|
||||
- [6.3 Windows](#nav-6-3)
|
||||
- [7. Usage](#nav-7)
|
||||
- [7.1 Next Steps](#nav-7-1)
|
||||
- [8. FAQ](#nav-8)
|
||||
- [9. Contributors](#nav-9)
|
||||
- [10. Special Mentions](#nav-10)
|
||||
- [12. Special Thanks](#nav-11)
|
||||
- [7. FAQ](#nav-8)
|
||||
- [8. Contributors](#nav-9)
|
||||
- [9. Special Mentions](#nav-10)
|
||||
- [10. Special Thanks](#nav-11)
|
||||
|
||||
</details>
|
||||
|
||||
<span id="nav-3"></span>
|
||||
|
||||
## Introductions
|
||||
## Introduction
|
||||
|
||||
The traditional method of providing web interfaces to Go programs is via a built-in web server. Wails offers a different
|
||||
approach: it provides the ability to wrap both Go code and a web frontend into a single binary. Tools are provided to
|
||||
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>
|
||||
|
||||
## Features
|
||||
|
||||
- Use standard Go for the backend
|
||||
- Use any frontend technology to build your UI
|
||||
- Quickly create Vue, Vuetify or React frontends for your Go programs
|
||||
- Expose Go methods/functions to the frontend via a single bind command
|
||||
- Uses native rendering engines - no embedded browser
|
||||
- Shared events system
|
||||
- Native file dialogs
|
||||
- Powerful cli tool
|
||||
- Use any frontend technology you are already familiar with to build your UI
|
||||
- Quickly create rich frontends for your Go programs using pre-built templates
|
||||
- Easily call Go methods from Javascript
|
||||
- Auto-generated Typescript definitions for your Go structs and methods
|
||||
- Native Dialogs & Menus
|
||||
- Supports modern translucency and "frosted window" effects
|
||||
- Unified eventing system between Go and Javascript
|
||||
- Powerful cli tool to quickly generate and build your projects
|
||||
- Multiplatform
|
||||
- Uses native rendering engines - *no embedded browser*!
|
||||
|
||||
<span id="nav-5"></span>
|
||||
|
||||
@@ -109,8 +106,8 @@ This project is supported by these kind people / companies:
|
||||
<a href="https://github.com/sponsors/leaanthony" style="width:100px;">
|
||||
<img src="/img/silver%20sponsor.png" width="100"/>
|
||||
</a>
|
||||
<a href="https://github.com/letheanVPN" style="width:100px;">
|
||||
<img src="https://github.com/letheanVPN.png?size=100" width="100"/>
|
||||
<a href="https://github.com/selvindev" style="width:100px;">
|
||||
<img src="https://github.com/selvindev.png?size=100" width="100"/>
|
||||
</a>
|
||||
<br/>
|
||||
<br/>
|
||||
@@ -123,9 +120,6 @@ This project is supported by these kind people / companies:
|
||||
<a href="https://github.com/codydbentley" style="width:100px">
|
||||
<img src="https://github.com/codydbentley.png?size=100" width="100"/>
|
||||
</a>
|
||||
<a href="https://github.com/CrackDavid" style="width:100px">
|
||||
<img src="https://github.com/CrackDavid.png?size=100" width="100"/>
|
||||
</a>
|
||||
<a href="https://www.easywebadv.it/" style="width:100px">
|
||||
<img src="website/static/img/easyweb.png" width="100"/>
|
||||
</a>
|
||||
@@ -200,102 +194,15 @@ This project is supported by these kind people / companies:
|
||||
<a href="https://github.com/GargantuaX" style="width:45px">
|
||||
<img src="https://github.com/GargantuaX.png?size=45" width="45"/>
|
||||
</a>
|
||||
<a href="https://github.com/brodyover" style="width:45px">
|
||||
<img src="https://github.com/brodyover.png?size=45" width="45"/>
|
||||
</a>
|
||||
|
||||
<span id="nav-6"></span>
|
||||
|
||||
## Installation
|
||||
|
||||
Wails uses cgo to bind to the native rendering engines so a number of platform dependent libraries are needed as well as
|
||||
an installation of Go. The basic requirements are:
|
||||
|
||||
- Go 1.16
|
||||
- npm
|
||||
|
||||
<span id="nav-6-1"></span>
|
||||
|
||||
### MacOS
|
||||
|
||||
Make sure you have the xcode command line tools installed. This can be done by running:
|
||||
|
||||
`xcode-select --install`
|
||||
|
||||
<span id="nav-6-2"></span>
|
||||
|
||||
### Linux
|
||||
|
||||
<span id="nav-6-2-1"></span>
|
||||
|
||||
#### Debian/Ubuntu
|
||||
|
||||
`sudo apt install libgtk-3-dev libwebkit2gtk-4.0-dev`
|
||||
|
||||
_Debian: 8, 9, 10_
|
||||
|
||||
_Ubuntu: 16.04, 18.04, 19.04_
|
||||
|
||||
_Also succesfully tested on: Zorin 15, Parrot 4.7, Linuxmint 19, Elementary 5, Kali, Neon_, Pop!\_OS
|
||||
|
||||
<span id="nav-6-2-2"></span>
|
||||
|
||||
#### Arch Linux / ArchLabs / Ctlos Linux
|
||||
|
||||
`sudo pacman -S webkit2gtk gtk3`
|
||||
|
||||
_Also succesfully test on: Manjaro & ArcoLinux_
|
||||
|
||||
<span id="nav-6-2-3"></span>
|
||||
|
||||
#### Centos
|
||||
|
||||
`sudo yum install webkitgtk3-devel gtk3-devel`
|
||||
|
||||
_CentOS 6, 7_
|
||||
|
||||
<span id="nav-6-2-4"></span>
|
||||
|
||||
#### Fedora
|
||||
|
||||
`sudo yum install webkit2gtk3-devel gtk3-devel`
|
||||
|
||||
_Fedora 29, 30_
|
||||
|
||||
<span id="nav-6-2-5"></span>
|
||||
|
||||
#### VoidLinux & VoidLinux-musl
|
||||
|
||||
`xbps-install gtk+3-devel webkit2gtk-devel`
|
||||
|
||||
<span id="nav-6-2-6"></span>
|
||||
|
||||
#### Gentoo
|
||||
|
||||
`sudo emerge gtk+:3 webkit-gtk`
|
||||
|
||||
<span id="nav-6-3"></span>
|
||||
|
||||
### Windows
|
||||
|
||||
Windows requires gcc and related tooling. The recommended download is
|
||||
from [http://tdm-gcc.tdragon.net/download](http://tdm-gcc.tdragon.net/download). Once this is installed, you are good to
|
||||
go.
|
||||
|
||||
<span id="nav-7"></span>
|
||||
|
||||
## Usage
|
||||
|
||||
**Ensure Go modules are enabled: GO111MODULE=on and go/bin is in your PATH variable.**
|
||||
|
||||
Installation is as simple as running the following command:
|
||||
|
||||
```
|
||||
go get -u github.com/wailsapp/wails/cmd/wails
|
||||
```
|
||||
|
||||
<span id="nav-7-1"></span>
|
||||
|
||||
### Next Steps
|
||||
|
||||
It is recommended at this stage to read the comprehensive documentation at [https://wails.app](https://wails.app).
|
||||
The installation instructions are on the [official website](https://wails.io/docs/gettingstarted/installation).
|
||||
|
||||
<span id="nav-8"></span>
|
||||
|
||||
|
||||
+11
-8
@@ -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)。
|
||||
|
||||
镜像网站:
|
||||
|
||||
@@ -112,8 +116,8 @@
|
||||
<a href="https://github.com/sponsors/leaanthony" style="width:100px;">
|
||||
<img src="/img/silver%20sponsor.png" width="100"/>
|
||||
</a>
|
||||
<a href="https://github.com/letheanVPN" style="width:100px;">
|
||||
<img src="https://github.com/letheanVPN.png?size=100" width="100"/>
|
||||
<a href="https://github.com/selvindev" style="width:100px;">
|
||||
<img src="https://github.com/selvindev.png?size=100" width="100"/>
|
||||
</a>
|
||||
<br/>
|
||||
<br/>
|
||||
@@ -126,9 +130,6 @@
|
||||
<a href="https://github.com/codydbentley" style="width:100px">
|
||||
<img src="https://github.com/codydbentley.png?size=100" width="100"/>
|
||||
</a>
|
||||
<a href="https://github.com/CrackDavid" style="width:100px">
|
||||
<img src="https://github.com/CrackDavid.png?size=100" width="100"/>
|
||||
</a>
|
||||
<a href="https://www.easywebadv.it/" style="width:100px">
|
||||
<img src="website/static/img/easyweb.png" width="100"/>
|
||||
</a>
|
||||
@@ -203,7 +204,9 @@
|
||||
<a href="https://github.com/GargantuaX" style="width:45px">
|
||||
<img src="https://github.com/GargantuaX.png?size=45" width="45"/>
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/brodyover" style="width:45px">
|
||||
<img src="https://github.com/brodyover.png?size=45" width="45"/>
|
||||
</a>
|
||||
<span id="nav-6"></span>
|
||||
|
||||
## 安装
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 147 KiB |
Generated
+15
-15
@@ -1461,9 +1461,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"ansi-regex": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
|
||||
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-styles": {
|
||||
@@ -2297,9 +2297,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-regex": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz",
|
||||
"integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==",
|
||||
"dev": true
|
||||
},
|
||||
"strip-ansi": {
|
||||
@@ -4385,9 +4385,9 @@
|
||||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
||||
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
|
||||
"dev": true
|
||||
},
|
||||
"mississippi": {
|
||||
@@ -5605,9 +5605,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-regex": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz",
|
||||
"integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==",
|
||||
"dev": true
|
||||
},
|
||||
"strip-ansi": {
|
||||
@@ -6535,9 +6535,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-regex": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz",
|
||||
"integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-styles": {
|
||||
|
||||
@@ -93,6 +93,12 @@ 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)
|
||||
|
||||
trimpath := false
|
||||
command.BoolFlag("trimpath", "Remove all file system paths from the resulting executable", &trimpath)
|
||||
|
||||
command.Action(func() error {
|
||||
|
||||
quiet := verbosity == 0
|
||||
@@ -117,20 +123,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)
|
||||
@@ -181,6 +179,7 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
||||
CompressFlags: compressFlags,
|
||||
UserTags: userTags,
|
||||
WebView2Strategy: wv2rtstrategy,
|
||||
TrimPath: trimpath,
|
||||
}
|
||||
|
||||
// Start a new tabwriter
|
||||
@@ -188,21 +187,24 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
||||
w.Init(os.Stdout, 8, 8, 0, '\t', 0)
|
||||
|
||||
// Write out the system information
|
||||
fmt.Fprintf(w, "App Type: \t%s\n", buildOptions.OutputType)
|
||||
fmt.Fprintf(w, "Platforms: \t%s\n", platform)
|
||||
fmt.Fprintf(w, "Compiler: \t%s\n", compilerPath)
|
||||
fmt.Fprintf(w, "Build Mode: \t%s\n", modeString)
|
||||
fmt.Fprintf(w, "Skip Frontend: \t%t\n", skipFrontend)
|
||||
fmt.Fprintf(w, "Compress: \t%t\n", buildOptions.Compress)
|
||||
fmt.Fprintf(w, "Package: \t%t\n", buildOptions.Pack)
|
||||
fmt.Fprintf(w, "Clean Build Dir: \t%t\n", buildOptions.CleanBuildDirectory)
|
||||
fmt.Fprintf(w, "LDFlags: \t\"%s\"\n", buildOptions.LDFlags)
|
||||
fmt.Fprintf(w, "Tags: \t[%s]\n", strings.Join(buildOptions.UserTags, ","))
|
||||
_, _ = fmt.Fprintf(w, "App Type: \t%s\n", buildOptions.OutputType)
|
||||
_, _ = fmt.Fprintf(w, "Platforms: \t%s\n", platform)
|
||||
_, _ = fmt.Fprintf(w, "Compiler: \t%s\n", compilerPath)
|
||||
_, _ = fmt.Fprintf(w, "Build Mode: \t%s\n", modeString)
|
||||
_, _ = fmt.Fprintf(w, "Skip Frontend: \t%t\n", skipFrontend)
|
||||
_, _ = fmt.Fprintf(w, "Compress: \t%t\n", buildOptions.Compress)
|
||||
_, _ = fmt.Fprintf(w, "Package: \t%t\n", buildOptions.Pack)
|
||||
_, _ = fmt.Fprintf(w, "Clean Build Dir: \t%t\n", buildOptions.CleanBuildDirectory)
|
||||
_, _ = fmt.Fprintf(w, "LDFlags: \t\"%s\"\n", buildOptions.LDFlags)
|
||||
_, _ = fmt.Fprintf(w, "Tags: \t[%s]\n", strings.Join(buildOptions.UserTags, ","))
|
||||
if len(buildOptions.OutputFile) > 0 && targets.Length() == 1 {
|
||||
fmt.Fprintf(w, "Output File: \t%s\n", buildOptions.OutputFile)
|
||||
_, _ = fmt.Fprintf(w, "Output File: \t%s\n", buildOptions.OutputFile)
|
||||
}
|
||||
_, _ = fmt.Fprintf(w, "\n")
|
||||
err = w.Flush()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintf(w, "\n")
|
||||
w.Flush()
|
||||
|
||||
err = checkGoModVersion(logger, updateGoMod)
|
||||
if err != nil {
|
||||
@@ -214,6 +216,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{
|
||||
@@ -227,9 +232,18 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
||||
"windows",
|
||||
"windows/amd64",
|
||||
"windows/arm64",
|
||||
"windows/386",
|
||||
})
|
||||
|
||||
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(","))
|
||||
@@ -245,10 +259,9 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
||||
// Calculate platform and arch
|
||||
platformSplit := strings.Split(platform, "/")
|
||||
buildOptions.Platform = platformSplit[0]
|
||||
buildOptions.Arch = runtime.GOARCH
|
||||
if system.IsAppleSilicon {
|
||||
buildOptions.Arch = "arm64"
|
||||
} else {
|
||||
buildOptions.Arch = runtime.GOARCH
|
||||
}
|
||||
if len(platformSplit) == 2 {
|
||||
buildOptions.Arch = platformSplit[1]
|
||||
@@ -264,6 +277,11 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
||||
}
|
||||
|
||||
switch buildOptions.Platform {
|
||||
case "linux":
|
||||
if runtime.GOOS != "linux" {
|
||||
logger.Println("Crosscompiling to Linux not currently supported.\n")
|
||||
return
|
||||
}
|
||||
case "darwin":
|
||||
if runtime.GOOS != "darwin" {
|
||||
logger.Println("Crosscompiling to Mac not currently supported.\n")
|
||||
@@ -291,23 +309,44 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
||||
}
|
||||
buildOptions.OutputFile = desiredFilename
|
||||
|
||||
if outputFilename != "" {
|
||||
buildOptions.OutputFile = outputFilename
|
||||
}
|
||||
|
||||
// Start Time
|
||||
start := time.Now()
|
||||
|
||||
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[buildOptions.Platform+"/"+buildOptions.Arch] = 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
|
||||
})
|
||||
}
|
||||
|
||||
@@ -4,13 +4,15 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
@@ -33,8 +35,6 @@ import (
|
||||
"github.com/wailsapp/wails/v2/pkg/commands/build"
|
||||
)
|
||||
|
||||
const defaultDevServerURL = "http://localhost:34115"
|
||||
|
||||
func LogGreen(message string, args ...interface{}) {
|
||||
text := fmt.Sprintf(message, args...)
|
||||
println(colour.Green(text))
|
||||
@@ -66,14 +66,18 @@ type devFlags struct {
|
||||
reloadDirs string
|
||||
openBrowser bool
|
||||
noReload bool
|
||||
noGen bool
|
||||
wailsjsdir string
|
||||
tags string
|
||||
verbosity int
|
||||
loglevel string
|
||||
forceBuild bool
|
||||
debounceMS int
|
||||
devServerURL string
|
||||
devServer string
|
||||
appargs string
|
||||
saveConfig bool
|
||||
|
||||
frontendDevServerURL string
|
||||
}
|
||||
|
||||
// AddSubcommand adds the `dev` command for the Wails application
|
||||
@@ -89,34 +93,29 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||
command.StringFlag("reloaddirs", "Additional directories to trigger reloads (comma separated)", &flags.reloadDirs)
|
||||
command.BoolFlag("browser", "Open application in browser", &flags.openBrowser)
|
||||
command.BoolFlag("noreload", "Disable reload on asset change", &flags.noReload)
|
||||
command.BoolFlag("nogen", "Disable generate module", &flags.noGen)
|
||||
command.StringFlag("wailsjsdir", "Directory to generate the Wails JS modules", &flags.wailsjsdir)
|
||||
command.StringFlag("tags", "tags to pass to Go compiler (quoted and space separated)", &flags.tags)
|
||||
command.IntFlag("v", "Verbosity level (0 - silent, 1 - standard, 2 - verbose)", &flags.verbosity)
|
||||
command.StringFlag("loglevel", "Loglevel to use - Trace, Debug, Info, Warning, Error", &flags.loglevel)
|
||||
command.BoolFlag("f", "Force build application", &flags.forceBuild)
|
||||
command.IntFlag("debounce", "The amount of time to wait to trigger a reload on change", &flags.debounceMS)
|
||||
command.StringFlag("devserverurl", "The url of the dev server to use", &flags.devServerURL)
|
||||
command.StringFlag("devserver", "The address of the wails dev server", &flags.devServer)
|
||||
command.StringFlag("frontenddevserverurl", "The url of the external frontend dev server to use", &flags.frontendDevServerURL)
|
||||
command.StringFlag("appargs", "arguments to pass to the underlying app (quoted and space searated)", &flags.appargs)
|
||||
command.BoolFlag("save", "Save given flags as defaults", &flags.saveConfig)
|
||||
|
||||
command.Action(func() error {
|
||||
// Create logger
|
||||
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()
|
||||
@@ -129,6 +128,16 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||
return err
|
||||
}
|
||||
|
||||
devServer := flags.devServer
|
||||
if _, _, err := net.SplitHostPort(devServer); err != nil {
|
||||
return fmt.Errorf("DevServer is not of the form 'host:port', please check your wails.json")
|
||||
}
|
||||
|
||||
devServerURL, err := url.Parse("http://" + devServer)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Update go.mod to use current wails version
|
||||
err = syncGoModVersion(cwd)
|
||||
if err != nil {
|
||||
@@ -136,25 +145,21 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||
}
|
||||
|
||||
// Run go mod tidy to ensure we're up to date
|
||||
err = runCommand(cwd, false, "go", "mod", "tidy")
|
||||
err = runCommand(cwd, false, "go", "mod", "tidy", "-compat=1.17")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if flags.tags != "" {
|
||||
err = runCommand(cwd, true, "wails", "generate", "module", "-tags", flags.tags)
|
||||
} else {
|
||||
err = runCommand(cwd, true, "wails", "generate", "module")
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// frontend:dev server command
|
||||
if projectConfig.DevCommand != "" {
|
||||
var devCommandWaitGroup sync.WaitGroup
|
||||
closer := runFrontendDevCommand(cwd, projectConfig.DevCommand, &devCommandWaitGroup)
|
||||
defer closer(&devCommandWaitGroup)
|
||||
if !flags.noGen {
|
||||
self := os.Args[0]
|
||||
if flags.tags != "" {
|
||||
err = runCommand(cwd, true, self, "generate", "module", "-tags", flags.tags)
|
||||
} else {
|
||||
err = runCommand(cwd, true, self, "generate", "module")
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
buildOptions := generateBuildOptions(flags)
|
||||
@@ -178,13 +183,16 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||
debugBinaryProcess = newProcess
|
||||
}
|
||||
|
||||
// frontend:dev:watcher command.
|
||||
if command := projectConfig.DevWatcherCommand; command != "" {
|
||||
var devCommandWaitGroup sync.WaitGroup
|
||||
closer := runFrontendDevWatcherCommand(cwd, command, &devCommandWaitGroup)
|
||||
defer closer(&devCommandWaitGroup)
|
||||
}
|
||||
|
||||
// open browser
|
||||
if flags.openBrowser {
|
||||
url := defaultDevServerURL
|
||||
if flags.devServerURL != "" {
|
||||
url = flags.devServerURL
|
||||
}
|
||||
err = browser.OpenURL(url)
|
||||
err = browser.OpenURL(devServerURL.String())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -192,6 +200,10 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||
|
||||
// create the project files watcher
|
||||
watcher, err := initialiseWatcher(cwd, logger.Fatal)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer func(watcher *fsnotify.Watcher) {
|
||||
err := watcher.Close()
|
||||
if err != nil {
|
||||
@@ -200,11 +212,14 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||
}(watcher)
|
||||
|
||||
LogGreen("Watching (sub)/directory: %s", cwd)
|
||||
LogGreen("Using Dev Server URL: %s", flags.devServerURL)
|
||||
LogGreen("Using DevServer URL: %s", devServerURL)
|
||||
if flags.frontendDevServerURL != "" {
|
||||
LogGreen("Using Frontend DevServer URL: %s", flags.frontendDevServerURL)
|
||||
}
|
||||
LogGreen("Using reload debounce setting of %d milliseconds", flags.debounceMS)
|
||||
|
||||
// Watch for changes and trigger restartApp()
|
||||
doWatcherLoop(buildOptions, debugBinaryProcess, flags, watcher, exitCodeChannel, quitChannel)
|
||||
doWatcherLoop(buildOptions, debugBinaryProcess, flags, watcher, exitCodeChannel, quitChannel, devServerURL)
|
||||
|
||||
// Kill the current program if running
|
||||
if debugBinaryProcess != nil {
|
||||
@@ -255,6 +270,7 @@ func runCommand(dir string, exitOnError bool, command string, args ...string) er
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
println(string(output))
|
||||
println(err.Error())
|
||||
if exitOnError {
|
||||
os.Exit(1)
|
||||
}
|
||||
@@ -266,7 +282,6 @@ func runCommand(dir string, exitOnError bool, command string, args ...string) er
|
||||
// defaultDevFlags generates devFlags with default options
|
||||
func defaultDevFlags() devFlags {
|
||||
return devFlags{
|
||||
devServerURL: defaultDevServerURL,
|
||||
compilerCommand: "go",
|
||||
verbosity: 1,
|
||||
extensions: "go",
|
||||
@@ -301,15 +316,12 @@ func loadAndMergeProjectConfig(cwd string, flags *devFlags) (*project.Project, e
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var shouldSaveConfig bool
|
||||
|
||||
if flags.assetDir == "" && projectConfig.AssetDirectory != "" {
|
||||
flags.assetDir = projectConfig.AssetDirectory
|
||||
}
|
||||
|
||||
if flags.assetDir != projectConfig.AssetDirectory {
|
||||
projectConfig.AssetDirectory = filepath.ToSlash(flags.assetDir)
|
||||
shouldSaveConfig = true
|
||||
}
|
||||
|
||||
if flags.assetDir != "" {
|
||||
@@ -325,16 +337,14 @@ func loadAndMergeProjectConfig(cwd string, flags *devFlags) (*project.Project, e
|
||||
|
||||
if flags.reloadDirs != projectConfig.ReloadDirectories {
|
||||
projectConfig.ReloadDirectories = filepath.ToSlash(flags.reloadDirs)
|
||||
shouldSaveConfig = true
|
||||
}
|
||||
|
||||
if flags.devServerURL == defaultDevServerURL && projectConfig.DevServerURL != defaultDevServerURL && projectConfig.DevServerURL != "" {
|
||||
flags.devServerURL = projectConfig.DevServerURL
|
||||
if flags.devServer == "" && projectConfig.DevServer != "" {
|
||||
flags.devServer = projectConfig.DevServer
|
||||
}
|
||||
|
||||
if flags.devServerURL != projectConfig.DevServerURL {
|
||||
projectConfig.DevServerURL = flags.devServerURL
|
||||
shouldSaveConfig = true
|
||||
if flags.frontendDevServerURL == "" && projectConfig.FrontendDevServerURL != "" {
|
||||
flags.frontendDevServerURL = projectConfig.FrontendDevServerURL
|
||||
}
|
||||
|
||||
if flags.wailsjsdir == "" && projectConfig.WailsJSDir != "" {
|
||||
@@ -347,7 +357,6 @@ func loadAndMergeProjectConfig(cwd string, flags *devFlags) (*project.Project, e
|
||||
|
||||
if flags.wailsjsdir != projectConfig.WailsJSDir {
|
||||
projectConfig.WailsJSDir = filepath.ToSlash(flags.wailsjsdir)
|
||||
shouldSaveConfig = true
|
||||
}
|
||||
|
||||
if flags.debounceMS == 100 && projectConfig.DebounceMS != 100 {
|
||||
@@ -359,14 +368,13 @@ func loadAndMergeProjectConfig(cwd string, flags *devFlags) (*project.Project, e
|
||||
|
||||
if flags.debounceMS != projectConfig.DebounceMS {
|
||||
projectConfig.DebounceMS = flags.debounceMS
|
||||
shouldSaveConfig = true
|
||||
}
|
||||
|
||||
if flags.appargs == "" && projectConfig.AppArgs != "" {
|
||||
flags.appargs = projectConfig.AppArgs
|
||||
}
|
||||
|
||||
if shouldSaveConfig {
|
||||
if flags.saveConfig {
|
||||
err = projectConfig.Save()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -376,9 +384,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, " ")
|
||||
@@ -387,6 +395,8 @@ func runFrontendDevCommand(cwd string, devCommand string, wg *sync.WaitGroup) fu
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Dir = dir
|
||||
|
||||
setParentGID(cmd)
|
||||
go func(ctx context.Context, devCommand string, cwd string, wg *sync.WaitGroup) {
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
@@ -399,23 +409,9 @@ func runFrontendDevCommand(cwd string, devCommand string, wg *sync.WaitGroup) fu
|
||||
}(ctx, devCommand, cwd, wg)
|
||||
|
||||
return func(wg *sync.WaitGroup) {
|
||||
if runtime.GOOS == "windows" {
|
||||
// Credit: https://stackoverflow.com/a/44551450
|
||||
// For whatever reason, killing an npm script on windows just doesn't exit properly with cancel
|
||||
if cmd != nil && cmd.Process != nil {
|
||||
kill := exec.Command("TASKKILL", "/T", "/F", "/PID", strconv.Itoa(cmd.Process.Pid))
|
||||
kill.Stderr = os.Stderr
|
||||
kill.Stdout = os.Stdout
|
||||
err := kill.Run()
|
||||
if err != nil {
|
||||
if err.Error() != "exit status 1" {
|
||||
LogRed("Error from '%s': %s", devCommand, err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cancel()
|
||||
}
|
||||
killProc(cmd, devCommand)
|
||||
LogGreen("Dev command killed!")
|
||||
cancel()
|
||||
wg.Wait()
|
||||
}
|
||||
}
|
||||
@@ -439,6 +435,10 @@ func initialiseWatcher(cwd string, logFatal func(string, ...interface{})) (*fsno
|
||||
return
|
||||
}
|
||||
// Ignore build directory
|
||||
if strings.Contains(dir, ".git") {
|
||||
return
|
||||
}
|
||||
// Ignore build directory
|
||||
if strings.HasPrefix(dir, filepath.Join(cwd, "build")) {
|
||||
return
|
||||
}
|
||||
@@ -486,7 +486,8 @@ func restartApp(buildOptions *build.Options, debugBinaryProcess *process.Process
|
||||
// Set environment variables accordingly
|
||||
os.Setenv("loglevel", flags.loglevel)
|
||||
os.Setenv("assetdir", flags.assetDir)
|
||||
os.Setenv("devserverurl", flags.devServerURL)
|
||||
os.Setenv("devserver", flags.devServer)
|
||||
os.Setenv("frontenddevserverurl", flags.frontendDevServerURL)
|
||||
|
||||
// Start up new binary with correct args
|
||||
newProcess := process.NewProcess(appBinary, args...)
|
||||
@@ -506,7 +507,7 @@ func restartApp(buildOptions *build.Options, debugBinaryProcess *process.Process
|
||||
}
|
||||
|
||||
// doWatcherLoop is the main watch loop that runs while dev is active
|
||||
func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Process, flags devFlags, watcher *fsnotify.Watcher, exitCodeChannel chan int, quitChannel chan os.Signal) {
|
||||
func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Process, flags devFlags, watcher *fsnotify.Watcher, exitCodeChannel chan int, quitChannel chan os.Signal, devServerURL *url.URL) {
|
||||
// Main Loop
|
||||
var (
|
||||
err error
|
||||
@@ -533,6 +534,9 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
|
||||
reload := false
|
||||
assetDir := ""
|
||||
changedPaths := map[string]struct{}{}
|
||||
|
||||
assetDirURL := joinPath(devServerURL, "/wails/assetdir")
|
||||
reloadURL := joinPath(devServerURL, "/wails/reload")
|
||||
for quit == false {
|
||||
//reload := false
|
||||
select {
|
||||
@@ -540,6 +544,8 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
|
||||
if exitCode == 0 {
|
||||
quit = true
|
||||
}
|
||||
case err := <-watcher.Errors:
|
||||
LogDarkYellow(err.Error())
|
||||
case item := <-watcher.Events:
|
||||
// Check for file writes
|
||||
if item.Op&fsnotify.Write == fsnotify.Write {
|
||||
@@ -597,14 +603,19 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
|
||||
LogRed("Error during build: %s", err.Error())
|
||||
continue
|
||||
}
|
||||
// If we have a new process, save it
|
||||
// If we have a new process, saveConfig it
|
||||
if newBinaryProcess != nil {
|
||||
debugBinaryProcess = newBinaryProcess
|
||||
}
|
||||
}
|
||||
|
||||
if flags.frontendDevServerURL != "" {
|
||||
// If we are using an external dev server all the reload of the frontend part can be skipped
|
||||
continue
|
||||
}
|
||||
if len(changedPaths) != 0 {
|
||||
if assetDir == "" {
|
||||
resp, err := http.Get("http://localhost:34115/wails/assetdir")
|
||||
resp, err := http.Get(assetDirURL)
|
||||
if err != nil {
|
||||
LogRed("Error during retrieving assetdir: %s", err.Error())
|
||||
} else {
|
||||
@@ -633,7 +644,7 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
|
||||
}
|
||||
if reload {
|
||||
reload = false
|
||||
_, err = http.Get("http://localhost:34115/wails/reload")
|
||||
_, err = http.Get(reloadURL)
|
||||
if err != nil {
|
||||
LogRed("Error during refresh: %s", err.Error())
|
||||
}
|
||||
@@ -644,3 +655,9 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func joinPath(url *url.URL, subPath string) string {
|
||||
u := *url
|
||||
u.Path = path.Join(u.Path, subPath)
|
||||
return u.String()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
//go:build darwin || linux
|
||||
// +build darwin linux
|
||||
|
||||
package dev
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func setParentGID(cmd *exec.Cmd) {
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
||||
Setpgid: true,
|
||||
}
|
||||
}
|
||||
|
||||
func killProc(cmd *exec.Cmd, devCommand string) {
|
||||
// Experiencing the same issue on macOS BigSur
|
||||
// I'm using Vite, but I would imagine this could be an issue with Node (npm) in general
|
||||
// Also, after several edit/rebuild cycles any abnormal shutdown (crash or CTRL-C) may still leave Node running
|
||||
// Credit: https://stackoverflow.com/a/29552044/14764450 (same page as the Windows solution above)
|
||||
// Not tested on *nix
|
||||
pgid, err := syscall.Getpgid(cmd.Process.Pid)
|
||||
if err == nil {
|
||||
err := syscall.Kill(-pgid, 15) // note the minus sign
|
||||
if err != nil {
|
||||
LogRed("Error from '%s' when attempting to kill the process: %s", devCommand, err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package dev
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func setParentGID(_ *exec.Cmd) {}
|
||||
|
||||
func killProc(cmd *exec.Cmd, devCommand string) {
|
||||
// Credit: https://stackoverflow.com/a/44551450
|
||||
// For whatever reason, killing an npm script on windows just doesn't exit properly with cancel
|
||||
if cmd != nil && cmd.Process != nil {
|
||||
kill := exec.Command("TASKKILL", "/T", "/F", "/PID", strconv.Itoa(cmd.Process.Pid))
|
||||
kill.Stderr = os.Stderr
|
||||
kill.Stdout = os.Stdout
|
||||
err := kill.Run()
|
||||
if err != nil {
|
||||
if err.Error() != "exit status 1" {
|
||||
LogRed("Error from '%s': %s", devCommand, err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,14 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||
fmt.Fprintf(w, "%s\t%s\n", "Platform:", runtime.GOOS)
|
||||
fmt.Fprintf(w, "%s\t%s\n", "Architecture:", runtime.GOARCH)
|
||||
|
||||
// Write out the wails information
|
||||
fmt.Fprintf(w, "\n")
|
||||
fmt.Fprintf(w, "Wails\n")
|
||||
fmt.Fprintf(w, "------\n")
|
||||
fmt.Fprintf(w, "%s\t%s\n", "Version: ", app.Version())
|
||||
|
||||
printBuildSettings(w)
|
||||
|
||||
// Exit early if PM not found
|
||||
if info.PM != nil {
|
||||
fmt.Fprintf(w, "%s\t%s\n", "Package Manager: ", info.PM.Name())
|
||||
@@ -133,21 +141,11 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||
if dependenciesAvailableOptional != 0 {
|
||||
logger.Println("Optional package(s) installation details: \n" + info.Dependencies.InstallAllOptionalCommand())
|
||||
}
|
||||
//
|
||||
//if len(externalPackages) > 0 {
|
||||
// for _, p := range externalPackages {
|
||||
// if p.Optional {
|
||||
// print("[Optional] ")
|
||||
// }
|
||||
// logger.Println("Install " + p.Name + ": " + p.InstallCommand)
|
||||
// }
|
||||
//}
|
||||
|
||||
if len(dependenciesMissing) != 0 {
|
||||
// TODO: Check if apps are available locally and if so, adjust the diagnosis
|
||||
logger.Println("Fatal:")
|
||||
logger.Println("Required dependencies missing: " + strings.Join(dependenciesMissing, " "))
|
||||
logger.Println("Please read this article on how to resolve this: https://wails.app/guides/resolving-missing-packages")
|
||||
logger.Println("Please read this article on how to resolve this: https://wails.io/guides/resolving-missing-packages")
|
||||
}
|
||||
|
||||
logger.Println("")
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
//go:build !go1.18
|
||||
// +build !go1.18
|
||||
|
||||
package doctor
|
||||
|
||||
import "text/tabwriter"
|
||||
|
||||
func printBuildSettings(_ *tabwriter.Writer) {
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
package doctor
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime/debug"
|
||||
"text/tabwriter"
|
||||
)
|
||||
|
||||
func printBuildSettings(w *tabwriter.Writer) {
|
||||
if buildInfo, _ := debug.ReadBuildInfo(); buildInfo != nil {
|
||||
buildSettingToName := map[string]string{
|
||||
"vcs.revision": "Revision",
|
||||
"vcs.modified": "Modified",
|
||||
}
|
||||
for _, buildSetting := range buildInfo.Settings {
|
||||
name := buildSettingToName[buildSetting.Key]
|
||||
if name == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, "%s:\t%s\n", name, buildSetting.Value)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,14 +2,15 @@ package generate
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/leaanthony/clir"
|
||||
"github.com/wailsapp/wails/v2/cmd/wails/internal"
|
||||
"github.com/wailsapp/wails/v2/internal/shell"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/leaanthony/clir"
|
||||
"github.com/wailsapp/wails/v2/cmd/wails/internal"
|
||||
"github.com/wailsapp/wails/v2/internal/shell"
|
||||
)
|
||||
|
||||
// AddModuleCommand adds the `module` subcommand for the `generate` command
|
||||
@@ -43,6 +44,8 @@ func AddModuleCommand(app *clir.Cli, parent *clir.Command, w io.Writer) error {
|
||||
}
|
||||
|
||||
stdout, stderr, err = shell.RunCommand(cwd, filename)
|
||||
println(stdout)
|
||||
println(stderr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s\n%s\n%s", stdout, stderr, err)
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user