5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 11:40:56 +08:00

v2.0.0-beta.38 + release script

This commit is contained in:
Lea Anthony 2022-06-27 20:41:09 +10:00
parent f8e6fa4bf3
commit 66f79c2e51
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405
63 changed files with 231 additions and 71 deletions

View File

@ -7,7 +7,7 @@ import (
"github.com/leaanthony/debme"
"github.com/leaanthony/gosod"
"github.com/wailsapp/wails/v2/cmd/wails/internal/commands/initialise/templates/generate/s"
"github.com/wailsapp/wails/v2/internal/s"
)
//go:embed assets/common/*
@ -165,7 +165,11 @@ func main() {
}
// copy plain template
s.ECHO("Copying plain template")
s.RMDIR("../templates/plain")
s.COPYDIR("plain", "../templates/plain")
s.ECHO(`Until an auto fix is done, add "@babel/types": "^7.17.10" to vite-ts/frontend/package.json`)
}
func rebuildRuntime() {
@ -224,6 +228,4 @@ func createTemplate(template *template) {
checkError(err)
s.CD(cwd)
s.ECHO(`Until an auto fix is done, add "@babel/types": "^7.17.10" to vite-ts/frontend/package.json`)
}

View File

@ -36,7 +36,7 @@ func main() {
Frameless: false,
StartHidden: false,
HideWindowOnClose: false,
BackgroundColour: &options.RGBA{R: 255, G: 255, B: 255, A: 255},
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
Assets: assets,
Menu: nil,
Logger: nil,

View File

@ -14,7 +14,6 @@
"@vitejs/plugin-vue": "^2.3.3",
"typescript": "^4.5.4",
"vite": "^2.9.9",
"vue-tsc": "^0.34.7",
"@babel/types": "^7.17.10"
"vue-tsc": "^0.34.7"
}
}

View File

@ -1,3 +1,6 @@
package internal
var Version = "v2.0.0-beta.37"
import _ "embed"
//go:embed version.txt
var Version string

View File

@ -0,0 +1 @@
v2.0.0-beta.38

View File

@ -0,0 +1,67 @@
package main
import (
"encoding/json"
"github.com/wailsapp/wails/v2/internal/s"
"os"
"os/exec"
"strconv"
"strings"
)
const versionFile = "../../cmd/wails/internal/version.txt"
func checkError(err error) {
if err != nil {
println(err.Error())
os.Exit(1)
}
}
func updateVersion() string {
currentVersionData, err := os.ReadFile(versionFile)
checkError(err)
currentVersion := string(currentVersionData)
vsplit := strings.Split(currentVersion, ".")
minorVersion, err := strconv.Atoi(vsplit[len(vsplit)-1])
checkError(err)
minorVersion++
vsplit[len(vsplit)-1] = strconv.Itoa(minorVersion)
newVersion := strings.Join(vsplit, ".")
err = os.WriteFile(versionFile, []byte(newVersion), 0755)
checkError(err)
return newVersion
}
func main() {
newVersion := updateVersion()
s.CD("../../../website")
s.ECHO("Generating new Docs for version: " + newVersion)
cmd := exec.Command("npm", "run", "docusaurus", "docs:version", newVersion)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
checkError(err)
// Load the version list
versionsData, err := os.ReadFile("versions.json")
checkError(err)
var versions []string
err = json.Unmarshal(versionsData, &versions)
checkError(err)
oldestVersion := versions[len(versions)-1]
s.ECHO(oldestVersion)
versions = versions[0 : len(versions)-1]
newVersions, err := json.Marshal(&versions)
checkError(err)
err = os.WriteFile("versions.json", newVersions, 0755)
checkError(err)
s.ECHO("Removing old version: " + oldestVersion)
s.CD("versioned_docs")
s.RMDIR("version-" + oldestVersion)
s.CD("../versioned_sidebars")
s.RM("version-" + oldestVersion + "-sidebars.json")
}

View File

@ -1,8 +0,0 @@
# Surge
<p style={{"text-align": "center"}}>
<img src="/img/showcase/surge.png"></img><br/>
</p>
[Surge](https://surge.rule110.io/) is a p2p filesharing app designed to utilize blockchain technologies to enable 100% anonymous file transfers. Surge is end-to-end encrypted, decentralized and open source.

View File

@ -0,0 +1,11 @@
# October
<p style={{"text-align": "center"}}>
<img src="/img/showcase/october.png"></img><br/>
</p>
[October](https://october.utf9k.net) is a small Wails application that makes it really easy to extract highlights from [Kobo eReaders](https://en.wikipedia.org/wiki/Kobo_eReader) and then forward them to [Readwise](https://readwise.io).
It has a relatively small scope with all platform versions weighing in under 10MB, and that's without enabling [UPX compression](https://upx.github.io/)!
In contrast, the author's previous attempts with Electron quickly bloated to several hundred megabytes.

View File

@ -0,0 +1,8 @@
# Surge
<p style={{"text-align": "center"}}>
<img src="/img/showcase/surge.png"></img><br/>
</p>
[Surge](https://getsurge.io/) is a p2p filesharing app designed to utilize blockchain technologies to enable 100% anonymous file transfers. Surge is end-to-end encrypted, decentralized and open source.

View File

@ -35,6 +35,7 @@ If you are unsure about a template, inspect `package.json` and `wails.json` for
- [wails-react-template](https://github.com/AlienRecall/wails-react-template) - A template using reactjs
- [wails-react-template](https://github.com/flin7/wails-react-template) - A minimal template for React that supports live development
- [wails-template-nextjs](https://github.com/LGiki/wails-template-nextjs) - A template using Next.js and TypeScript
## Svelte

View File

@ -13,6 +13,7 @@ Pick your favourite framework:
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
@ -27,60 +28,60 @@ import TabItem from "@theme/TabItem";
{label: "Vanilla", value: "Vanilla"},
]}
>
<TabItem value="Svelte">
Generate a <a href="https://svelte.dev/">Svelte</a> project using Javascript with:<br/>
<TabItem value="Svelte">
Generate a <a href="https://svelte.dev/">Svelte</a> project using Javascript with:<br/>
wails init -n myproject -t svelte
wails init -n myproject -t svelte
If you would rather use Typescript:
If you would rather use Typescript:
wails init -n myproject -t svelte-ts
</TabItem>
<TabItem value="React">
Generate a <a href="https://reactjs.org/">React</a> project using Javascript with:<br/>
wails init -n myproject -t svelte-ts
</TabItem>
<TabItem value="React">
Generate a <a href="https://reactjs.org/">React</a> project using Javascript with:<br/>
wails init -n myproject -t react
wails init -n myproject -t react
If you would rather use Typescript:
If you would rather use Typescript:
wails init -n myproject -t react-ts
</TabItem>
<TabItem value="Vue">
Generate a <a href="https://vuejs.org/">Vue</a> project using Javascript with:<br/>
wails init -n myproject -t react-ts
</TabItem>
<TabItem value="Vue">
Generate a <a href="https://vuejs.org/">Vue</a> project using Javascript with:<br/>
wails init -n myproject -t vue
wails init -n myproject -t vue
If you would rather use Typescript:
If you would rather use Typescript:
wails init -n myproject -t vue-ts
</TabItem>
<TabItem value="Preact">
Generate a <a href="https://preactjs.com/">Preact</a> project using Javascript with:<br/>
wails init -n myproject -t vue-ts
</TabItem>
<TabItem value="Preact">
Generate a <a href="https://preactjs.com/">Preact</a> project using Javascript with:<br/>
wails init -n myproject -t preact
wails init -n myproject -t preact
If you would rather use Typescript:
If you would rather use Typescript:
wails init -n myproject -t preact-ts
</TabItem>
<TabItem value="Lit">
Generate a <a href="https://lit.dev/">Lit</a> project using Javascript with:<br/>
wails init -n myproject -t preact-ts
</TabItem>
<TabItem value="Lit">
Generate a <a href="https://lit.dev/">Lit</a> project using Javascript with:<br/>
wails init -n myproject -t lit
wails init -n myproject -t lit
If you would rather use Typescript:
If you would rather use Typescript:
wails init -n myproject -t lit-ts
</TabItem>
<TabItem value="Vanilla">
Generate a Vanilla project using Javascript with:<br/>
wails init -n myproject -t lit-ts
</TabItem>
<TabItem value="Vanilla">
Generate a Vanilla project using Javascript with:<br/>
wails init -n myproject -t vanilla
wails init -n myproject -t vanilla
If you would rather use Typescript:
If you would rather use Typescript:
wails init -n myproject -t vanilla-ts
</TabItem>
wails init -n myproject -t vanilla-ts
</TabItem>
</Tabs>
<hr/>

View File

@ -21,7 +21,7 @@ If your built application looks like this in finder:
<img src="/img/troubleshooting/invalid_mac_app.png"></img>
</p>
it's likely that your application's `info.plist` is invalid. Update the file in `build/<yourapp>.app/Contents/info.plist`
it''s likely that your application''s `info.plist` is invalid. Update the file in `build/<yourapp>.app/Contents/info.plist`
and check if the data is valid, EG check the binary name is correct. To persist the changes, copy the file back to
the `build/darwin` directory.
@ -55,7 +55,7 @@ window.go.main.App.TestFunc(msg, args).then((result) => { //without the 3 dots
```
Credit: https://github.com/wailsapp/wails/issues/1186
## I'm having getting proxy errors when trying to install Wails
## I''m having getting proxy errors when trying to install Wails
If you are getting errors like this:
```
@ -67,4 +67,10 @@ The solution is to set up the proxy manually, eg:
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
```
Source: https://github.com/wailsapp/wails/issues/1233
Source: https://github.com/wailsapp/wails/issues/1233
## The generated Typescript doesn''t have the correct types
Sometimes the generated Typescript doesn''t have the correct types. To mitigate this,
it is possible to specify what types should be generated using the `ts_type` struct tag. For
more details, please read [this](https://github.com/tkrajina/typescriptify-golang-structs#custom-types).

View File

@ -34,3 +34,20 @@ up to the user.
### Error
If no suitable runtime is found, an error is given to the user and no further action taken.
## Fixed version runtime
Another way of dealing with webview2 dependency is shipping it yourself.
You can download [fixed version runtime](https://developer.microsoft.com/ru-ru/microsoft-edge/webview2/#download-section) and bundle or download it with your application.
Also, you should specify path to fixed version of webview2 runtime in the `windows.Options` structure when launching wails.
```go
wails.Run(&options.App{
Windows: &windows.Options{
WebviewBrowserPath: "",
},
})
```
Note: When `WebviewBrowserPath` is specified, `error` strategy will be forced in case of minimal required version mismatch or invalid path to a runtime.

View File

@ -70,6 +70,7 @@ If you are unsure about a template, inspect `package.json` and `wails.json` for
| -u | Updates your project's `go.mod` to use the same version of Wails as the CLI | |
| -debug | Retains debug information in the application | false |
| -trimpath | Remove all file system paths from the resulting executable. | false |
| -race | Build with Go's race detector | false |
For a detailed description of the `webview2` flag, please refer to the [Windows](../guides/windows.mdx) Guide.
@ -168,6 +169,7 @@ Your system is ready for Wails development!
| -tags "extra tags" | Build tags to pass to compiler (quoted and space separated) | |
| -loglevel "loglevel"| Loglevel to use - Trace, Debug, Info, Warning, Error | Debug |
| -noreload | Disable automatic reload when assets change | |
| -nogen | Disable generate module | |
| -v | Verbosity level (0 - silent, 1 - standard, 2 - verbose) | 1 |
| -wailsjsdir | The directory to generate the generated Wails JS modules | Value in `wails.json` |
| -debounce | The time to wait for reload after an asset change is detected | 100 (milliseconds) |
@ -175,8 +177,8 @@ Your system is ready for Wails development!
| -frontenddevserverurl "url" | Use 3rd party dev server url to serve assets, EG Vite | "" |
| -appargs "args" | Arguments passed to the application in shell style | |
| -platform "platform" | Platform/Arch to target | `runtime.GOOS` |
| -save | Saves the given `assetdir`, `reloaddirs`, `wailsjsdir`, `debounce`, `devserver` and `frontenddevserverurl` flags in
`wails.json` to become the defaults for subsequent invocations. | |
| -save | Saves the given `assetdir`, `reloaddirs`, `wailsjsdir`, `debounce`, `devserver` and `frontenddevserverurl` flags in `wails.json` to become the defaults for subsequent invocations. | |
| -race | Build with Go's race detector | false |
Example:
@ -193,9 +195,6 @@ There is more information on using this feature with existing framework scripts
## generate
### module
Wails creates a javascript module as described in `wails dev`. Use `wails generate module` to generate the javascript interface code.
### template
Wails uses templates for project generation. The `wails generate template` command helps scaffold a template so that

View File

@ -18,6 +18,10 @@ An example of how to create a menu:
FileMenu.AddText("Quit", keys.CmdOrCtrl("q"), func(_ *menu.CallbackData) {
runtime.Quit()
})
if runtime.GOOS == "darwin" {
AppMenu.Append(menu.EditMenu()) // on macos platform, we should append EditMenu to enable Cmd+C,Cmd+V,Cmd+Z... shortcut
}
err := wails.Run(&options.App{
Title: "Menus Demo",

View File

@ -27,7 +27,7 @@ func main() {
MaxHeight: 1024,
StartHidden: false,
HideWindowOnClose: false,
RGBA: &options.RGBA{R: 0, G: 0, B: 0, A: 255},
BackgroundColour: &options.RGBA{R: 0, G: 0, B: 0, A: 255},
AlwaysOnTop: false,
Assets: assets,
AssetsHandler: assetsHandler,
@ -48,6 +48,7 @@ func main() {
DisableWindowIcon: false,
DisableFramelessWindowDecorations: false,
WebviewUserDataPath: "",
WebviewBrowserPath: "",
Theme: windows.SystemDefault,
CustomTheme: &windows.ThemeSettings{
DarkModeTitleBar: windows.RGB(20, 20, 20),
@ -196,14 +197,14 @@ Type: bool
By default, closing the window will close the application. Setting this to `true` means closing the window will
hide the window instead.
### RGBA
### BackgroundColour
Name: RGBA
Name: BackgroundColour
Type: int (0xRRGGBBAA)
Example: 0xFF000088 - Red at 50% transparency
This value is the RGBA value to set the window by default.
This value is the default background colour of the window.
Default: 0xFFFFFFFF.
### AlwaysOnTop
@ -392,7 +393,7 @@ Name: WebviewIsTransparent
Type: bool
Setting this to `true` will make the webview background transparent when an alpha value of `0` is used.
This means that if you use `rgba(0,0,0,0)`, the host window will show through.
This means that if you use `rgba(0,0,0,0)` for `background-color` in your CSS, the host window will show through.
Often combined with [WindowIsTranslucent](#WindowIsTranslucent) to make frosty-looking applications.
### WindowIsTranslucent
@ -430,6 +431,19 @@ Type: string
This defines the path where the WebView2 stores the user data. If empty `%APPDATA%\[BinaryName.exe]` will be used.
### WebviewBrowserPath
Name: WebviewBrowserPath
Type: string
This defines the path to a directory with WebView2 executable files and libraries. If empty, webview2 installed in the system will be used.
Important information about distribution of fixed version runtime:
- [How to get and extract runtime](https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#details-about-the-fixed-version-runtime-distribution-mode)
- [Known issues for fixed version](https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#known-issues-for-fixed-version)
- [The path of fixed version of the WebView2 Runtime should not contain \Edge\Application\.](https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.1245.22#createcorewebview2environmentwithoptions)
### Theme
Name: Theme
@ -511,6 +525,33 @@ Type: `*windows.Messages`
A struct of strings used by the webview2 installer if a valid webview2 runtime is not found.
Customise this for any language you choose to support.
### ResizeDebounceMS
Name: ResizeDebounceMS
Type: uint16
ResizeDebounceMS is the amount of time to debounce redraws of webview2 when resizing the window.
The default value (0) will perform redraws as fast as it can.
### OnSuspend
Name: OnSuspend
Type: func()
If set, this function will be called when windows initiates a switch to low power mode (suspend/hibernate)
### OnResume
Name: OnResume
Type: func()
If set, this function will be called when windows resumes from low power mode (suspend/hibernate)
## Mac Specific Options
### TitleBar
@ -536,7 +577,7 @@ Name: WebviewIsTransparent
Type: bool
Setting this to `true` will make the webview background transparent when an alpha value of `0` is used.
This means that if you use `rgba(0,0,0,0)`, the host window will show through.
This means that if you use `rgba(0,0,0,0)` for `background-color` in your CSS, the host window will show through.
Often combined with [WindowIsTranslucent](#WindowIsTranslucent) to make frosty-looking applications.
### WindowIsTranslucent

View File

@ -19,7 +19,7 @@ The project config resides in the `wails.json` file in the project directory. Th
"wailsjsdir": "[Relative path to the directory that the auto-generated JS modules will be created]",
"version": "[Project config version]",
"outputfilename": "[The name of the binary]",
"debounceMS": 100, // The default time the dev server waits to reload when it detects a vhange in assets
"debounceMS": 100, // The default time the dev server waits to reload when it detects a change in assets
"devServer": "[Address to bind the wails dev sever to. Default: localhost:34115]",
"appargs": "[Arguments passed to the application in shell style when in dev mode]",
"runNonNativeBuildHooks": false, // Defines if build hooks should be run though they are defined for an OS other than the host OS.
@ -35,7 +35,7 @@ The project config resides in the `wails.json` file in the project directory. Th
"copyright": "[The copyright of the product. Default: 'Copyright.........']",
"comments": "[A short comment of the app. Default: 'Built using Wails (https://wails.app)']"
},
"nsisType": "['multiple': One installer per achitecture. 'single': Single universal installer for all architectures being built. Default: 'multiple']"
"nsisType": "['multiple': One installer per architecture. 'single': Single universal installer for all architectures being built. Default: 'multiple']"
}
```

View File

@ -46,6 +46,6 @@ This method sets up a listener for the given event name, but will only trigger a
Go Signature: `EventsEmit(ctx context.Context, eventName string, optionalData ...interface{})`
JS Signature: `EventsEmit(eventName string, optionalData function(optionalData?: any))`
JS Signature: `EventsEmit(ctx context, optionalData function(optionalData?: any))`
This method emits the given event. Optional data may be passed with the event. This will trigger any event listeners.

View File

@ -127,6 +127,14 @@ Will resize the window if the window is currently larger than the given dimensio
Setting a size of `0,0` will disable this constraint.
### WindowSetAlwaysOnTop
Go Signature: `WindowSetAlwaysOnTop(ctx context.Context, b bool)`
JS Signature: `WindowSetAlwaysOnTop(b: Boolen)`
Sets the window AlwaysOnTop or not on top.
### WindowSetPosition
Go Signature: `WindowSetPosition(ctx context.Context, x int, y int)`

View File

@ -1,4 +1,4 @@
[
"v2.0.0-beta.37",
"v2.0.0-beta.35"
]
"v2.0.0-beta.38",
"v2.0.0-beta.37"
]