mirror of
https://github.com/wavetermdev/wails.git
synced 2026-04-22 15:26:15 -07:00
Compare commits
62 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ce28215300 | |||
| 5b4129ba07 | |||
| be0f358b4a | |||
| 10cee781a7 | |||
| aebd50db0a | |||
| e9e22434f7 | |||
| 6748e2f983 | |||
| 4cfe7124b2 | |||
| 157619d942 | |||
| 5003c8d7a5 | |||
| 118fd95646 | |||
| 5ce650d08b | |||
| b92953aa96 | |||
| 8e4ce3a2bb | |||
| 0bb8147f5c | |||
| 76338d4e50 | |||
| ac5cd0dd90 | |||
| 16119187be | |||
| 84ef7e1e82 | |||
| 98bc3d5bb7 | |||
| 1918401240 | |||
| 7bb74d7ffe | |||
| ded9b1fa28 | |||
| 74c63799d1 | |||
| 16e80913bf | |||
| 1022d3cd61 | |||
| 2238d6b206 | |||
| 2dd2deadc1 | |||
| 11d54cc875 | |||
| f587457e7e | |||
| 3dee8a931a | |||
| d3b8a7e4af | |||
| db70a0de58 | |||
| 15759b38bf | |||
| 449764943f | |||
| 7254c575d6 | |||
| 7a59bdd09b | |||
| ba3e697a00 | |||
| b370e0e7f0 | |||
| 6805b5a3e9 | |||
| 01ea9496e7 | |||
| 2661eca2cc | |||
| 23593b3c4d | |||
| e323b04bb2 | |||
| 32af38875f | |||
| c4964d6f46 | |||
| 2a3cd47d0c | |||
| 662a406e85 | |||
| b2a79e656f | |||
| 07a3973f9a | |||
| 840d3f1e85 | |||
| 2de06a0684 | |||
| 08ed902b7a | |||
| 3c17905155 | |||
| 7bd1355663 | |||
| a17aeee712 | |||
| 428f839c84 | |||
| 7ab969195c | |||
| 1a6f308494 | |||
| 21b4f643dd | |||
| a07dbb2368 | |||
| c4f9a43ff6 |
@@ -1,7 +1,7 @@
|
||||
name: Bug Report
|
||||
description: Create a report to help us improve
|
||||
# title: ""
|
||||
labels: ["Bug"]
|
||||
labels: ["bug"]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: Documentation
|
||||
description: Report an issue related to documentation.
|
||||
# title: ""
|
||||
labels: ["Documentation"]
|
||||
labels: ["documentation"]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: Feature request
|
||||
description: Suggest an idea for this project
|
||||
# title: ""
|
||||
labels: ["Enhancement"]
|
||||
labels: ["enhancement"]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-v2:
|
||||
name: v2 Build
|
||||
if: github.repository == 'wailsapp/wails'
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: "master"
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ">=1.18.0"
|
||||
|
||||
- name: Build Wails CLI
|
||||
run: |
|
||||
cd ./v2/cmd/wails
|
||||
go install
|
||||
wails -help
|
||||
@@ -1,25 +0,0 @@
|
||||
name: Check Docs
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ 'feature/*' ]
|
||||
|
||||
jobs:
|
||||
docs:
|
||||
name: Website Updated
|
||||
if: github.repository == 'wailsapp/wails'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Verify Changed files
|
||||
uses: tj-actions/verify-changed-files@v11.1
|
||||
id: verify-changed-files
|
||||
with:
|
||||
files: |
|
||||
website/**/*.mdx
|
||||
website/**/*.md
|
||||
|
||||
- name: Run step only when files change.
|
||||
if: steps.verify-changed-files.outputs.files_changed != 'true'
|
||||
run: |
|
||||
echo "Feature branch does not contain any changes to the website."
|
||||
@@ -4,13 +4,14 @@ on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
update-sponsors:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'wailsapp/wails'
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set node
|
||||
uses: actions/setup-node@v2
|
||||
@@ -23,12 +24,10 @@ jobs:
|
||||
SPONSORKIT_GITHUB_TOKEN: ${{ secrets.SPONSORS_TOKEN }}
|
||||
SPONSORKIT_GITHUB_LOGIN: wailsapp
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v4
|
||||
- name: Commit
|
||||
uses: EndBug/add-and-commit@v4
|
||||
with:
|
||||
commit-message: "chore: update sponsors.svg"
|
||||
add-paths: "website/static/img/sponsors.svg"
|
||||
title: Update Sponsor Image
|
||||
body: Generated new image
|
||||
branch: update-sponsors
|
||||
delete-branch: true
|
||||
message: "chore: update sponsors.svg"
|
||||
add: "website/static/img/sponsors.svg"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -7,7 +7,6 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
name: is-sponsor-label
|
||||
if: github.repository == 'wailsapp/wails'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: JasonEtco/is-sponsor-label-action@v1
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
name: PR Checks
|
||||
on:
|
||||
pull_request:
|
||||
pull_request_review:
|
||||
types: [ submitted ]
|
||||
|
||||
jobs:
|
||||
check_branch_name:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'wailsapp/wails'
|
||||
name: Check branch name
|
||||
steps:
|
||||
- run: |
|
||||
if ! [[ "$(echo ${GITHUB_HEAD_REF} | cut -d "/" -f1)" =~ (feature|bugfix|release|chore) ]]; then
|
||||
echo "PRs are only accepted for branches starting with: feature/, bugfix/, chore/ or release/"
|
||||
exit 1
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
test:
|
||||
name: Run Go Tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
if: github.event.review.state == 'approved'
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
||||
go-version: [ 1.18, 1.19 ]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
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: Set up Go 1.18
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
|
||||
- name: Run tests
|
||||
run: go test -v ./...
|
||||
@@ -1,17 +0,0 @@
|
||||
name: Update Project
|
||||
|
||||
on:
|
||||
project_card:
|
||||
types: [ moved ]
|
||||
|
||||
jobs:
|
||||
projectcardautolabel_job:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'wailsapp/wails'
|
||||
steps:
|
||||
- name: Run ProjectCard AutoLabel
|
||||
id: runprojectcardautolabel
|
||||
uses: Matticusau/projectcard-autolabel@v1.0.0
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
autolabel-config: '[{"column": "TODO", "add_labels":["TODO"], "remove_labels":["In Progress", "Ready For Testing"]},{"column":"In progress", "add_labels":["In Progress"], "remove_labels":["TODO", "Ready For Testing"]},{"column":"In review", "add_labels":["Ready For Testing"], "remove_labels":["TODO", "In Progress"]}, {"column":"Done", "add_labels":["Done"], "remove_labels":["TODO", "In Progress", "Ready For Testing"]}]'
|
||||
@@ -1,38 +0,0 @@
|
||||
name: Push files to Crowdin
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
docs:
|
||||
name: Push files to Crowdin
|
||||
if: github.repository == 'wailsapp/wails'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Verify Changed files
|
||||
uses: tj-actions/verify-changed-files@v11.1
|
||||
id: verify-changed-files
|
||||
with:
|
||||
files: |
|
||||
website/**/*.mdx
|
||||
website/**/*.md
|
||||
website/**/*.json
|
||||
|
||||
- name: Set node
|
||||
if: steps.verify-changed-files.outputs.files_changed != 'true'
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.x
|
||||
|
||||
- name: Push files
|
||||
env:
|
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
||||
run: |
|
||||
cd website
|
||||
corepack enable
|
||||
pnpm install
|
||||
pnpm run crowdin push -b master
|
||||
@@ -1,14 +1,15 @@
|
||||
name: Build + Test
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ release/*, master ]
|
||||
branches: [ release/* ]
|
||||
pull_request:
|
||||
branches: [ release/* ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Run Go Tests
|
||||
if: github.repository == 'wailsapp/wails'
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -17,7 +18,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install linux dependencies
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
@@ -34,6 +35,7 @@ jobs:
|
||||
test_templates:
|
||||
name: Test Templates
|
||||
needs: test
|
||||
if: github.repository == 'wailsapp/wails'
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: true
|
||||
@@ -43,7 +45,7 @@ jobs:
|
||||
go-version: [ 1.18, 1.19 ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v3
|
||||
@@ -10,7 +10,7 @@ jobs:
|
||||
name: Rebuild the runtime
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14.17.6
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
name: Test JS
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ release/*, master ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Run JS Tests
|
||||
if: github.repository == 'wailsapp/wails'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
working-directory: v2/internal/frontend/runtime
|
||||
|
||||
- name: Run tests
|
||||
run: npm test
|
||||
working-directory: v2/internal/frontend/runtime
|
||||
@@ -115,7 +115,7 @@ This project is supported by these kind people / companies:
|
||||
|
||||
## Stargazers over time
|
||||
|
||||
[](https://star-history.com/#wailsapp/wails&Date)
|
||||
[](https://starchart.cc/wailsapp/wails)
|
||||
|
||||
## Contributors
|
||||
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@
|
||||
|
||||
## 星星增长趋势
|
||||
|
||||
[](https://star-history.com/#wailsapp/wails&Date)
|
||||
[](https://starchart.cc/wailsapp/wails)
|
||||
|
||||
## 贡献者
|
||||
|
||||
|
||||
@@ -77,9 +77,9 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
||||
outputFilename := ""
|
||||
command.StringFlag("o", "Output filename", &outputFilename)
|
||||
|
||||
// Clean bin directory
|
||||
cleanBinDirectory := false
|
||||
command.BoolFlag("clean", "Clean the bin directory before building", &cleanBinDirectory)
|
||||
// Clean build directory
|
||||
cleanBuildDirectory := false
|
||||
command.BoolFlag("clean", "Clean the build directory before building", &cleanBuildDirectory)
|
||||
|
||||
webview2 := "download"
|
||||
command.StringFlag("webview2", "WebView2 installer strategy: download,embed,browser,error.", &webview2)
|
||||
@@ -190,29 +190,28 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
||||
|
||||
// Create BuildOptions
|
||||
buildOptions := &build.Options{
|
||||
Logger: logger,
|
||||
OutputType: outputType,
|
||||
OutputFile: outputFilename,
|
||||
CleanBinDirectory: cleanBinDirectory,
|
||||
Mode: mode,
|
||||
Pack: !noPackage,
|
||||
LDFlags: ldflags,
|
||||
Compiler: compilerCommand,
|
||||
SkipModTidy: skipModTidy,
|
||||
Verbosity: verbosity,
|
||||
ForceBuild: forceBuild,
|
||||
IgnoreFrontend: skipFrontend,
|
||||
Compress: compress,
|
||||
CompressFlags: compressFlags,
|
||||
UserTags: userTags,
|
||||
WebView2Strategy: wv2rtstrategy,
|
||||
TrimPath: trimpath,
|
||||
RaceDetector: raceDetector,
|
||||
WindowsConsole: windowsConsole,
|
||||
Obfuscated: obfuscated,
|
||||
GarbleArgs: garbleargs,
|
||||
SkipBindings: skipBindings,
|
||||
ProjectData: projectOptions,
|
||||
Logger: logger,
|
||||
OutputType: outputType,
|
||||
OutputFile: outputFilename,
|
||||
CleanBuildDirectory: cleanBuildDirectory,
|
||||
Mode: mode,
|
||||
Pack: !noPackage,
|
||||
LDFlags: ldflags,
|
||||
Compiler: compilerCommand,
|
||||
SkipModTidy: skipModTidy,
|
||||
Verbosity: verbosity,
|
||||
ForceBuild: forceBuild,
|
||||
IgnoreFrontend: skipFrontend,
|
||||
Compress: compress,
|
||||
CompressFlags: compressFlags,
|
||||
UserTags: userTags,
|
||||
WebView2Strategy: wv2rtstrategy,
|
||||
TrimPath: trimpath,
|
||||
RaceDetector: raceDetector,
|
||||
WindowsConsole: windowsConsole,
|
||||
Obfuscated: obfuscated,
|
||||
GarbleArgs: garbleargs,
|
||||
SkipBindings: skipBindings,
|
||||
}
|
||||
|
||||
// Start a new tabwriter
|
||||
@@ -226,7 +225,6 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
||||
_, _ = fmt.Fprintf(w, "Compiler: \t%s\n", compilerPath)
|
||||
_, _ = fmt.Fprintf(w, "Skip Bindings: \t%t\n", skipBindings)
|
||||
_, _ = fmt.Fprintf(w, "Build Mode: \t%s\n", modeString)
|
||||
_, _ = fmt.Fprintf(w, "Frontend Directory: \t%s\n", projectOptions.GetFrontendDir())
|
||||
_, _ = fmt.Fprintf(w, "Obfuscated: \t%t\n", buildOptions.Obfuscated)
|
||||
if buildOptions.Obfuscated {
|
||||
_, _ = fmt.Fprintf(w, "Garble Args: \t%s\n", buildOptions.GarbleArgs)
|
||||
@@ -234,7 +232,7 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
||||
_, _ = fmt.Fprintf(w, "Skip Frontend: \t%t\n", skipFrontend)
|
||||
_, _ = fmt.Fprintf(w, "Compress: \t%t\n", buildOptions.Compress)
|
||||
_, _ = fmt.Fprintf(w, "Package: \t%t\n", buildOptions.Pack)
|
||||
_, _ = fmt.Fprintf(w, "Clean Bin Dir: \t%t\n", buildOptions.CleanBinDirectory)
|
||||
_, _ = fmt.Fprintf(w, "Clean Build Dir: \t%t\n", buildOptions.CleanBuildDirectory)
|
||||
_, _ = fmt.Fprintf(w, "LDFlags: \t\"%s\"\n", buildOptions.LDFlags)
|
||||
_, _ = fmt.Fprintf(w, "Tags: \t[%s]\n", strings.Join(buildOptions.UserTags, ","))
|
||||
_, _ = fmt.Fprintf(w, "Race Detector: \t%t\n", buildOptions.RaceDetector)
|
||||
@@ -360,7 +358,7 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
||||
}
|
||||
|
||||
buildOptions.IgnoreFrontend = true
|
||||
buildOptions.CleanBinDirectory = false
|
||||
buildOptions.CleanBuildDirectory = false
|
||||
|
||||
// Output stats
|
||||
buildOptions.Logger.Println(fmt.Sprintf("Built '%s' in %s.\n", compiledBinary, time.Since(start).Round(time.Millisecond).String()))
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package build
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/wailsapp/wails/v2/cmd/wails/internal"
|
||||
"github.com/wailsapp/wails/v2/internal/fs"
|
||||
"github.com/wailsapp/wails/v2/internal/gomod"
|
||||
"github.com/wailsapp/wails/v2/internal/goversion"
|
||||
"github.com/wailsapp/wails/v2/pkg/clilogger"
|
||||
"os"
|
||||
)
|
||||
|
||||
func SyncGoMod(logger *clilogger.CLILogger, updateWailsVersion bool) error {
|
||||
@@ -15,10 +15,7 @@ func SyncGoMod(logger *clilogger.CLILogger, updateWailsVersion bool) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
gomodFilename := fs.FindFileInParents(cwd, "go.mod")
|
||||
if gomodFilename == "" {
|
||||
return fmt.Errorf("no go.mod file found")
|
||||
}
|
||||
gomodFilename := filepath.Join(cwd, "go.mod")
|
||||
gomodData, err := os.ReadFile(gomodFilename)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -93,7 +93,6 @@ type devFlags struct {
|
||||
|
||||
frontendDevServerURL string
|
||||
skipFrontend bool
|
||||
noColour bool
|
||||
}
|
||||
|
||||
// AddSubcommand adds the `dev` command for the Wails application
|
||||
@@ -109,7 +108,6 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||
command.StringFlag("reloaddirs", "Additional directories to trigger reloads (comma separated)", &flags.reloadDirs)
|
||||
command.BoolFlag("browser", "Open application in browser", &flags.openBrowser)
|
||||
command.BoolFlag("noreload", "Disable reload on asset change", &flags.noReload)
|
||||
command.BoolFlag("nocolour", "Turn off colour cli output", &flags.noColour)
|
||||
command.BoolFlag("skipbindings", "Skip bindings generation", &flags.skipBindings)
|
||||
command.StringFlag("wailsjsdir", "Directory to generate the Wails JS modules", &flags.wailsjsdir)
|
||||
command.StringFlag("tags", "Build tags to pass to Go compiler. Must be quoted. Space or comma (but not both) separated", &flags.tags)
|
||||
@@ -125,10 +123,6 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||
command.BoolFlag("s", "Skips building the frontend", &flags.skipFrontend)
|
||||
|
||||
command.Action(func() error {
|
||||
if flags.noColour {
|
||||
colour.ColourEnabled = false
|
||||
}
|
||||
|
||||
// Create logger
|
||||
logger := clilogger.New(w)
|
||||
app.PrintBanner()
|
||||
@@ -166,8 +160,6 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||
}
|
||||
|
||||
buildOptions := generateBuildOptions(flags)
|
||||
buildOptions.ProjectData = projectConfig
|
||||
buildOptions.SkipBindings = flags.skipBindings
|
||||
buildOptions.Logger = logger
|
||||
|
||||
userTags, err := buildtags.Parse(flags.tags)
|
||||
@@ -177,12 +169,7 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||
|
||||
buildOptions.UserTags = userTags
|
||||
|
||||
err = build.CreateEmbedDirectories(cwd, buildOptions)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !buildOptions.SkipBindings {
|
||||
if !flags.skipBindings {
|
||||
if flags.verbosity == build.VERBOSE {
|
||||
LogGreen("Generating Bindings...")
|
||||
}
|
||||
@@ -205,6 +192,7 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||
// Build the frontend if requested, but ignore building the application itself.
|
||||
ignoreFrontend := buildOptions.IgnoreFrontend
|
||||
if !ignoreFrontend {
|
||||
logger.Println("Building frontend for development...")
|
||||
buildOptions.IgnoreApplication = true
|
||||
if _, err := build.Build(buildOptions); err != nil {
|
||||
return err
|
||||
@@ -215,7 +203,7 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||
// frontend:dev:watcher command.
|
||||
frontendDevAutoDiscovery := projectConfig.IsFrontendDevServerURLAutoDiscovery()
|
||||
if command := projectConfig.DevWatcherCommand; command != "" {
|
||||
closer, devServerURL, err := runFrontendDevWatcherCommand(projectConfig.GetFrontendDir(), command, frontendDevAutoDiscovery)
|
||||
closer, devServerURL, err := runFrontendDevWatcherCommand(cwd, command, frontendDevAutoDiscovery)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -359,8 +347,8 @@ func generateBuildOptions(flags devFlags) *build.Options {
|
||||
|
||||
// loadAndMergeProjectConfig reconciles flags passed to the CLI with project config settings and updates
|
||||
// the project config if necessary
|
||||
func loadAndMergeProjectConfig(projectFileDirectory string, flags *devFlags) (*project.Project, error) {
|
||||
projectConfig, err := project.Load(projectFileDirectory)
|
||||
func loadAndMergeProjectConfig(cwd string, flags *devFlags) (*project.Project, error) {
|
||||
projectConfig, err := project.Load(cwd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -397,11 +385,11 @@ func loadAndMergeProjectConfig(projectFileDirectory string, flags *devFlags) (*p
|
||||
}
|
||||
|
||||
if flags.wailsjsdir == "" && projectConfig.WailsJSDir != "" {
|
||||
flags.wailsjsdir = projectConfig.GetWailsJSDir()
|
||||
flags.wailsjsdir = projectConfig.WailsJSDir
|
||||
}
|
||||
|
||||
if flags.wailsjsdir == "" {
|
||||
flags.wailsjsdir = projectConfig.GetFrontendDir()
|
||||
flags.wailsjsdir = "./frontend"
|
||||
}
|
||||
|
||||
if flags.wailsjsdir != projectConfig.WailsJSDir {
|
||||
@@ -434,14 +422,15 @@ func loadAndMergeProjectConfig(projectFileDirectory string, flags *devFlags) (*p
|
||||
}
|
||||
|
||||
// runFrontendDevWatcherCommand will run the `frontend:dev:watcher` command if it was given, ex- `npm run dev`
|
||||
func runFrontendDevWatcherCommand(frontendDirectory string, devCommand string, discoverViteServerURL bool) (func(), string, error) {
|
||||
func runFrontendDevWatcherCommand(cwd string, devCommand string, discoverViteServerURL bool) (func(), string, error) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
scanner := NewStdoutScanner()
|
||||
dir := filepath.Join(cwd, "frontend")
|
||||
cmdSlice := strings.Split(devCommand, " ")
|
||||
cmd := exec.CommandContext(ctx, cmdSlice[0], cmdSlice[1:]...)
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Stdout = scanner
|
||||
cmd.Dir = frontendDirectory
|
||||
cmd.Dir = dir
|
||||
setParentGID(cmd)
|
||||
|
||||
if err := cmd.Start(); err != nil {
|
||||
@@ -584,19 +573,7 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
|
||||
case err := <-watcher.Errors:
|
||||
LogDarkYellow(err.Error())
|
||||
case item := <-watcher.Events:
|
||||
isEligibleFile := func(fileName string) bool {
|
||||
// Iterate all file patterns
|
||||
ext := filepath.Ext(fileName)
|
||||
if ext != "" {
|
||||
ext = ext[1:]
|
||||
if _, exists := extensionsThatTriggerARebuild[ext]; exists {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Handle write operations
|
||||
// Check for file writes
|
||||
if item.Op&fsnotify.Write == fsnotify.Write {
|
||||
// Ignore directories
|
||||
itemName := item.Name
|
||||
@@ -604,10 +581,15 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
|
||||
continue
|
||||
}
|
||||
|
||||
if isEligibleFile(itemName) {
|
||||
rebuild = true
|
||||
timer.Reset(interval)
|
||||
continue
|
||||
// Iterate all file patterns
|
||||
ext := filepath.Ext(itemName)
|
||||
if ext != "" {
|
||||
ext = ext[1:]
|
||||
if _, exists := extensionsThatTriggerARebuild[ext]; exists {
|
||||
rebuild = true
|
||||
timer.Reset(interval)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
for _, reloadDir := range dirsThatTriggerAReload {
|
||||
@@ -623,8 +605,7 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
|
||||
|
||||
timer.Reset(interval)
|
||||
}
|
||||
|
||||
// Handle new fs entries that are created
|
||||
// Check for new directories
|
||||
if item.Op&fsnotify.Create == fsnotify.Create {
|
||||
// If this is a folder, add it to our watch list
|
||||
if fs.DirExists(item.Name) {
|
||||
@@ -636,14 +617,6 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
|
||||
}
|
||||
LogGreen("Added new directory to watcher: %s", item.Name)
|
||||
}
|
||||
} else if isEligibleFile(item.Name) {
|
||||
// Handle creation of new file.
|
||||
// Note: On some platforms an update to a file is represented as
|
||||
// REMOVE -> CREATE instead of WRITE, so this is not only new files
|
||||
// but also updates to existing files
|
||||
rebuild = true
|
||||
timer.Reset(interval)
|
||||
continue
|
||||
}
|
||||
}
|
||||
case <-timer.C:
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/wailsapp/wails/v2"
|
||||
"github.com/wailsapp/wails/v2/pkg/logger"
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/mac"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/windows"
|
||||
)
|
||||
@@ -37,9 +36,7 @@ func main() {
|
||||
StartHidden: false,
|
||||
HideWindowOnClose: false,
|
||||
BackgroundColour: &options.RGBA{R: 255, G: 255, B: 255, A: 255},
|
||||
AssetServer: &assetserver.Options{
|
||||
Assets: assets,
|
||||
},
|
||||
Assets: assets,
|
||||
Menu: nil,
|
||||
Logger: nil,
|
||||
LogLevel: logger.DEBUG,
|
||||
@@ -58,7 +55,6 @@ func main() {
|
||||
DisableWindowIcon: false,
|
||||
// DisableFramelessWindowDecorations: false,
|
||||
WebviewUserDataPath: "",
|
||||
ZoomFactor: 1.0,
|
||||
},
|
||||
// Mac platform specific options
|
||||
Mac: &mac.Options{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{
|
||||
"$schema": "https://wails.io/schemas/config.v2.json",
|
||||
"name": "{{.ProjectName}}",
|
||||
"outputfilename": "{{.BinaryName}}",
|
||||
"frontend:install": "npm install",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user