Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions mkdocs-website/docs/en/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
- Templates for sveltekit and sveltekit-ts that are set for non-SSR development by [atterpac](https://github.com/atterpac) in [#3829](https://github.com/wailsapp/wails/pull/3829)

### Changed
- Taskfile refactor by [leaanthony](https://github.com/leaanthony) in [#3748](https://github.com/wailsapp/wails/pull/3748)
- Upgrade to `go-webview2` v1.0.16 by [leaanthony](https://github.com/leaanthony)
- Fixed `Screen` type to include `ID` not `Id` by [etesam913](https://github.com/etesam913) in [#3778](https://github.com/wailsapp/wails/pull/3778)

### Fixed
- Fixed `AlwaysOnTop` not working on Mac by [leaanthony](https://github.com/leaanthony) in [#3841](https://github.com/wailsapp/wails/pull/3841)
- [darwin] Fixed `application.NewEditMenu` including a duplicate `PasteAndMatchStyle` role in the edit menu on Darwin by [johnmccabe](https://github.com/johnmccabe) in [#3839](https://github.com/wailsapp/wails/pull/3839)

## v3.0.0-alpha.7 - 2024-09-18

### Added
Expand Down
11 changes: 11 additions & 0 deletions v3/examples/window/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,17 @@ func main() {
Show()
windowCounter++
})
myMenu.Add("New WebviewWindow (Always on top)").
OnClick(func(ctx *application.Context) {
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
AlwaysOnTop: true,
}).
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
SetRelativePosition(rand.Intn(1000), rand.Intn(800)).
SetURL("https://wails.io").
Show()
windowCounter++
})
myMenu.Add("New WebviewWindow (Hide Maximise)").
OnClick(func(ctx *application.Context) {
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Expand Down
57 changes: 40 additions & 17 deletions v3/internal/commands/appimage.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"
"strings"
"sync"

Expand Down Expand Up @@ -72,7 +73,18 @@ func generateAppImage(options *GenerateAppImageOptions) error {
// Get the last path of the binary and normalise the name
name := normaliseName(filepath.Base(options.Binary))

appDir := filepath.Join(options.BuildDir, name+"-x86_64.AppDir")
// Architecture-specific variables using a map
archDetails := map[string]string{
"arm64": "aarch64",
"x86_64": "x86_64",
}

arch, exists := archDetails[runtime.GOARCH]
if !exists {
return fmt.Errorf("unsupported architecture: %s", runtime.GOARCH)
}

appDir := filepath.Join(options.BuildDir, fmt.Sprintf("%s-%s.AppDir", name, arch))
s.RMDIR(appDir)

log(p, "Preparing AppImage Directory: "+appDir)
Expand All @@ -92,27 +104,38 @@ func generateAppImage(options *GenerateAppImageOptions) error {
// Download linuxdeploy and make it executable
s.CD(options.BuildDir)

// Download necessary files
// Download URLs using a map based on architecture
urls := map[string]string{
"linuxdeploy": fmt.Sprintf("https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-%s.AppImage", arch),
"AppRun": fmt.Sprintf("https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-%s", arch),
}

// Download necessary files concurrently
log(p, "Downloading AppImage tooling")
var wg sync.WaitGroup
wg.Add(2)

go func() {
if !s.EXISTS(filepath.Join(options.BuildDir, "linuxdeploy-x86_64.AppImage")) {
s.DOWNLOAD("https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage", filepath.Join(options.BuildDir, "linuxdeploy-x86_64.AppImage"))
linuxdeployPath := filepath.Join(options.BuildDir, filepath.Base(urls["linuxdeploy"]))
if !s.EXISTS(linuxdeployPath) {
s.DOWNLOAD(urls["linuxdeploy"], linuxdeployPath)
}
s.CHMOD(filepath.Join(options.BuildDir, "linuxdeploy-x86_64.AppImage"), 0755)
s.CHMOD(linuxdeployPath, 0755)
wg.Done()
}()

go func() {
target := filepath.Join(appDir, "AppRun")
if !s.EXISTS(target) {
s.DOWNLOAD("https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-x86_64", target)
s.DOWNLOAD(urls["AppRun"], target)
}
s.CHMOD(target, 0755)
wg.Done()
}()

wg.Wait()

// Processing GTK files
log(p, "Processing GTK files.")
filesNeeded := []string{"WebKitWebProcess", "WebKitNetworkProcess", "libwebkit2gtkinjectedbundle.so"}
files, err := findGTKFiles(filesNeeded)
Expand All @@ -122,48 +145,48 @@ func generateAppImage(options *GenerateAppImageOptions) error {
s.CD(appDir)
for _, file := range files {
targetDir := filepath.Dir(file)
// Strip leading forward slash
if targetDir[0] == '/' {
targetDir = targetDir[1:]
}
var err error
targetDir, err = filepath.Abs(targetDir)
if err != nil {
return err
}
s.MKDIR(targetDir)
s.COPY(file, targetDir)
}

// Copy GTK Plugin
err = os.WriteFile(filepath.Join(options.BuildDir, "linuxdeploy-plugin-gtk.sh"), gtkPlugin, 0755)
if err != nil {
return err
}

// Determine GTK Version
// Run ldd on the binary and capture the output
targetBinary := filepath.Join(appDir, "usr", "bin", options.Binary)
lddOutput, err := s.EXEC(fmt.Sprintf("ldd %s", targetBinary))
if err != nil {
println(string(lddOutput))
return err
}
lddString := string(lddOutput)
// Check if GTK3 is present
var DeployGtkVersion string
if s.CONTAINS(lddString, "libgtk-x11-2.0.so") {
switch {
case s.CONTAINS(lddString, "libgtk-x11-2.0.so"):
DeployGtkVersion = "2"
} else if s.CONTAINS(lddString, "libgtk-3.so") {
case s.CONTAINS(lddString, "libgtk-3.so"):
DeployGtkVersion = "3"
} else if s.CONTAINS(lddString, "libgtk-4.so") {
case s.CONTAINS(lddString, "libgtk-4.so"):
DeployGtkVersion = "4"
} else {
default:
return fmt.Errorf("unable to determine GTK version")
}

// Run linuxdeploy to bundle the application
s.CD(options.BuildDir)
//log(p, "Generating AppImage (This may take a while...)")
cmd := fmt.Sprintf("./linuxdeploy-x86_64.AppImage --appimage-extract-and-run --appdir %s --output appimage --plugin gtk", appDir)
linuxdeployAppImage := filepath.Join(options.BuildDir, fmt.Sprintf("linuxdeploy-%s.AppImage", arch))

cmd := fmt.Sprintf("%s --appimage-extract-and-run --appdir %s --output appimage --plugin gtk", linuxdeployAppImage, appDir)
s.SETENV("DEPLOY_GTK_VERSION", DeployGtkVersion)
output, err := s.EXEC(cmd)
if err != nil {
Expand All @@ -172,7 +195,7 @@ func generateAppImage(options *GenerateAppImageOptions) error {
}

// Move file to output directory
targetFile := filepath.Join(options.BuildDir, name+"-x86_64.AppImage")
targetFile := filepath.Join(options.BuildDir, fmt.Sprintf("%s-%s.AppImage", name, arch))
s.MOVE(targetFile, options.OutputDir)

log(p, "AppImage created: "+targetFile)
Expand Down
2 changes: 1 addition & 1 deletion v3/internal/templates/preact-ts/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Preact + Vite (Typescript)",
"shortname": "preact-ts",
"author": "Lea Anthony",
"description": "Preact + Vite development server",
"description": "Preact + TS + Vite development server",
"helpurl": "https://wails.io",
"version": 3
}
2 changes: 1 addition & 1 deletion v3/internal/templates/react-swc-ts/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "React + SWC + Vite (Typescript)",
"shortname": "react-swc-ts",
"author": "Lea Anthony",
"description": "React + SWC + Vite development server",
"description": "React + TS + SWC + Vite development server",
"helpurl": "https://wails.io",
"version": 3
}
2 changes: 1 addition & 1 deletion v3/internal/templates/solid-ts/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Solid + Vite (Typescript)",
"shortname": "solid-ts",
"author": "Lea Anthony",
"description": "Solid (Typescript) + Vite development server",
"description": "Solid + TS + Vite development server",
"helpurl": "https://wails.io",
"version": 3
}
21 changes: 21 additions & 0 deletions v3/internal/templates/sveltekit-ts/frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
node_modules

# Output
.output
.vercel
/.svelte-kit
/build

# OS
.DS_Store
Thumbs.db

# Env
.env
.env.*
!.env.example
!.env.test

# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
1 change: 1 addition & 0 deletions v3/internal/templates/sveltekit-ts/frontend/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
38 changes: 38 additions & 0 deletions v3/internal/templates/sveltekit-ts/frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# create-svelte

Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).

## Creating a project

If you're seeing this, you've probably already done this step. Congrats!

```bash
# create a new project in the current directory
npm create svelte@latest

# create a new project in my-app
npm create svelte@latest my-app
```

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```bash
npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open
```

## Building

To create a production version of your app:

```bash
npm run build
```

You can preview the production build with `npm run preview`.

> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
Loading