wails
wails copied to clipboard
[v3] Add `port` flag to dev command
Description
This PR adds the following flag to the dev command:
vport: The vite dev server port, default:9245
And adds support for the environment variable WAILS_VITE_PORT
server.strictport is set to exit if the specified port is already in use.
Fixes #3379
Type of change
- [x] New feature (non-breaking change which adds functionality)
How Has This Been Tested?
The following commands have been executed inside a new project:
wails3 dev # Port: 9245
wails3 dev -port 3333 # Port: 3333
WAILS_VITE_PORT=3333 wails3 dev # Port: 3333
wails3 task dev # Port: 9245
wails3 task dev VITE_PORT=3333 # Port: 3333
WAILS_VITE_PORT=3333 wails3 task dev # Port: 3333
WAILS_VITE_PORT=3333 wails3 dev -port=2222 # Port: 2222
Executing wails3 dev twice triggered the following error message:
ERROR listen tcp 127.0.0.1:9245: bind: address already in use
- [ ] Windows
- [ ] macOS
- [x] Linux
Test Configuration
# System
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
| Name | Manjaro Linux |
| Version | Unknown |
| ID | manjaro |
| Branding | |
| Platform | linux |
| Architecture | amd64 |
| CPU | AMD Ryzen 5 3600 6-Core Processor |
| GPU 1 | Navi 10 [Radeon RX 5600 OEM/5600 XT / 5700/5700 XT] (Advanced Micro Devices, Inc. [AMD/ATI]) - Driver: amdgpu |
| Memory | 32GB |
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
# Build Environment
┌─────────────────────────────────────────────────────────────────────────────────────────────────┐
| Wails CLI | v3.0.0-alpha.4 |
| Go Version | go1.22.0 |
| Revision | 1b288a0a1a37c849a4edc22430b372e8469308ec |
| Modified | true |
| -buildmode | exe |
| -compiler | gc |
| CGO_CFLAGS | |
| CGO_CPPFLAGS | |
| CGO_CXXFLAGS | |
| CGO_ENABLED | 1 |
| CGO_LDFLAGS | |
| DefaultGODEBUG | httplaxcontentlength=1,httpmuxgo121=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1 |
| GOAMD64 | v1 |
| GOARCH | amd64 |
| GOOS | linux |
| vcs | git |
| vcs.modified | true |
| vcs.revision | 1b288a0a1a37c849a4edc22430b372e8469308ec |
| vcs.time | 2024-04-23T14:32:21Z |
└─────────────────────────────────────────────────────────────────────────────────────────────────┘
# Dependencies
┌───────────────────────────┐
| gcc | 13.2.1-5 |
| libgtk-3 | 1:3.24.41-1 |
| libwebkit | 2.42.5-2 |
| npm | 10.5.0 |
| pkg-config | 2.1.0-2 |
└─ * - Optional Dependency ─┘
# Diagnosis
SUCCESS Your system is ready for Wails development!
Checklist:
- [x] I have updated
website/src/pages/changelog.mdxwith details of this PR - [x] My code follows the general coding style of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes