mirror of
https://github.com/wavetermdev/wails.git
synced 2026-04-22 15:26:15 -07:00
Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a632ac5068 | |||
| e3af0945d0 | |||
| 975c55a3d5 | |||
| c3d57d05c3 | |||
| e9cc68fe3a | |||
| 5d9fe49cf9 | |||
| fd3d1801ed | |||
| f517c8b980 | |||
| 73b547a730 | |||
| 6a8322cdb5 | |||
| 07fc8e3707 | |||
| 4cbc7f3eec | |||
| a1f067377f | |||
| 3c5d850a30 | |||
| 92c9f546eb | |||
| 7d14a75ff3 | |||
| 5547792b68 | |||
| b2839ed719 | |||
| 674042df36 | |||
| b9de31e38e | |||
| 929dfb4123 | |||
| 11fdc6a558 | |||
| 801cf3c84a | |||
| 4efc8e358d | |||
| 9ce0ddb4f8 | |||
| d88a741ce7 | |||
| c76ced7daa | |||
| fc46455526 | |||
| 70b7aa1ec2 | |||
| 03545e33d9 | |||
| e32c2b05e4 | |||
| 57c04ba740 | |||
| 426a569c89 | |||
| 08e12de2a0 | |||
| 0a63215cde | |||
| ae688aa07d | |||
| e960798e85 |
@@ -2,7 +2,7 @@ name: Build + Test v2
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [release/*, master]
|
||||
branches: [release/*, master, bugfix/*]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
@@ -12,31 +12,32 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
go-version: [1.18, 1.19]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-11]
|
||||
go-version: ['1.20']
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- 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@v3
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache-dependency-path: ./v2/go.sum
|
||||
|
||||
- name: Run tests (mac)
|
||||
if: matrix.os == 'macos-latest'
|
||||
if: matrix.os == 'macos-latest' || matrix.os == 'macos-11'
|
||||
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'
|
||||
if: matrix.os != 'macos-latest' && matrix.os != 'macos-11'
|
||||
working-directory: ./v2
|
||||
run: go test -v ./...
|
||||
|
||||
@@ -50,7 +51,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
@@ -89,15 +90,16 @@ jobs:
|
||||
vanilla-ts,
|
||||
plain,
|
||||
]
|
||||
go-version: [1.18, 1.19]
|
||||
go-version: ['1.20']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache-dependency-path: ./v2/go.sum
|
||||
|
||||
- name: Build Wails CLI
|
||||
run: |
|
||||
|
||||
+23
-23
@@ -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.18, 1.19]
|
||||
go-version: [1.19]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
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
@@ -120,7 +120,7 @@ Wails では Go のコードとウェブフロントエンドを単一のバイ
|
||||
|
||||
## スター数の推移
|
||||
|
||||
[](https://starchart.cc/wailsapp/wails)
|
||||
[](https://star-history.com/#wailsapp/wails&Date)
|
||||
|
||||
## コントリビューター
|
||||
|
||||
|
||||
@@ -122,7 +122,13 @@ This project is supported by these kind people / companies:
|
||||
|
||||
## Stargazers over time
|
||||
|
||||
[](https://star-history.com/#wailsapp/wails&Date)
|
||||
<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>
|
||||
|
||||
## Contributors
|
||||
|
||||
|
||||
Generated
+194
-121
File diff suppressed because it is too large
Load Diff
+10
-2
@@ -18,7 +18,6 @@ import (
|
||||
)
|
||||
|
||||
func buildApplication(f *flags.Build) error {
|
||||
|
||||
if f.NoColour {
|
||||
pterm.DisableColor()
|
||||
colour.ColourEnabled = false
|
||||
@@ -50,6 +49,16 @@ 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,
|
||||
@@ -255,5 +264,4 @@ func buildApplication(f *flags.Build) error {
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -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,5 +34,4 @@ func devApplication(f *flags.Dev) error {
|
||||
}
|
||||
|
||||
return dev.Application(f, logger)
|
||||
|
||||
}
|
||||
|
||||
@@ -104,6 +104,10 @@ 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})
|
||||
}
|
||||
@@ -128,8 +132,8 @@ func diagnoseEnvironment(f *flags.Doctor) error {
|
||||
// Output Dependencies Status
|
||||
var dependenciesMissing []string
|
||||
var externalPackages []*packagemanager.Dependency
|
||||
var dependenciesAvailableRequired = 0
|
||||
var dependenciesAvailableOptional = 0
|
||||
dependenciesAvailableRequired := 0
|
||||
dependenciesAvailableOptional := 0
|
||||
|
||||
dependenciesTableData := pterm.TableData{
|
||||
{"Dependency", "Package Name", "Status", "Version"},
|
||||
|
||||
@@ -47,7 +47,6 @@ func (*Dev) Default() *Dev {
|
||||
}
|
||||
|
||||
func (d *Dev) Process() error {
|
||||
|
||||
var err error
|
||||
err = d.loadAndMergeProjectConfig()
|
||||
if err != nil {
|
||||
@@ -113,7 +112,6 @@ func (d *Dev) loadAndMergeProjectConfig() error {
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
// GenerateBuildOptions creates a build.Options using the flags
|
||||
|
||||
@@ -14,7 +14,6 @@ type Init struct {
|
||||
}
|
||||
|
||||
func (i *Init) Default() *Init {
|
||||
|
||||
result := &Init{
|
||||
TemplateName: "vanilla",
|
||||
}
|
||||
|
||||
+14
-10
@@ -2,6 +2,9 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/leaanthony/debme"
|
||||
"github.com/leaanthony/gosod"
|
||||
"github.com/pterm/pterm"
|
||||
@@ -14,12 +17,9 @@ 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,10 +43,15 @@ 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,
|
||||
Tags: buildTags,
|
||||
TsPrefix: projectConfig.Bindings.TsGeneration.Prefix,
|
||||
TsSuffix: projectConfig.Bindings.TsGeneration.Suffix,
|
||||
TsOutputType: projectConfig.Bindings.TsGeneration.OutputType,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -55,7 +60,6 @@ func generateModule(f *flags.GenerateModule) error {
|
||||
}
|
||||
|
||||
func generateTemplate(f *flags.GenerateTemplate) error {
|
||||
|
||||
if f.NoColour {
|
||||
pterm.DisableColor()
|
||||
colour.ColourEnabled = false
|
||||
@@ -77,7 +81,7 @@ func generateTemplate(f *flags.GenerateTemplate) error {
|
||||
}
|
||||
templateDir := filepath.Join(cwd, f.Name)
|
||||
if !fs.DirExists(templateDir) {
|
||||
err := os.MkdirAll(templateDir, 0755)
|
||||
err := os.MkdirAll(templateDir, 0o755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -200,7 +204,7 @@ func processPackageJSON(frontendDir string) error {
|
||||
json, _ = sjson.SetBytes(json, "name", "{{.ProjectName}}")
|
||||
json, _ = sjson.SetBytes(json, "author", "{{.AuthorName}}")
|
||||
|
||||
err = os.WriteFile(packageJSON, json, 0644)
|
||||
err = os.WriteFile(packageJSON, json, 0o644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -231,7 +235,7 @@ func processPackageLockJSON(frontendDir string) error {
|
||||
printBulletPoint("Updating package-lock.json data...")
|
||||
json, _ = sjson.Set(json, "name", "{{.ProjectName}}")
|
||||
|
||||
err = os.WriteFile(filename, []byte(json), 0644)
|
||||
err = os.WriteFile(filename, []byte(json), 0o644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -3,6 +3,12 @@ package main
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/flytam/filenamify"
|
||||
"github.com/leaanthony/slicer"
|
||||
"github.com/pkg/errors"
|
||||
@@ -13,15 +19,9 @@ 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")), 0644)
|
||||
err = os.WriteFile(filepath.Join(options.TargetDir, ".gitignore"), []byte(strings.Join(ignore, "\n")), 0o644)
|
||||
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")), 0644)
|
||||
err = os.WriteFile("go.mod", []byte(strings.Join(lines, "\n")), 0o644)
|
||||
if err != nil {
|
||||
fatal(err.Error())
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ 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
|
||||
@@ -271,7 +270,6 @@ 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 {
|
||||
@@ -298,7 +296,6 @@ 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())
|
||||
}
|
||||
@@ -345,7 +342,7 @@ func doWatcherLoop(cwd string, buildOptions *build.Options, debugBinaryProcess *
|
||||
logutils.LogGreen("Watching (sub)/directory: %s", cwd)
|
||||
|
||||
// Main Loop
|
||||
var extensionsThatTriggerARebuild = sliceToMap(strings.Split(f.Extensions, ","))
|
||||
extensionsThatTriggerARebuild := sliceToMap(strings.Split(f.Extensions, ","))
|
||||
var dirsThatTriggerAReload []string
|
||||
for _, dir := range strings.Split(f.ReloadDirs, ",") {
|
||||
if dir == "" {
|
||||
|
||||
@@ -18,7 +18,6 @@ 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)
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ func SyncGoMod(logger *clilogger.CLILogger, updateWailsVersion bool) error {
|
||||
}
|
||||
|
||||
if updated {
|
||||
return os.WriteFile(gomodFilename, gomodData, 0755)
|
||||
return os.WriteFile(gomodFilename, gomodData, 0o755)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -1 +1 @@
|
||||
v2.6.0
|
||||
v2.7.1
|
||||
@@ -66,7 +66,6 @@ func bool2Str(b bool) string {
|
||||
var app *clir.Cli
|
||||
|
||||
func main() {
|
||||
|
||||
var err error
|
||||
|
||||
app = clir.NewCli("Wails", "Go/HTML Appkit", internal.Version)
|
||||
|
||||
@@ -15,7 +15,6 @@ import (
|
||||
|
||||
// AddSubcommand adds the `init` command for the Wails application
|
||||
func update(f *flags.Update) error {
|
||||
|
||||
if f.NoColour {
|
||||
colour.ColourEnabled = false
|
||||
pterm.DisableColor()
|
||||
@@ -73,8 +72,7 @@ func update(f *flags.Update) error {
|
||||
}
|
||||
|
||||
func updateToVersion(targetVersion *github.SemanticVersion, force bool, currentVersion string) error {
|
||||
|
||||
var targetVersionString = "v" + targetVersion.String()
|
||||
targetVersionString := "v" + targetVersion.String()
|
||||
|
||||
if targetVersionString == currentVersion {
|
||||
pterm.Println("\nLooks like you're up to date!")
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
module changeme
|
||||
|
||||
go 1.18
|
||||
go 1.21
|
||||
|
||||
toolchain go1.21.0
|
||||
|
||||
require github.com/wailsapp/wails/v2 v2.1.0
|
||||
|
||||
@@ -24,7 +26,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.7 // indirect
|
||||
github.com/wailsapp/go-webview2 v1.0.10 // 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
Reference in New Issue
Block a user