Compare commits

...

86 Commits

Author SHA1 Message Date
Lea Anthony 67e2a4bdeb Update docs and changelog 2022-11-09 22:26:22 +11:00
Lea Anthony f7c602c212 Update docs and changelog 2022-11-09 22:06:10 +11:00
Lea Anthony 0a7293d6b6 Update runtime 2022-11-09 21:22:32 +11:00
Misite Bao 4c840c07f2 docs: sync documents (#2063)
* docs: sync documents

* docs: fix document escape syntax
2022-11-09 06:25:18 +11:00
Sean Gosiaco 8ee493f48d Added quasar-js and quasar-ts templates (#2062) 2022-11-08 20:34:05 +11:00
github-actions[bot] 95116912a2 chore: update sponsors.svg (#2054)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2022-11-06 15:32:15 +11:00
github-actions[bot] 55f76a291b chore: update sponsors.svg (#2051)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2022-11-05 14:34:14 +11:00
github-actions[bot] 928bc75602 chore: update sponsors.svg (#2049)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2022-11-04 18:32:17 +11:00
Lea Anthony 18b2d315dd Modularize wails (#2009)
Co-authored-by: stffabi <stffabi@users.noreply.github.com>
2022-11-03 21:21:40 +11:00
stffabi 0a1c05df16 [windows] Fix frameless maximizing in multi monitor setup (#2043) 2022-11-03 19:14:00 +11:00
github-actions[bot] 3d62681450 chore: update sponsors.svg (#2022)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2022-10-30 19:27:08 +11:00
stffabi 638caf72f0 [assetserver] Introduce middleware and extract options (#2016)
* [assetserver] Add support for HTTP Middlewares

* [dev] Disable frontend DevServer if no Assets has been defined and inform user

* [dev] Consistent WebSocket behaviour in dev and prod mode for assets handler and middleware

In prod mode we can't support WebSockets so make sure the
assets handler and middleware never see WebSockets in dev mode.

* [templates] Migrate to new AssetServer option

* [docs] Add assetserver.Options to the reference
2022-10-29 23:15:15 +02:00
Lea Anthony 4cd89e1507 Add Angular docs 2022-10-29 19:35:41 +11:00
github-actions[bot] ac8ed94ae6 chore: update sponsors.svg (#2018)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2022-10-26 18:29:36 +11:00
Lea Anthony 52238f0fdd Update Mac troubleshooting guide 2022-10-26 08:23:00 +11:00
Lea Anthony 6a12d01624 Update v2.1.0 release notes 2022-10-26 08:19:46 +11:00
Misite Bao 00864fa14f docs: sync documents (#2013) 2022-10-26 08:02:36 +11:00
Lea Anthony 6d94cb4afe Add installation error docs 2022-10-25 06:06:53 +11:00
Joshua Hull 9f751d66e0 Add single listener deregistration (#1969)
* Add single listener deregistration

* Return function to stop listening, updates types

* Add missing returns, improve documentation

* Duplicate interface in go

* Define eventName

* Use lo instead for filtering

* Move logger to Interface. Add sample test.

* Add vite test for events

* Add js test workflow

* Add corresponding go method to remove all events

* Update documentation

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-10-23 09:03:37 +11:00
Binyamin Aron Green 4bff4af2b0 Add JSON schema for config file (#1864)
* Add JSON schema for config file

* Fix typo in wails config schema

* Update wails.tmpl.json

* Update wails.tmpl.json

* Add reference to schema in docs

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-10-22 21:07:37 +11:00
ParkourLiu dc65f77baf repair panic (#1999)
* repair panic

* Add empty struct field test

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-10-22 21:04:49 +11:00
Will Andrews c55f94a3dc [Docs] Add troubleshooting guide for unable to start service (#2001)
* add troubleshooting

* moved

* Added to the docs repo

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-10-22 21:04:18 +11:00
Lea Anthony b32069e4e4 Fix call in checkWebView2 2022-10-22 17:45:23 +11:00
github-actions[bot] 2fd704e47c chore: update sponsors.svg (#2003)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2022-10-22 00:40:09 +11:00
stffabi 0a20c8db96 [webview2loader] Add full featured go implementation (#1974)
* [webview2loader] Add full featured go implementation

The new go loader can be activated with the exp_gowebview2loader build tag.

* [build] Add information for using the new webvie2loader
2022-10-22 00:29:16 +11:00
Will Andrews 38f6b8787f [Docs] Add troubleshooting guide for unable to start service (#2000)
* add troubleshooting

* moved
2022-10-21 07:42:57 +11:00
Scott Opell 7fcb537f85 feature/turn off color terminal output of dev command (#1947)
* feat: Adds option to dev command to turn off color terminal output

* Update docs

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-10-20 21:11:20 +11:00
Misite Bao 8b07a0f582 chore: update workflows (#1977)
* chore: remove useless files

* chore: fix check path

* chore: add workflow to auto push to crowdin after website update

* fix: fix workflow config
2022-10-20 20:51:59 +11:00
Lea Anthony 3e73368540 Remove issue translator 2022-10-20 08:45:03 +11:00
github-actions[bot] 789a4e9bba chore: update sponsors.svg (#1991)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2022-10-19 20:34:17 +11:00
stffabi 39addf2011 [dragging] Trim the css property value (#1989)
Webview2 on Windows returns a potential whitespace when defining the
style like this `style="--wails-draggable: drag"`. Whereas Darwin already
trims the value and returns "drag" and not " drag".
2022-10-18 10:28:59 +02:00
Lea Anthony d9e077389c Update changelog 2022-10-18 07:28:41 +11:00
Lea Anthony 94a936e3ad Update changelog 2022-10-18 07:26:59 +11:00
Lea Anthony 639389022b Update date 2022-10-18 07:24:10 +11:00
Lea Anthony a5fba5b218 Release/v2.1.0 (#1988)
* Add changelog. Fix zoom docs. Add Info.dev.plist info

* Update build assets README.md

* Update changelog

* actions/checkout@v2 => v3

* Docs
2022-10-18 07:21:07 +11:00
Lea Anthony 96fa18846c Feature/static analysis (#1983)
* Support parsing embed directives from package

* Validate `embed` directives on build

* `.gitkeep` -> `gitkeep`

* Make step silent. Fix for `wails dev`
2022-10-16 23:08:34 +11:00
Lyon 4d7959dd5b fix: init command not listed in wails help message (#1976)
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-10-15 20:13:07 +11:00
cuigege ef6263c164 Update events.mdx (#1979) 2022-10-15 20:08:25 +11:00
Misite Bao 7b501a8fd1 docs: sync documents (#1968)
* docs: update template description

* docs: sync documents
2022-10-15 10:29:31 +11:00
github-actions[bot] 24dbd71be0 chore: update sponsors.svg (#1973)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2022-10-15 10:28:58 +11:00
Pierre Joye f4adff1cb3 #1057 expose ZoomFactor get/set and add the respective windows only options (#1463)
* #1057 expose ZoomFactor get/set and add the respective windows only options

* Remove debug log, use IsZoomControlEnabled as well

* use math.float to/from 64bits functions instead

* Add new windows options ZoomFactor and IsZoomControlEnabled doc

* Grammar

* Update options.mdx

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-10-14 08:46:14 +11:00
Lea Anthony 7effede62b Add support for Info.dev.plist (#1960) 2022-10-14 07:58:43 +11:00
stffabi 7f733d787f [dev] Do not try to infer assetdir from fs.FS when a frontend dev server is in use (#1972) 2022-10-14 07:52:52 +11:00
Lea Anthony 2d4f7f4de8 Sort structs in models.ts. Fixes #1958 (#1961) 2022-10-14 07:50:22 +11:00
Lea Anthony de1d032f10 Use swc + pnpm (#1966)
* Use swc + pnpm

* Upgrade deps
2022-10-13 21:22:57 +11:00
Lea Anthony 4ca0580ced Chore/generate sponsors (#1965)
* Create PR

* chore: update sponsors.svg (#1964)

Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>

* Delete branch after merge

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2022-10-13 20:10:12 +11:00
Lea Anthony 855c74ff30 Make highlighted code line easier to read. Fixes #1951. 2022-10-12 21:43:28 +11:00
Lea Anthony c62c915fdc Run tests on approval 2022-10-12 21:12:16 +11:00
Rob Nice c78f59bbc1 Add Elm Tailwind CSS community template (#1939)
* add link/description

* rename project
2022-10-11 19:22:24 +11:00
Valentin Trinqué 2a20049ea7 fix: Prevent type parsing to interfere with package name in typescript generation (#1942)
Before that fix:

The method...

```go
func (h *Handler) RespondToInteraction(interaction interactor.Interaction) {}
```

... would generate...

```ts
export function RespondToInteraction(arg1:number):Promise<Error>;
```

... because the `interaction` package starts with `int` and anything starting with `int` is interpreted as `number`.
2022-10-10 23:50:55 +11:00
Alex 504531f340 Update README.zh-Hans.md (#1949)
replace the star history chart with star-history.com
2022-10-10 00:15:36 +11:00
Scott Opell eae90df323 fix for dev file watching missing some file updates due to platform oddities (#1946) 2022-10-09 20:27:24 +11:00
Lea Anthony eee6797907 Add WindowExecJS method (#1927)
* Add WindowExecJS

* [devserver] Embed the base frontend into the DevServer struct

* Update docs

Co-authored-by: stffabi <stffabi@users.noreply.github.com>
2022-10-05 08:44:23 +11:00
JulioDRF bd378b2e0f Fix wails dev (#1931)
* Fix wails dev

* Pass wg as pointer to both goroutines in DevWebServer.Run

* Remove shutdown goroutine
2022-10-05 06:47:37 +11:00
Misite Bao 130f4cc36a docs: sync documents (#1936) 2022-10-04 19:22:35 +11:00
Artur S f3cbd383a3 add react-ts-vite-tailwind template (#1930) 2022-10-02 22:38:58 +11:00
Misite Bao ef32ea2575 fix: remove the .git directory in the template (#1929)
fixed: https://github.com/wailsapp/wails/issues/1928
2022-10-02 21:03:11 +11:00
Lea Anthony 6a3b89d212 fix: exemption typo 2022-10-01 19:03:20 +10:00
JulioDRF 40e326a708 Fix binding generation special cases (#1902)
* Make binding.go easier to test

* Fix non-deterministic namespace order for bindings

* Add binding tests

* Fix nested import structs, non-string map keys, and escape invalid variable names

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-10-01 15:49:51 +10:00
Zámbó, Levente de49b1f125 fix gtk_window_begin_resize_drag's mouse button (#1920)
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-10-01 15:45:37 +10:00
Zámbó, Levente 2690250378 Add window transparency for linux (#1926) 2022-10-01 15:44:38 +10:00
dependabot[bot] 32e9cb30bf Bump github.com/labstack/echo/v4 from 4.7.2 to 4.9.0 in /v2 (#1924) 2022-09-30 22:00:01 +02:00
Zámbó, Levente 13532e00a0 add missing resize for framless window on linux (#1918)
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-09-30 08:51:08 +10:00
Lea Anthony 3ed0d69d61 Update generate-sponsor-image.yml 2022-09-30 08:41:49 +10:00
Richard Guay d92e8d43c8 Adding Tutorial link (#1903)
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-09-30 08:40:30 +10:00
Lea Anthony c05666af7b Fix asset handler on linux 2022-09-30 08:34:32 +10:00
Lea Anthony e7188e877f Update build and test workflow 2022-09-30 08:27:22 +10:00
Lea Anthony 37954141cc Update build_and_test.yml 2022-09-30 08:25:03 +10:00
Lea Anthony d699e77c33 Update build and test workflow 2022-09-30 08:22:22 +10:00
Lea Anthony 60a59f12b2 Update build and test workflow 2022-09-30 08:15:20 +10:00
Misite Bao 5421f559df docs: sync documents (#1907)
* fix(website): fix command flag name

* feat(website): sync translations
2022-09-30 07:17:34 +10:00
Zámbó, Levente b1e04772d9 bugfix/linux framless window drag (#1916) 2022-09-30 00:06:11 +10:00
Lea Anthony 941218d1c8 Update README.md 2022-09-29 20:51:41 +10:00
Lea Anthony b2069c871d Refactor app (#1909)
* Application refactor

* [windows] refactor out main loop. Create new application struct. Refactor assethandler/assetserver signatures.

* Refactor darwin app

* Refactor app for linux

* Update v2/internal/frontend/assetserver/assethandler.go

Co-authored-by: stffabi <stffabi@users.noreply.github.com>

* Update v2/internal/frontend/assetserver/assethandler.go

Co-authored-by: stffabi <stffabi@users.noreply.github.com>

* Update v2/internal/frontend/assetserver/assetserver.go

Co-authored-by: stffabi <stffabi@users.noreply.github.com>

* Update v2/internal/frontend/assetserver/assetserver.go

Co-authored-by: stffabi <stffabi@users.noreply.github.com>

Co-authored-by: stffabi <stffabi@users.noreply.github.com>
2022-09-29 18:43:35 +10:00
Lea Anthony e22cfc18c9 Update howdoesitwork.mdx 2022-09-28 08:32:14 +10:00
ALMAS 2d61278125 Update Chinese translation (#1894)
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-09-26 20:43:28 +10:00
Lea Anthony 9f81013530 chore: Update workflows 2022-09-26 18:00:38 +10:00
Lea Anthony 52845a7ca5 chore: Update release workflow 2022-09-26 17:54:56 +10:00
Lea Anthony 1571b10b84 Quote command arguments if they have a space (#1892) 2022-09-25 22:20:01 +10:00
stffabi f5549db85d [dev] Do not generate bindings in the dev app itself (#1899)
* [dev] Pass skip bindings to the building process

* [dev] Do not generate bindings in the dev app itself

This is done outside during `wails dev` bootstrapping and
fast regeneration seems to sometime cause locking problems
on Windows.
2022-09-25 21:21:41 +10:00
stffabi 953e67e7ed [assetHandler] Remove redundant log prefix (#1896) 2022-09-24 18:03:16 +10:00
Arif Ali 73b9dead5d obfuscated instead of obfuscate in the docs (#1895)
the option in the docs is the wrong flag you have to add a d at the end
2022-09-24 15:05:18 +10:00
Misite Bao 211eb52747 chore: update the label name in the issue template (#1893) 2022-09-24 11:50:57 +10:00
Lea Anthony 91d0d96359 Add issue translator (#1891) 2022-09-24 07:52:19 +10:00
Lea Anthony fbf11aa088 Auto label project cards (#1881) 2022-09-23 14:16:34 +10:00
Lea Anthony fd32734382 Add support for default No button (#1875)
* Add support for default No button

* Fix tests
2022-09-23 10:50:54 +10:00
734 changed files with 40731 additions and 26158 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
name: Bug Report
description: Create a report to help us improve
# title: ""
labels: ["bug"]
labels: ["Bug"]
body:
- type: markdown
+1 -1
View File
@@ -1,7 +1,7 @@
name: Documentation
description: Report an issue related to documentation.
# title: ""
labels: ["documentation"]
labels: ["Documentation"]
body:
- type: markdown
+1 -1
View File
@@ -1,7 +1,7 @@
name: Feature request
description: Suggest an idea for this project
# title: ""
labels: ["enhancement"]
labels: ["Enhancement"]
body:
- type: markdown
-36
View File
@@ -1,36 +0,0 @@
name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build-v2:
name: v2 Build
if: github.repository == 'wailsapp/wails'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: "master"
submodules: true
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ">=1.18.0"
- name: Build Wails CLI
run: |
cd ./v2/cmd/wails
go install
wails -help
@@ -1,15 +1,14 @@
name: Release
name: Build + Test
on:
push:
branches: [ release/* ]
pull_request:
branches: [ release/* ]
branches: [ release/*, master ]
workflow_dispatch:
jobs:
test:
name: Run Go Tests
if: github.repository == 'wailsapp/wails'
runs-on: ${{ matrix.os }}
strategy:
matrix:
@@ -18,7 +17,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
@@ -35,7 +34,6 @@ jobs:
test_templates:
name: Test Templates
needs: test
if: github.repository == 'wailsapp/wails'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
@@ -45,7 +43,7 @@ jobs:
go-version: [ 1.18, 1.19 ]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
+4 -2
View File
@@ -6,16 +6,18 @@ on:
jobs:
docs:
name: Website Updated
if: github.repository == 'wailsapp/wails'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v11.1
id: verify-changed-files
with:
files: |
v2/website/*.mdx
website/**/*.mdx
website/**/*.md
- name: Run step only when files change.
if: steps.verify-changed-files.outputs.files_changed != 'true'
+10 -9
View File
@@ -4,14 +4,13 @@ on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
push:
branches: [ master ]
jobs:
update-sponsors:
runs-on: ubuntu-latest
if: github.repository == 'wailsapp/wails'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set node
uses: actions/setup-node@v2
@@ -24,10 +23,12 @@ jobs:
SPONSORKIT_GITHUB_TOKEN: ${{ secrets.SPONSORS_TOKEN }}
SPONSORKIT_GITHUB_LOGIN: wailsapp
- name: Commit
uses: EndBug/add-and-commit@v4
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
message: "chore: update sponsors.svg"
add: "website/static/img/sponsors.svg"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: update sponsors.svg"
add-paths: "website/static/img/sponsors.svg"
title: Update Sponsor Image
body: Generated new image
branch: update-sponsors
delete-branch: true
+1
View File
@@ -7,6 +7,7 @@ on:
jobs:
build:
name: is-sponsor-label
if: github.repository == 'wailsapp/wails'
runs-on: ubuntu-latest
steps:
- uses: JasonEtco/is-sponsor-label-action@v1
+5 -2
View File
@@ -1,10 +1,13 @@
name: PR Checks
on:
pull_request:
pull_request_review:
types: [ submitted ]
jobs:
check_branch_name:
runs-on: ubuntu-latest
if: github.repository == 'wailsapp/wails'
name: Check branch name
steps:
- run: |
@@ -17,7 +20,7 @@ jobs:
test:
name: Run Go Tests
runs-on: ${{ matrix.os }}
needs: check_branch_name
if: github.event.review.state == 'approved'
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
@@ -25,7 +28,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
+17
View File
@@ -0,0 +1,17 @@
name: Update Project
on:
project_card:
types: [ moved ]
jobs:
projectcardautolabel_job:
runs-on: ubuntu-latest
if: github.repository == 'wailsapp/wails'
steps:
- name: Run ProjectCard AutoLabel
id: runprojectcardautolabel
uses: Matticusau/projectcard-autolabel@v1.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
autolabel-config: '[{"column": "TODO", "add_labels":["TODO"], "remove_labels":["In Progress", "Ready For Testing"]},{"column":"In progress", "add_labels":["In Progress"], "remove_labels":["TODO", "Ready For Testing"]},{"column":"In review", "add_labels":["Ready For Testing"], "remove_labels":["TODO", "In Progress"]}, {"column":"Done", "add_labels":["Done"], "remove_labels":["TODO", "In Progress", "Ready For Testing"]}]'
+38
View File
@@ -0,0 +1,38 @@
name: Push files to Crowdin
on:
push:
branches: [master]
workflow_dispatch:
jobs:
docs:
name: Push files to Crowdin
if: github.repository == 'wailsapp/wails'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v11.1
id: verify-changed-files
with:
files: |
website/**/*.mdx
website/**/*.md
website/**/*.json
- name: Set node
if: steps.verify-changed-files.outputs.files_changed != 'true'
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Push files
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
run: |
cd website
corepack enable
pnpm install
pnpm run crowdin push -b master
+1 -1
View File
@@ -10,7 +10,7 @@ jobs:
name: Rebuild the runtime
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: 14.17.6
+32
View File
@@ -0,0 +1,32 @@
name: Test JS
on:
push:
branches: [ release/*, master ]
workflow_dispatch:
jobs:
test:
name: Run JS Tests
if: github.repository == 'wailsapp/wails'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
working-directory: v2/internal/frontend/runtime
- name: Run tests
run: npm test
working-directory: v2/internal/frontend/runtime
+1 -1
View File
@@ -115,7 +115,7 @@ This project is supported by these kind people / companies:
## Stargazers over time
[![Stargazers over time](https://starchart.cc/wailsapp/wails.svg)](https://starchart.cc/wailsapp/wails)
[![Star History Chart](https://api.star-history.com/svg?repos=wailsapp/wails&type=Date)](https://star-history.com/#wailsapp/wails&Date)
## Contributors
+1 -1
View File
@@ -111,7 +111,7 @@
## 星星增长趋势
[![星星增长趋势](https://starchart.cc/wailsapp/wails.svg)](https://starchart.cc/wailsapp/wails)
[![星星增长趋势](https://api.star-history.com/svg?repos=wailsapp/wails&type=Date)](https://star-history.com/#wailsapp/wails&Date)
## 贡献者
+29 -27
View File
@@ -77,9 +77,9 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
outputFilename := ""
command.StringFlag("o", "Output filename", &outputFilename)
// Clean build directory
cleanBuildDirectory := false
command.BoolFlag("clean", "Clean the build directory before building", &cleanBuildDirectory)
// Clean bin directory
cleanBinDirectory := false
command.BoolFlag("clean", "Clean the bin directory before building", &cleanBinDirectory)
webview2 := "download"
command.StringFlag("webview2", "WebView2 installer strategy: download,embed,browser,error.", &webview2)
@@ -190,28 +190,29 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
// Create BuildOptions
buildOptions := &build.Options{
Logger: logger,
OutputType: outputType,
OutputFile: outputFilename,
CleanBuildDirectory: cleanBuildDirectory,
Mode: mode,
Pack: !noPackage,
LDFlags: ldflags,
Compiler: compilerCommand,
SkipModTidy: skipModTidy,
Verbosity: verbosity,
ForceBuild: forceBuild,
IgnoreFrontend: skipFrontend,
Compress: compress,
CompressFlags: compressFlags,
UserTags: userTags,
WebView2Strategy: wv2rtstrategy,
TrimPath: trimpath,
RaceDetector: raceDetector,
WindowsConsole: windowsConsole,
Obfuscated: obfuscated,
GarbleArgs: garbleargs,
SkipBindings: skipBindings,
Logger: logger,
OutputType: outputType,
OutputFile: outputFilename,
CleanBinDirectory: cleanBinDirectory,
Mode: mode,
Pack: !noPackage,
LDFlags: ldflags,
Compiler: compilerCommand,
SkipModTidy: skipModTidy,
Verbosity: verbosity,
ForceBuild: forceBuild,
IgnoreFrontend: skipFrontend,
Compress: compress,
CompressFlags: compressFlags,
UserTags: userTags,
WebView2Strategy: wv2rtstrategy,
TrimPath: trimpath,
RaceDetector: raceDetector,
WindowsConsole: windowsConsole,
Obfuscated: obfuscated,
GarbleArgs: garbleargs,
SkipBindings: skipBindings,
ProjectData: projectOptions,
}
// Start a new tabwriter
@@ -225,6 +226,7 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
_, _ = fmt.Fprintf(w, "Compiler: \t%s\n", compilerPath)
_, _ = fmt.Fprintf(w, "Skip Bindings: \t%t\n", skipBindings)
_, _ = fmt.Fprintf(w, "Build Mode: \t%s\n", modeString)
_, _ = fmt.Fprintf(w, "Frontend Directory: \t%s\n", projectOptions.GetFrontendDir())
_, _ = fmt.Fprintf(w, "Obfuscated: \t%t\n", buildOptions.Obfuscated)
if buildOptions.Obfuscated {
_, _ = fmt.Fprintf(w, "Garble Args: \t%s\n", buildOptions.GarbleArgs)
@@ -232,7 +234,7 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
_, _ = 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, "Clean Bin Dir: \t%t\n", buildOptions.CleanBinDirectory)
_, _ = fmt.Fprintf(w, "LDFlags: \t\"%s\"\n", buildOptions.LDFlags)
_, _ = fmt.Fprintf(w, "Tags: \t[%s]\n", strings.Join(buildOptions.UserTags, ","))
_, _ = fmt.Fprintf(w, "Race Detector: \t%t\n", buildOptions.RaceDetector)
@@ -358,7 +360,7 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
}
buildOptions.IgnoreFrontend = true
buildOptions.CleanBuildDirectory = false
buildOptions.CleanBinDirectory = false
// Output stats
buildOptions.Logger.Println(fmt.Sprintf("Built '%s' in %s.\n", compiledBinary, time.Since(start).Round(time.Millisecond).String()))
@@ -1,13 +1,13 @@
package build
import (
"os"
"path/filepath"
"fmt"
"github.com/wailsapp/wails/v2/cmd/wails/internal"
"github.com/wailsapp/wails/v2/internal/fs"
"github.com/wailsapp/wails/v2/internal/gomod"
"github.com/wailsapp/wails/v2/internal/goversion"
"github.com/wailsapp/wails/v2/pkg/clilogger"
"os"
)
func SyncGoMod(logger *clilogger.CLILogger, updateWailsVersion bool) error {
@@ -15,7 +15,10 @@ func SyncGoMod(logger *clilogger.CLILogger, updateWailsVersion bool) error {
if err != nil {
return err
}
gomodFilename := filepath.Join(cwd, "go.mod")
gomodFilename := fs.FindFileInParents(cwd, "go.mod")
if gomodFilename == "" {
return fmt.Errorf("no go.mod file found")
}
gomodData, err := os.ReadFile(gomodFilename)
if err != nil {
return err
+48 -21
View File
@@ -93,6 +93,7 @@ type devFlags struct {
frontendDevServerURL string
skipFrontend bool
noColour bool
}
// AddSubcommand adds the `dev` command for the Wails application
@@ -108,6 +109,7 @@ 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("nocolour", "Turn off colour cli output", &flags.noColour)
command.BoolFlag("skipbindings", "Skip bindings generation", &flags.skipBindings)
command.StringFlag("wailsjsdir", "Directory to generate the Wails JS modules", &flags.wailsjsdir)
command.StringFlag("tags", "Build tags to pass to Go compiler. Must be quoted. Space or comma (but not both) separated", &flags.tags)
@@ -123,6 +125,10 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
command.BoolFlag("s", "Skips building the frontend", &flags.skipFrontend)
command.Action(func() error {
if flags.noColour {
colour.ColourEnabled = false
}
// Create logger
logger := clilogger.New(w)
app.PrintBanner()
@@ -160,6 +166,8 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
}
buildOptions := generateBuildOptions(flags)
buildOptions.ProjectData = projectConfig
buildOptions.SkipBindings = flags.skipBindings
buildOptions.Logger = logger
userTags, err := buildtags.Parse(flags.tags)
@@ -169,7 +177,12 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
buildOptions.UserTags = userTags
if !flags.skipBindings {
err = build.CreateEmbedDirectories(cwd, buildOptions)
if err != nil {
return err
}
if !buildOptions.SkipBindings {
if flags.verbosity == build.VERBOSE {
LogGreen("Generating Bindings...")
}
@@ -192,7 +205,6 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
// Build the frontend if requested, but ignore building the application itself.
ignoreFrontend := buildOptions.IgnoreFrontend
if !ignoreFrontend {
logger.Println("Building frontend for development...")
buildOptions.IgnoreApplication = true
if _, err := build.Build(buildOptions); err != nil {
return err
@@ -203,7 +215,7 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
// frontend:dev:watcher command.
frontendDevAutoDiscovery := projectConfig.IsFrontendDevServerURLAutoDiscovery()
if command := projectConfig.DevWatcherCommand; command != "" {
closer, devServerURL, err := runFrontendDevWatcherCommand(cwd, command, frontendDevAutoDiscovery)
closer, devServerURL, err := runFrontendDevWatcherCommand(projectConfig.GetFrontendDir(), command, frontendDevAutoDiscovery)
if err != nil {
return err
}
@@ -347,8 +359,8 @@ func generateBuildOptions(flags devFlags) *build.Options {
// loadAndMergeProjectConfig reconciles flags passed to the CLI with project config settings and updates
// the project config if necessary
func loadAndMergeProjectConfig(cwd string, flags *devFlags) (*project.Project, error) {
projectConfig, err := project.Load(cwd)
func loadAndMergeProjectConfig(projectFileDirectory string, flags *devFlags) (*project.Project, error) {
projectConfig, err := project.Load(projectFileDirectory)
if err != nil {
return nil, err
}
@@ -385,11 +397,11 @@ func loadAndMergeProjectConfig(cwd string, flags *devFlags) (*project.Project, e
}
if flags.wailsjsdir == "" && projectConfig.WailsJSDir != "" {
flags.wailsjsdir = projectConfig.WailsJSDir
flags.wailsjsdir = projectConfig.GetWailsJSDir()
}
if flags.wailsjsdir == "" {
flags.wailsjsdir = "./frontend"
flags.wailsjsdir = projectConfig.GetFrontendDir()
}
if flags.wailsjsdir != projectConfig.WailsJSDir {
@@ -422,15 +434,14 @@ func loadAndMergeProjectConfig(cwd string, flags *devFlags) (*project.Project, e
}
// runFrontendDevWatcherCommand will run the `frontend:dev:watcher` command if it was given, ex- `npm run dev`
func runFrontendDevWatcherCommand(cwd string, devCommand string, discoverViteServerURL bool) (func(), string, error) {
func runFrontendDevWatcherCommand(frontendDirectory string, devCommand string, discoverViteServerURL bool) (func(), string, error) {
ctx, cancel := context.WithCancel(context.Background())
scanner := NewStdoutScanner()
dir := filepath.Join(cwd, "frontend")
cmdSlice := strings.Split(devCommand, " ")
cmd := exec.CommandContext(ctx, cmdSlice[0], cmdSlice[1:]...)
cmd.Stderr = os.Stderr
cmd.Stdout = scanner
cmd.Dir = dir
cmd.Dir = frontendDirectory
setParentGID(cmd)
if err := cmd.Start(); err != nil {
@@ -573,7 +584,19 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
case err := <-watcher.Errors:
LogDarkYellow(err.Error())
case item := <-watcher.Events:
// Check for file writes
isEligibleFile := func(fileName string) bool {
// Iterate all file patterns
ext := filepath.Ext(fileName)
if ext != "" {
ext = ext[1:]
if _, exists := extensionsThatTriggerARebuild[ext]; exists {
return true
}
}
return false
}
// Handle write operations
if item.Op&fsnotify.Write == fsnotify.Write {
// Ignore directories
itemName := item.Name
@@ -581,15 +604,10 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
continue
}
// Iterate all file patterns
ext := filepath.Ext(itemName)
if ext != "" {
ext = ext[1:]
if _, exists := extensionsThatTriggerARebuild[ext]; exists {
rebuild = true
timer.Reset(interval)
continue
}
if isEligibleFile(itemName) {
rebuild = true
timer.Reset(interval)
continue
}
for _, reloadDir := range dirsThatTriggerAReload {
@@ -605,7 +623,8 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
timer.Reset(interval)
}
// Check for new directories
// Handle new fs entries that are created
if item.Op&fsnotify.Create == fsnotify.Create {
// If this is a folder, add it to our watch list
if fs.DirExists(item.Name) {
@@ -617,6 +636,14 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
}
LogGreen("Added new directory to watcher: %s", item.Name)
}
} else if isEligibleFile(item.Name) {
// Handle creation of new file.
// Note: On some platforms an update to a file is represented as
// REMOVE -> CREATE instead of WRITE, so this is not only new files
// but also updates to existing files
rebuild = true
timer.Reset(interval)
continue
}
}
case <-timer.C:
@@ -7,6 +7,7 @@ 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/assetserver"
"github.com/wailsapp/wails/v2/pkg/options/mac"
"github.com/wailsapp/wails/v2/pkg/options/windows"
)
@@ -36,7 +37,9 @@ func main() {
StartHidden: false,
HideWindowOnClose: false,
BackgroundColour: &options.RGBA{R: 255, G: 255, B: 255, A: 255},
Assets: assets,
AssetServer: &assetserver.Options{
Assets: assets,
},
Menu: nil,
Logger: nil,
LogLevel: logger.DEBUG,
@@ -55,6 +58,7 @@ func main() {
DisableWindowIcon: false,
// DisableFramelessWindowDecorations: false,
WebviewUserDataPath: "",
ZoomFactor: 1.0,
},
// Mac platform specific options
Mac: &mac.Options{
@@ -1,4 +1,5 @@
{
"$schema": "https://wails.io/schemas/config.v2.json",
"name": "{{.ProjectName}}",
"outputfilename": "{{.BinaryName}}",
"frontend:install": "npm install",

Some files were not shown because too many files have changed in this diff Show More