Skip to content

Commit 78bde14

Browse files
committed
Add releasenotes command
1 parent 60d1388 commit 78bde14

File tree

9 files changed

+379
-3
lines changed

9 files changed

+379
-3
lines changed

docs/src/content/docs/changelog.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3535
- Added `WindowDidMoveDebounceMS` option to Window's WindowOptions by [@leaanthony](https://github.com/leaanthony)
3636
- Added Single Instance feature by [@leaanthony](https://github.com/leaanthony). Based on the [v2 PR](https://github.com/wailsapp/wails/pull/2951) by @APshenkin.
3737
- Added template generation using `wails3 generate template` command by [@leaanthony](https://github.com/leaanthony)
38+
- Added `wails3 releasenotes` command by [@leaanthony](https://github.com/leaanthony)
3839

3940
### Fixed
4041

docs/src/content/docs/guides/cli.mdx

+13-3
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ Performs a system check and displays a status report.
117117
wails3 doctor
118118
```
119119

120-
Base command: `wails3 generate`
121-
122120
## Generate Commands
123121

124122
Generate commands help create various project assets like bindings, icons, and build files. All generate commands use the base command: `wails3 generate <command>`.
@@ -390,6 +388,19 @@ Opens the Wails documentation in your default browser.
390388
wails3 docs
391389
```
392390

391+
### `releasenotes`
392+
Shows the release notes for the current or specified version.
393+
394+
```bash
395+
wails3 releasenotes [flags]
396+
```
397+
398+
#### Flags
399+
| Flag | Description | Default |
400+
|------|-----------------------------------|---------|
401+
| `-v` | Version to show release notes for | |
402+
| `-n` | Disable colour output | `false` |
403+
393404
### `version`
394405
Prints the current version of Wails.
395406

@@ -403,4 +414,3 @@ Opens the Wails sponsorship page in your default browser.
403414
```bash
404415
wails3 sponsor
405416

406-
```

v3/cmd/wails3/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func main() {
3737
app.NewSubCommandFunction("dev", "Run in Dev mode", commands.Dev)
3838
app.NewSubCommandFunction("package", "Package application", commands.Package)
3939
app.NewSubCommandFunction("doctor", "System status report", commands.Doctor)
40+
app.NewSubCommandFunction("releasenotes", "Show release notes", commands.ReleaseNotes)
4041

4142
task := app.NewSubCommand("task", "Run and list tasks")
4243
var taskFlags commands.RunTaskOptions

v3/go.mod

+13
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ module github.com/wailsapp/wails/v3
33
go 1.22.4
44

55
require (
6+
github.com/Masterminds/semver v1.5.0
67
github.com/adrg/xdg v0.5.0
78
github.com/atterpac/refresh v0.8.3
89
github.com/bep/debounce v1.2.1
10+
github.com/charmbracelet/glamour v0.8.0
911
github.com/ebitengine/purego v0.4.0-alpha.4
1012
github.com/go-git/go-git/v5 v5.12.0
1113
github.com/go-ole/go-ole v1.3.0
@@ -55,9 +57,13 @@ require (
5557
github.com/ProtonMail/go-crypto v1.0.0 // indirect
5658
github.com/StackExchange/wmi v1.2.1 // indirect
5759
github.com/alecthomas/chroma/v2 v2.14.0 // indirect
60+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
61+
github.com/aymerick/douceur v0.2.0 // indirect
5862
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb // indirect
5963
github.com/cavaliergopher/cpio v1.0.1 // indirect
6064
github.com/chainguard-dev/git-urls v1.0.2 // indirect
65+
github.com/charmbracelet/lipgloss v0.12.1 // indirect
66+
github.com/charmbracelet/x/ansi v0.1.4 // indirect
6167
github.com/cloudflare/circl v1.3.8 // indirect
6268
github.com/containerd/console v1.0.4 // indirect
6369
github.com/cyphar/filepath-securejoin v0.2.5 // indirect
@@ -77,6 +83,7 @@ require (
7783
github.com/gookit/color v1.5.2 // indirect
7884
github.com/goreleaser/chglog v0.6.1 // indirect
7985
github.com/goreleaser/fileglob v1.3.0 // indirect
86+
github.com/gorilla/css v1.0.1 // indirect
8087
github.com/huandu/xstrings v1.3.3 // indirect
8188
github.com/imdario/mergo v0.3.16 // indirect
8289
github.com/jaypipes/pcidb v1.0.1 // indirect
@@ -89,13 +96,17 @@ require (
8996
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
9097
github.com/klauspost/pgzip v1.2.6 // indirect
9198
github.com/lithammer/fuzzysearch v1.1.5 // indirect
99+
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
92100
github.com/mattn/go-runewidth v0.0.16 // indirect
93101
github.com/mattn/go-zglob v0.0.6 // indirect
102+
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
94103
github.com/mitchellh/copystructure v1.2.0 // indirect
95104
github.com/mitchellh/go-homedir v1.1.0 // indirect
96105
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
97106
github.com/mitchellh/reflectwalk v1.0.2 // indirect
98107
github.com/muesli/cancelreader v0.2.2 // indirect
108+
github.com/muesli/reflow v0.3.0 // indirect
109+
github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a // indirect
99110
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
100111
github.com/pjbgf/sha1cd v0.3.0 // indirect
101112
github.com/radovskyb/watcher v1.0.7 // indirect
@@ -111,6 +122,8 @@ require (
111122
github.com/ulikunitz/xz v0.5.12 // indirect
112123
github.com/xanzy/ssh-agent v0.3.3 // indirect
113124
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
125+
github.com/yuin/goldmark v1.7.4 // indirect
126+
github.com/yuin/goldmark-emoji v1.0.3 // indirect
114127
github.com/zeebo/xxh3 v1.0.2 // indirect
115128
gitlab.com/digitalxero/go-conventional-commit v1.0.7 // indirect
116129
golang.org/x/crypto v0.25.0 // indirect

v3/go.sum

+33
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ github.com/MarvinJWendt/testza v0.5.1 h1:a9Fqx6vQrHQ4CyiaLhktfTTelwGotmFWy8MNhya
2525
github.com/MarvinJWendt/testza v0.5.1/go.mod h1:L7csM8IBqCc0HH4TRYZSPCIRg6zJeqzM1pm3FSYZBso=
2626
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
2727
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
28+
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
29+
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
2830
github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
2931
github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7rj+4nv4=
3032
github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
@@ -56,6 +58,12 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkY
5658
github.com/atomicgo/cursor v0.0.1/go.mod h1:cBON2QmmrysudxNBFthvMtN32r3jxVRIvzkUiF/RuIk=
5759
github.com/atterpac/refresh v0.8.3 h1:Xj0rtd6Wfv/u03wZOdauASBOPxGZOJeik065S0wISNg=
5860
github.com/atterpac/refresh v0.8.3/go.mod h1:fJpWySLdpbANS8Ej5OvfZVZIVvi/9bmnhTjKS5EjQes=
61+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
62+
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
63+
github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWpi6yML8=
64+
github.com/aymanbagabas/go-udiff v0.2.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA=
65+
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
66+
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
5967
github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY=
6068
github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0=
6169
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb h1:m935MPodAbYS46DG4pJSv7WO+VECIWUQ7OJYSoTrMh4=
@@ -67,6 +75,14 @@ github.com/cavaliergopher/cpio v1.0.1 h1:KQFSeKmZhv0cr+kawA3a0xTQCU4QxXF1vhU7P7a
6775
github.com/cavaliergopher/cpio v1.0.1/go.mod h1:pBdaqQjnvXxdS/6CvNDwIANIFSP0xRKI16PX4xejRQc=
6876
github.com/chainguard-dev/git-urls v1.0.2 h1:pSpT7ifrpc5X55n4aTTm7FFUE+ZQHKiqpiwNkJrVcKQ=
6977
github.com/chainguard-dev/git-urls v1.0.2/go.mod h1:rbGgj10OS7UgZlbzdUQIQpT0k/D4+An04HJY7Ol+Y/o=
78+
github.com/charmbracelet/glamour v0.8.0 h1:tPrjL3aRcQbn++7t18wOpgLyl8wrOHUEDS7IZ68QtZs=
79+
github.com/charmbracelet/glamour v0.8.0/go.mod h1:ViRgmKkf3u5S7uakt2czJ272WSg2ZenlYEZXT2x7Bjw=
80+
github.com/charmbracelet/lipgloss v0.12.1 h1:/gmzszl+pedQpjCOH+wFkZr/N90Snz40J/NR7A0zQcs=
81+
github.com/charmbracelet/lipgloss v0.12.1/go.mod h1:V2CiwIuhx9S1S1ZlADfOj9HmxeMAORuz5izHb0zGbB8=
82+
github.com/charmbracelet/x/ansi v0.1.4 h1:IEU3D6+dWwPSgZ6HBH+v6oUuZ/nVawMiWj5831KfiLM=
83+
github.com/charmbracelet/x/ansi v0.1.4/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw=
84+
github.com/charmbracelet/x/exp/golden v0.0.0-20240715153702-9ba8adf781c4 h1:6KzMkQeAF56rggw2NZu1L+TH7j9+DM1/2Kmh7KUxg1I=
85+
github.com/charmbracelet/x/exp/golden v0.0.0-20240715153702-9ba8adf781c4/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U=
7086
github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
7187
github.com/cloudflare/circl v1.3.8 h1:j+V8jJt09PoeMFIu2uh5JUyEaIHTXVOHslFoLNAKqwI=
7288
github.com/cloudflare/circl v1.3.8/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU=
@@ -144,6 +160,8 @@ github.com/goreleaser/fileglob v1.3.0 h1:/X6J7U8lbDpQtBvGcwwPS6OpzkNVlVEsFUVRx9+
144160
github.com/goreleaser/fileglob v1.3.0/go.mod h1:Jx6BoXv3mbYkEzwm9THo7xbr5egkAraxkGorbJb4RxU=
145161
github.com/goreleaser/nfpm/v2 v2.41.1 h1:4tyZ9b817msLuyGKw53ed3suZNApkGHVZDekdGe8ZEE=
146162
github.com/goreleaser/nfpm/v2 v2.41.1/go.mod h1:VPc5kF5OgfA+BosV/A2aB+Vg34honjWvp0Vt8ogsSi0=
163+
github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8=
164+
github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0=
147165
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
148166
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
149167
github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4=
@@ -204,20 +222,25 @@ github.com/lithammer/fuzzysearch v1.1.5 h1:Ag7aKU08wp0R9QCfF4GoGST9HbmAIeLP7xwMr
204222
github.com/lithammer/fuzzysearch v1.1.5/go.mod h1:1R1LRNk7yKid1BaQkmuLQaHruxcC4HmAH30Dh61Ih1Q=
205223
github.com/lmittmann/tint v1.0.4 h1:LeYihpJ9hyGvE0w+K2okPTGUdVLfng1+nDNVR4vWISc=
206224
github.com/lmittmann/tint v1.0.4/go.mod h1:HIS3gSy7qNwGCj+5oRjAutErFBl4BzdQP6cJZ0NfMwE=
225+
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
226+
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
207227
github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE=
208228
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
209229
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
210230
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
211231
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
212232
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
213233
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
234+
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
214235
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
215236
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
216237
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
217238
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
218239
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
219240
github.com/mattn/go-zglob v0.0.6 h1:mP8RnmCgho4oaUYDIDn6GNxYk+qJGUs8fJLn+twYj2A=
220241
github.com/mattn/go-zglob v0.0.6/go.mod h1:MxxjyoXXnMxfIpxTK2GAkw1w8glPsQILx3N5wrKakiY=
242+
github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk=
243+
github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA=
221244
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
222245
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
223246
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
@@ -230,6 +253,10 @@ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zx
230253
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
231254
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
232255
github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
256+
github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
257+
github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
258+
github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a h1:2MaM6YC3mGu54x+RKAA6JiFFHlHDY1UbkxqppT7wYOg=
259+
github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a/go.mod h1:hxSnBBYLK21Vtq/PHd0S2FYCxBXzBua8ov5s1RobyRQ=
233260
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
234261
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
235262
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
@@ -256,6 +283,7 @@ github.com/radovskyb/watcher v1.0.7/go.mod h1:78okwvY5wPdzcb1UYnip1pvrZNIVEIh/Cm
256283
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
257284
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
258285
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
286+
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
259287
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
260288
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
261289
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
@@ -316,6 +344,11 @@ github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMx
316344
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8=
317345
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs=
318346
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
347+
github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
348+
github.com/yuin/goldmark v1.7.4 h1:BDXOHExt+A7gwPCJgPIIq7ENvceR7we7rOS9TNoLZeg=
349+
github.com/yuin/goldmark v1.7.4/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
350+
github.com/yuin/goldmark-emoji v1.0.3 h1:aLRkLHOuBR2czCY4R8olwMjID+tENfhyFDMCRhbIQY4=
351+
github.com/yuin/goldmark-emoji v1.0.3/go.mod h1:tTkZEbwu5wkPmgTcitqddVxY9osFZiavD+r4AzQrh1U=
319352
github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ=
320353
github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0=
321354
github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0=

v3/internal/commands/releasenotes.go

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package commands
2+
3+
import (
4+
"github.com/pterm/pterm"
5+
"github.com/wailsapp/wails/v3/internal/github"
6+
"github.com/wailsapp/wails/v3/internal/version"
7+
)
8+
9+
type ReleaseNotesOptions struct {
10+
Version string `name:"v" description:"The version to show release notes for"`
11+
NoColour bool `name:"n" description:"Disable colour output"`
12+
}
13+
14+
func ReleaseNotes(options *ReleaseNotesOptions) error {
15+
if options.NoColour {
16+
pterm.DisableColor()
17+
}
18+
19+
currentVersion := version.VersionString
20+
if options.Version != "" {
21+
currentVersion = options.Version
22+
}
23+
24+
releaseNotes := github.GetReleaseNotes(currentVersion, options.NoColour)
25+
pterm.Println(releaseNotes)
26+
return nil
27+
}

v3/internal/github/github.go

+142
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
package github
2+
3+
import (
4+
"encoding/json"
5+
"fmt"
6+
"github.com/charmbracelet/glamour/styles"
7+
"io"
8+
"net/http"
9+
"net/url"
10+
"sort"
11+
"strings"
12+
13+
"github.com/charmbracelet/glamour"
14+
)
15+
16+
func GetReleaseNotes(tagVersion string, noColour bool) string {
17+
resp, err := http.Get("https://api.github.com/repos/wailsapp/wails/releases/tags/" + url.PathEscape(tagVersion))
18+
if err != nil {
19+
return "Unable to retrieve release notes. Please check your network connection"
20+
}
21+
body, err := io.ReadAll(resp.Body)
22+
if err != nil {
23+
return "Unable to retrieve release notes. Please check your network connection"
24+
}
25+
26+
data := map[string]interface{}{}
27+
err = json.Unmarshal(body, &data)
28+
if err != nil {
29+
return "Unable to retrieve release notes. Please check your network connection"
30+
}
31+
32+
if data["body"] == nil {
33+
return "No release notes found"
34+
}
35+
36+
result := "# Release Notes for " + tagVersion + "\n" + data["body"].(string)
37+
var renderer *glamour.TermRenderer
38+
39+
if noColour {
40+
renderer, err = glamour.NewTermRenderer(glamour.WithStyles(styles.NoTTYStyleConfig))
41+
} else {
42+
renderer, err = glamour.NewTermRenderer(glamour.WithAutoStyle())
43+
}
44+
if err != nil {
45+
return result
46+
}
47+
result, err = renderer.Render(result)
48+
if err != nil {
49+
return err.Error()
50+
}
51+
return result
52+
}
53+
54+
// GetVersionTags gets the list of tags on the Wails repo
55+
// It returns a list of sorted tags in descending order
56+
func GetVersionTags() ([]*SemanticVersion, error) {
57+
result := []*SemanticVersion{}
58+
var err error
59+
60+
resp, err := http.Get("https://api.github.com/repos/wailsapp/wails/tags")
61+
if err != nil {
62+
return result, err
63+
}
64+
body, err := io.ReadAll(resp.Body)
65+
if err != nil {
66+
return result, err
67+
}
68+
69+
data := []map[string]interface{}{}
70+
err = json.Unmarshal(body, &data)
71+
if err != nil {
72+
return result, err
73+
}
74+
75+
// Convert tag data to Version structs
76+
for _, tag := range data {
77+
version := tag["name"].(string)
78+
if !strings.HasPrefix(version, "v2") {
79+
continue
80+
}
81+
semver, err := NewSemanticVersion(version)
82+
if err != nil {
83+
return result, err
84+
}
85+
result = append(result, semver)
86+
}
87+
88+
// Reverse Sort
89+
sort.Sort(sort.Reverse(SemverCollection(result)))
90+
91+
return result, err
92+
}
93+
94+
// GetLatestStableRelease gets the latest stable release on GitHub
95+
func GetLatestStableRelease() (result *SemanticVersion, err error) {
96+
tags, err := GetVersionTags()
97+
if err != nil {
98+
return nil, err
99+
}
100+
101+
for _, tag := range tags {
102+
if tag.IsRelease() {
103+
return tag, nil
104+
}
105+
}
106+
107+
return nil, fmt.Errorf("no release tag found")
108+
}
109+
110+
// GetLatestPreRelease gets the latest prerelease on GitHub
111+
func GetLatestPreRelease() (result *SemanticVersion, err error) {
112+
tags, err := GetVersionTags()
113+
if err != nil {
114+
return nil, err
115+
}
116+
117+
for _, tag := range tags {
118+
if tag.IsPreRelease() {
119+
return tag, nil
120+
}
121+
}
122+
123+
return nil, fmt.Errorf("no prerelease tag found")
124+
}
125+
126+
// IsValidTag returns true if the given string is a valid tag
127+
func IsValidTag(tagVersion string) (bool, error) {
128+
if tagVersion[0] == 'v' {
129+
tagVersion = tagVersion[1:]
130+
}
131+
tags, err := GetVersionTags()
132+
if err != nil {
133+
return false, err
134+
}
135+
136+
for _, tag := range tags {
137+
if tag.String() == tagVersion {
138+
return true, nil
139+
}
140+
}
141+
return false, nil
142+
}

0 commit comments

Comments
 (0)