Compare commits

..

1 Commits

Author SHA1 Message Date
Lea Anthony 43727fbec7 Improve clipboard handling on macOS 2024-02-01 08:33:41 +11:00
733 changed files with 991 additions and 47135 deletions
+11 -13
View File
@@ -2,7 +2,7 @@ name: Build + Test v2
on:
push:
branches: [release/*, master, bugfix/*]
branches: [release/*, master]
workflow_dispatch:
jobs:
@@ -12,32 +12,31 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-11]
go-version: ['1.20']
os: [ubuntu-latest, windows-latest, macos-latest]
go-version: [1.18, 1.19]
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v3
- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: ./v2/go.sum
- name: Run tests (mac)
if: matrix.os == 'macos-latest' || matrix.os == 'macos-11'
if: matrix.os == 'macos-latest'
env:
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
working-directory: ./v2
run: go test -v ./...
- name: Run tests (!mac)
if: matrix.os != 'macos-latest' && matrix.os != 'macos-11'
if: matrix.os != 'macos-latest'
working-directory: ./v2
run: go test -v ./...
@@ -51,7 +50,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
@@ -90,16 +89,15 @@ jobs:
vanilla-ts,
plain,
]
go-version: ['1.20']
go-version: [1.18, 1.19]
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: ./v2/go.sum
- name: Build Wails CLI
run: |
+23 -23
View File
@@ -26,28 +26,28 @@ jobs:
run: |
echo "::warning::Feature branch does not contain any changes to the website."
# lint_go:
# name: Run Go Linters
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: Setup Go
# uses: actions/setup-go@v4
# with:
# go-version: "1.21"
#
# - name: Update go modules
# working-directory: ./v2
# run: go mod tidy
#
# - name: Run Linter
# uses: golangci/golangci-lint-action@v3
# with:
# version: v1.54
# working-directory: ./v2
# args: --timeout=10m0s --config ./.golangci.yml
lint_go:
name: Run Go Linters
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Update go modules
working-directory: ./v2
run: go mod tidy
- name: Run Linter
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
working-directory: ./v2
args: --timeout=10m0s --config ./.golangci.yml
test_go:
name: Run Go Tests
@@ -56,7 +56,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
go-version: [1.19]
go-version: [1.18, 1.19]
steps:
- name: Checkout code
-24
View File
@@ -1,24 +0,0 @@
on:
workflow_dispatch: {}
pull_request: {}
push:
branches:
- main
- master
paths:
- .github/workflows/semgrep.yml
schedule:
# random HH:MM to avoid a load spike on GitHub Actions at 00:00
- cron: 14 16 * * *
name: Semgrep
jobs:
semgrep:
name: semgrep/ci
runs-on: ubuntu-20.04
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
container:
image: returntocorp/semgrep
steps:
- uses: actions/checkout@v3
- run: semgrep ci
+1 -1
View File
@@ -120,7 +120,7 @@ Wails では Go のコードとウェブフロントエンドを単一のバイ
## スター数の推移
[![Star History Chart](https://api.star-history.com/svg?repos=wailsapp/wails&type=Date)](https://star-history.com/#wailsapp/wails&Date)
[![スター数の推移](https://starchart.cc/wailsapp/wails.svg)](https://starchart.cc/wailsapp/wails)
## コントリビューター
+1 -7
View File
@@ -122,13 +122,7 @@ This project is supported by these kind people / companies:
## Stargazers over time
<a href="https://star-history.com/#wailsapp/wails&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=wailsapp/wails&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=wailsapp/wails&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=wailsapp/wails&type=Date" />
</picture>
</a>
[![Star History Chart](https://api.star-history.com/svg?repos=wailsapp/wails&type=Date)](https://star-history.com/#wailsapp/wails&Date)
## Contributors
+121 -194
View File
File diff suppressed because it is too large Load Diff
+2 -10
View File
@@ -18,6 +18,7 @@ import (
)
func buildApplication(f *flags.Build) error {
if f.NoColour {
pterm.DisableColor()
colour.ColourEnabled = false
@@ -49,16 +50,6 @@ func buildApplication(f *flags.Build) error {
return err
}
// Set obfuscation from project file
if projectOptions.Obfuscated {
f.Obfuscated = projectOptions.Obfuscated
}
// Set garble args from project file
if projectOptions.GarbleArgs != "" {
f.GarbleArgs = projectOptions.GarbleArgs
}
// Create BuildOptions
buildOptions := &build.Options{
Logger: logger,
@@ -264,4 +255,5 @@ func buildApplication(f *flags.Build) error {
}
return nil
}
+3 -2
View File
@@ -1,16 +1,16 @@
package main
import (
"os"
"github.com/pterm/pterm"
"github.com/wailsapp/wails/v2/cmd/wails/flags"
"github.com/wailsapp/wails/v2/cmd/wails/internal/dev"
"github.com/wailsapp/wails/v2/internal/colour"
"github.com/wailsapp/wails/v2/pkg/clilogger"
"os"
)
func devApplication(f *flags.Dev) error {
if f.NoColour {
pterm.DisableColor()
colour.ColourEnabled = false
@@ -34,4 +34,5 @@ func devApplication(f *flags.Dev) error {
}
return dev.Application(f, logger)
}
+2 -6
View File
@@ -104,10 +104,6 @@ func diagnoseEnvironment(f *flags.Doctor) error {
if len(gpu.GraphicsCards) > 1 {
prefix = "GPU " + strconv.Itoa(idx+1) + " "
}
if card.DeviceInfo == nil {
systemTabledata = append(systemTabledata, []string{prefix, "Unknown"})
continue
}
details := fmt.Sprintf("%s (%s) - Driver: %s", card.DeviceInfo.Product.Name, card.DeviceInfo.Vendor.Name, card.DeviceInfo.Driver)
systemTabledata = append(systemTabledata, []string{prefix, details})
}
@@ -132,8 +128,8 @@ func diagnoseEnvironment(f *flags.Doctor) error {
// Output Dependencies Status
var dependenciesMissing []string
var externalPackages []*packagemanager.Dependency
dependenciesAvailableRequired := 0
dependenciesAvailableOptional := 0
var dependenciesAvailableRequired = 0
var dependenciesAvailableOptional = 0
dependenciesTableData := pterm.TableData{
{"Dependency", "Package Name", "Status", "Version"},
+2
View File
@@ -47,6 +47,7 @@ func (*Dev) Default() *Dev {
}
func (d *Dev) Process() error {
var err error
err = d.loadAndMergeProjectConfig()
if err != nil {
@@ -112,6 +113,7 @@ func (d *Dev) loadAndMergeProjectConfig() error {
}
return nil
}
// GenerateBuildOptions creates a build.Options using the flags
+1
View File
@@ -14,6 +14,7 @@ type Init struct {
}
func (i *Init) Default() *Init {
result := &Init{
TemplateName: "vanilla",
}
+10 -14
View File
@@ -2,9 +2,6 @@ package main
import (
"fmt"
"os"
"path/filepath"
"github.com/leaanthony/debme"
"github.com/leaanthony/gosod"
"github.com/pterm/pterm"
@@ -17,9 +14,12 @@ import (
"github.com/wailsapp/wails/v2/pkg/clilogger"
"github.com/wailsapp/wails/v2/pkg/commands/bindings"
"github.com/wailsapp/wails/v2/pkg/commands/buildtags"
"os"
"path/filepath"
)
func generateModule(f *flags.GenerateModule) error {
if f.NoColour {
pterm.DisableColor()
colour.ColourEnabled = false
@@ -43,15 +43,10 @@ func generateModule(f *flags.GenerateModule) error {
return err
}
if projectConfig.Bindings.TsGeneration.OutputType == "" {
projectConfig.Bindings.TsGeneration.OutputType = "classes"
}
_, err = bindings.GenerateBindings(bindings.Options{
Tags: buildTags,
TsPrefix: projectConfig.Bindings.TsGeneration.Prefix,
TsSuffix: projectConfig.Bindings.TsGeneration.Suffix,
TsOutputType: projectConfig.Bindings.TsGeneration.OutputType,
Tags: buildTags,
TsPrefix: projectConfig.Bindings.TsGeneration.Prefix,
TsSuffix: projectConfig.Bindings.TsGeneration.Suffix,
})
if err != nil {
return err
@@ -60,6 +55,7 @@ func generateModule(f *flags.GenerateModule) error {
}
func generateTemplate(f *flags.GenerateTemplate) error {
if f.NoColour {
pterm.DisableColor()
colour.ColourEnabled = false
@@ -81,7 +77,7 @@ func generateTemplate(f *flags.GenerateTemplate) error {
}
templateDir := filepath.Join(cwd, f.Name)
if !fs.DirExists(templateDir) {
err := os.MkdirAll(templateDir, 0o755)
err := os.MkdirAll(templateDir, 0755)
if err != nil {
return err
}
@@ -204,7 +200,7 @@ func processPackageJSON(frontendDir string) error {
json, _ = sjson.SetBytes(json, "name", "{{.ProjectName}}")
json, _ = sjson.SetBytes(json, "author", "{{.AuthorName}}")
err = os.WriteFile(packageJSON, json, 0o644)
err = os.WriteFile(packageJSON, json, 0644)
if err != nil {
return err
}
@@ -235,7 +231,7 @@ func processPackageLockJSON(frontendDir string) error {
printBulletPoint("Updating package-lock.json data...")
json, _ = sjson.Set(json, "name", "{{.ProjectName}}")
err = os.WriteFile(filename, []byte(json), 0o644)
err = os.WriteFile(filename, []byte(json), 0644)
if err != nil {
return err
}
+8 -8
View File
@@ -3,12 +3,6 @@ package main
import (
"bufio"
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"time"
"github.com/flytam/filenamify"
"github.com/leaanthony/slicer"
"github.com/pkg/errors"
@@ -19,9 +13,15 @@ import (
"github.com/wailsapp/wails/v2/pkg/clilogger"
"github.com/wailsapp/wails/v2/pkg/git"
"github.com/wailsapp/wails/v2/pkg/templates"
"os"
"os/exec"
"path/filepath"
"strings"
"time"
)
func initProject(f *flags.Init) error {
if f.NoColour {
pterm.DisableColor()
colour.ColourEnabled = false
@@ -215,7 +215,7 @@ func initGit(options *templates.Options) error {
"frontend/dist",
"frontend/node_modules",
}
err = os.WriteFile(filepath.Join(options.TargetDir, ".gitignore"), []byte(strings.Join(ignore, "\n")), 0o644)
err = os.WriteFile(filepath.Join(options.TargetDir, ".gitignore"), []byte(strings.Join(ignore, "\n")), 0644)
if err != nil {
return errors.Wrap(err, "Unable to create gitignore")
}
@@ -271,7 +271,7 @@ func updateReplaceLine(targetPath string) {
}
}
err = os.WriteFile("go.mod", []byte(strings.Join(lines, "\n")), 0o644)
err = os.WriteFile("go.mod", []byte(strings.Join(lines, "\n")), 0644)
if err != nil {
fatal(err.Error())
}
+4 -1
View File
@@ -52,6 +52,7 @@ func sliceToMap(input []string) map[string]struct{} {
// Application runs the application in dev mode
func Application(f *flags.Dev, logger *clilogger.CLILogger) error {
cwd := lo.Must(os.Getwd())
// Update go.mod to use current wails version
@@ -270,6 +271,7 @@ func runFrontendDevWatcherCommand(frontendDirectory string, devCommand string, d
// restartApp does the actual rebuilding of the application when files change
func restartApp(buildOptions *build.Options, debugBinaryProcess *process.Process, f *flags.Dev, exitCodeChannel chan int, legacyUseDevServerInsteadofCustomScheme bool) (*process.Process, string, error) {
appBinary, err := build.Build(buildOptions)
println()
if err != nil {
@@ -296,6 +298,7 @@ func restartApp(buildOptions *build.Options, debugBinaryProcess *process.Process
// parse appargs if any
args, err := shlex.Split(f.AppArgs)
if err != nil {
buildOptions.Logger.Fatal("Unable to parse appargs: %s", err.Error())
}
@@ -342,7 +345,7 @@ func doWatcherLoop(cwd string, buildOptions *build.Options, debugBinaryProcess *
logutils.LogGreen("Watching (sub)/directory: %s", cwd)
// Main Loop
extensionsThatTriggerARebuild := sliceToMap(strings.Split(f.Extensions, ","))
var extensionsThatTriggerARebuild = sliceToMap(strings.Split(f.Extensions, ","))
var dirsThatTriggerAReload []string
for _, dir := range strings.Split(f.ReloadDirs, ",") {
if dir == "" {
+1
View File
@@ -18,6 +18,7 @@ type Watcher interface {
// initialiseWatcher creates the project directory watcher that will trigger recompile
func initialiseWatcher(cwd string) (*fsnotify.Watcher, error) {
// Ignore dot files, node_modules and build directories by default
ignoreDirs := getIgnoreDirs(cwd)
+1 -1
View File
@@ -56,7 +56,7 @@ func SyncGoMod(logger *clilogger.CLILogger, updateWailsVersion bool) error {
}
if updated {
return os.WriteFile(gomodFilename, gomodData, 0o755)
return os.WriteFile(gomodFilename, gomodData, 0755)
}
return nil
+1 -1
View File
@@ -1 +1 @@
v2.7.1
v2.6.0
+1
View File
@@ -66,6 +66,7 @@ func bool2Str(b bool) string {
var app *clir.Cli
func main() {
var err error
app = clir.NewCli("Wails", "Go/HTML Appkit", internal.Version)
+3 -1
View File
@@ -15,6 +15,7 @@ import (
// AddSubcommand adds the `init` command for the Wails application
func update(f *flags.Update) error {
if f.NoColour {
colour.ColourEnabled = false
pterm.DisableColor()
@@ -72,7 +73,8 @@ func update(f *flags.Update) error {
}
func updateToVersion(targetVersion *github.SemanticVersion, force bool, currentVersion string) error {
targetVersionString := "v" + targetVersion.String()
var targetVersionString = "v" + targetVersion.String()
if targetVersionString == currentVersion {
pterm.Println("\nLooks like you're up to date!")
+2 -4
View File
@@ -1,8 +1,6 @@
module changeme
go 1.21
toolchain go1.21.0
go 1.18
require github.com/wailsapp/wails/v2 v2.1.0
@@ -26,7 +24,7 @@ require (
github.com/tkrajina/go-reflector v0.5.6 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/wailsapp/go-webview2 v1.0.10 // indirect
github.com/wailsapp/go-webview2 v1.0.7 // indirect
github.com/wailsapp/mimetype v1.4.1 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect

Some files were not shown because too many files have changed in this diff Show More