Skip to content

Commit

Permalink
Merge branch 'wailsapp:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxi2015 authored Apr 17, 2023
2 parents aa92613 + 46bcce7 commit c85c244
Show file tree
Hide file tree
Showing 95 changed files with 3,725 additions and 16,019 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/contributors.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/label-sponsors.yml

This file was deleted.

22 changes: 15 additions & 7 deletions .github/workflows/sync-translated-documents.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Sync Translated Documents
name: Sync Translations

on:
workflow_dispatch:
Expand All @@ -10,22 +10,30 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set node
- name: Setup Nodejs
uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 18.x

- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Sync Translated Documents
run: cd scripts && chmod 755 ./sync-translated-documents.sh && ./sync-translated-documents.sh
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
working-directory: ./website
run: task crowdin:pull

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: "docs: sync documents"
title: "docs: sync documents"
commit-message: "docs: sync translations"
title: "docs: sync translations"
body: "- [x] Sync translated documents"
branch: feature/documents
branch: chore/sync-translations
labels: translation
delete-branch: true
draft: true
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Push Checks
name: Upload Source Documents

on:
push:
branches: [master]
workflow_dispatch:

jobs:
push_files_to_crowdin:
Expand All @@ -13,25 +14,28 @@ jobs:
- uses: actions/checkout@v2

- name: Verify Changed files
uses: tj-actions/verify-changed-files@v11.1
id: verify-changed-files
id: changed-files
uses: tj-actions/changed-files@v35
with:
files: |
website/**/*.mdx
website/**/*.md
website/**/*.json
- name: Set node
- name: Setup Nodejs
uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 18.x

- name: Push files
if: steps.verify-changed-files.outputs.files_changed == 'true'
- name: Setup Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Upload source documents
if: steps.changed-files.outputs.any_changed == 'true'
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
run: |
cd website
corepack enable
pnpm install
pnpm run crowdin push -b master
working-directory: ./website
run: task crowdin:push
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ v2/cmd/wails/internal/commands/initialise/templates/testtemplates/
/v3/.task
/v3/examples/build/bin/testapp
/websitev3/site/
/v3/examples/plugins/bin/testapp
10 changes: 5 additions & 5 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# https://taskfile.dev

version: '3'
version: "3"

vars:
GREETING: Hello, World!

tasks:
check-contributors:
contributors:check:
cmds:
- npx -y all-contributors-cli check

update-contributors:
contributors:update:
cmds:
- go run v3/tasks/contribs/main.go

build-contributors:
contributors:build:
cmds:
- npx -y all-contributors-cli generate

release:
dir: v2/tools/release
cmds:
- go run release.go
- go run release.go
5 changes: 0 additions & 5 deletions scripts/sync-translated-documents.sh

This file was deleted.

8 changes: 5 additions & 3 deletions v2/cmd/wails/flags/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package flags

import (
"fmt"
"github.com/samber/lo"
"github.com/wailsapp/wails/v2/internal/project"
"github.com/wailsapp/wails/v2/pkg/commands/build"
"net"
"net/url"
"os"
"path/filepath"
"runtime"

"github.com/samber/lo"
"github.com/wailsapp/wails/v2/internal/project"
"github.com/wailsapp/wails/v2/pkg/commands/build"
)

type Dev struct {
Expand Down Expand Up @@ -126,6 +127,7 @@ func (d *Dev) GenerateBuildOptions() *build.Options {
Compiler: d.Compiler,
ForceBuild: d.ForceBuild,
IgnoreFrontend: d.SkipFrontend,
SkipBindings: d.SkipBindings,
Verbosity: d.Verbosity,
WailsJSDir: d.WailsJSDir,
RaceDetector: d.RaceDetector,
Expand Down
25 changes: 0 additions & 25 deletions v2/cmd/wails/internal/dev/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,6 @@ func sliceToMap(input []string) map[string]struct{} {
return result
}

type devFlags struct {
ldflags string
compilerCommand string
assetDir string
extensions string
reloadDirs string
openBrowser bool
noReload bool
skipBindings bool
wailsjsdir string
tags string
verbosity int
loglevel string
forceBuild bool
debounceMS int
devServer string
appargs string
saveConfig bool
raceDetector bool

frontendDevServerURL string
skipFrontend bool
noColour bool
}

// Application runs the application in dev mode
func Application(f *flags.Dev, logger *clilogger.CLILogger) error {

Expand Down
7 changes: 5 additions & 2 deletions v2/internal/frontend/desktop/darwin/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"html/template"
"log"
"net/url"
"strconv"
"unsafe"

"github.com/wailsapp/wails/v2/pkg/assetserver"
Expand Down Expand Up @@ -337,7 +336,11 @@ func (f *Frontend) processMessage(message string) {
}

func (f *Frontend) Callback(message string) {
f.ExecJS(`window.wails.Callback(` + strconv.Quote(message) + `);`)
escaped, err := json.Marshal(message)
if err != nil {
panic(err)
}
f.ExecJS(`window.wails.Callback(` + string(escaped) + `);`)
}

func (f *Frontend) ExecJS(js string) {
Expand Down
1 change: 0 additions & 1 deletion v2/internal/frontend/desktop/darwin/menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,5 @@ func (f *Frontend) MenuSetApplicationMenu(menu *menu.Menu) {
}

func (f *Frontend) MenuUpdateApplicationMenu() {
f.MenuSetApplicationMenu(f.frontendOptions.Menu)
f.mainWindow.UpdateApplicationMenu()
}
7 changes: 5 additions & 2 deletions v2/internal/frontend/desktop/linux/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ import (
"net/url"
"os"
"runtime"
"strconv"
"strings"
"text/template"
"unsafe"
Expand Down Expand Up @@ -434,7 +433,11 @@ func (f *Frontend) processMessage(message string) {
}

func (f *Frontend) Callback(message string) {
f.ExecJS(`window.wails.Callback(` + strconv.Quote(message) + `);`)
escaped, err := json.Marshal(message)
if err != nil {
panic(err)
}
f.ExecJS(`window.wails.Callback(` + string(escaped) + `);`)
}

func (f *Frontend) startDrag() {
Expand Down
7 changes: 5 additions & 2 deletions v2/internal/frontend/desktop/windows/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"net/http/httptest"
"net/url"
"runtime"
"strconv"
"strings"
"sync"
"text/template"
Expand Down Expand Up @@ -637,8 +636,12 @@ func (f *Frontend) processMessage(message string) {
}

func (f *Frontend) Callback(message string) {
escaped, err := json.Marshal(message)
if err != nil {
panic(err)
}
f.mainWindow.Invoke(func() {
f.chromium.Eval(`window.wails.Callback(` + strconv.Quote(message) + `);`)
f.chromium.Eval(`window.wails.Callback(` + string(escaped) + `);`)
})
}

Expand Down
10 changes: 8 additions & 2 deletions v2/internal/system/packagemanager/zypper.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ func (z *Zypper) Packages() packagemap {
{Name: "gtk3-devel", SystemPackage: true, Library: true},
},
"libwebkit": []*Package{
{Name: "webkit2gtk3-soup2-devel", SystemPackage: true, Library: true},
{Name: "webkit2gtk3-devel", SystemPackage: true, Library: true},
},
"gcc": []*Package{
{Name: "gcc-c++", SystemPackage: true},
},
"pkg-config": []*Package{
{Name: "pkg-config", SystemPackage: true},
{Name: "pkgconf-pkg-config", SystemPackage: true},
},
"npm": []*Package{
{Name: "npm10", SystemPackage: true},
Expand All @@ -60,7 +62,9 @@ func (z *Zypper) PackageInstalled(pkg *Package) (bool, error) {
if pkg.SystemPackage == false {
return false, nil
}
stdout, _, err := shell.RunCommand(".", "zypper", "info", pkg.Name)
var env []string
env = shell.SetEnv(env, "LANGUAGE", "en_US.utf-8")
stdout, _, err := shell.RunCommandWithEnv(env, ".", "zypper", "info", pkg.Name)
if err != nil {
_, ok := err.(*exec.ExitError)
if ok {
Expand All @@ -83,7 +87,9 @@ func (z *Zypper) PackageAvailable(pkg *Package) (bool, error) {
if pkg.SystemPackage == false {
return false, nil
}
stdout, _, err := shell.RunCommand(".", "zypper", "info", pkg.Name)
var env []string
env = shell.SetEnv(env, "LANGUAGE", "en_US.utf-8")
stdout, _, err := shell.RunCommandWithEnv(env, ".", "zypper", "info", pkg.Name)
// We add a space to ensure we get a full match, not partial match
if err != nil {
_, ok := err.(*exec.ExitError)
Expand Down
29 changes: 27 additions & 2 deletions v2/internal/system/system.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package system

import (
"os/exec"
"strings"

"github.com/wailsapp/wails/v2/internal/shell"
"github.com/wailsapp/wails/v2/internal/system/operatingsystem"
"github.com/wailsapp/wails/v2/internal/system/packagemanager"
"os/exec"
"strings"
)

var (
Expand All @@ -32,6 +33,30 @@ func GetInfo() (*Info, error) {
return &result, nil
}

func checkNodejs() *packagemanager.Dependency {

// Check for Nodejs
output, err := exec.Command("node", "-v").Output()
installed := true
version := ""
if err != nil {
installed = false
} else {
if len(output) > 0 {
version = strings.TrimSpace(strings.Split(string(output), "\n")[0])[1:]
}
}
return &packagemanager.Dependency{
Name: "Nodejs",
PackageName: "N/A",
Installed: installed,
InstallCommand: "Available at https://nodejs.org/en/download/",
Version: version,
Optional: false,
External: false,
}
}

func checkNPM() *packagemanager.Dependency {

// Check for npm
Expand Down
Loading

0 comments on commit c85c244

Please sign in to comment.