mirror of
https://github.com/taigrr/wails.git
synced 2026-04-09 00:21:35 -07:00
Compare commits
5 Commits
angular-fi
...
linux-db
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c93d01f80f | ||
|
|
eca750e895 | ||
|
|
6b78cdd838 | ||
|
|
2a3cb35dc1 | ||
|
|
af6b631b7b |
19
.github/stale.yml
vendored
19
.github/stale.yml
vendored
@@ -1,19 +0,0 @@
|
|||||||
# Number of days of inactivity before an issue becomes stale
|
|
||||||
daysUntilStale: 30
|
|
||||||
# Number of days of inactivity before a stale issue is closed
|
|
||||||
daysUntilClose: 7
|
|
||||||
# Issues with these labels will never be considered stale
|
|
||||||
exemptLabels:
|
|
||||||
- pinned
|
|
||||||
- security
|
|
||||||
- onhold
|
|
||||||
- inprogress
|
|
||||||
# Label to use when marking an issue as stale
|
|
||||||
staleLabel: wontfix
|
|
||||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
|
||||||
markComment: >
|
|
||||||
This issue has been automatically marked as stale because it has not had
|
|
||||||
recent activity. It will be closed if no further activity occurs. Thank you
|
|
||||||
for your contributions.
|
|
||||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
|
||||||
closeComment: false
|
|
||||||
@@ -6,7 +6,6 @@ Wails is what it is because of the time and effort given by these great people.
|
|||||||
* [Qais Patankar](https://github.com/qaisjp)
|
* [Qais Patankar](https://github.com/qaisjp)
|
||||||
* [Anthony Lee](https://github.com/alee792)
|
* [Anthony Lee](https://github.com/alee792)
|
||||||
* [Adrian Lanzafame](https://github.com/lanzafame)
|
* [Adrian Lanzafame](https://github.com/lanzafame)
|
||||||
* [Mattn](https://github.com/mattn)
|
|
||||||
* [0xflotus](https://github.com/0xflotus)
|
* [0xflotus](https://github.com/0xflotus)
|
||||||
* [Michael D Henderson](https://github.com/mdhender)
|
* [Michael D Henderson](https://github.com/mdhender)
|
||||||
* [fred2104](https://github.com/fishfishfish2104)
|
* [fred2104](https://github.com/fishfishfish2104)
|
||||||
@@ -17,7 +16,3 @@ Wails is what it is because of the time and effort given by these great people.
|
|||||||
* [fallendusk](https://github.com/fallendusk)
|
* [fallendusk](https://github.com/fallendusk)
|
||||||
* [Florian Didran](https://github.com/fdidron)
|
* [Florian Didran](https://github.com/fdidron)
|
||||||
* [Nikolai Zimmermann](https://github.com/Chronophylos)
|
* [Nikolai Zimmermann](https://github.com/Chronophylos)
|
||||||
* [Toyam Cox](https://github.com/Vaelatern)
|
|
||||||
* [Robin Eklind](https://github.com/mewmew)
|
|
||||||
* [Kris Raney](https://github.com/kraney)
|
|
||||||
* [Jack Mordaunt](https://github.com/JackMordaunt)
|
|
||||||
|
|||||||
29
README.md
29
README.md
@@ -8,10 +8,9 @@
|
|||||||
<a href="http://godoc.org/github.com/wailsapp/wails"><img src="https://img.shields.io/badge/godoc-reference-blue.svg"/></a>
|
<a href="http://godoc.org/github.com/wailsapp/wails"><img src="https://img.shields.io/badge/godoc-reference-blue.svg"/></a>
|
||||||
<a href="https://www.codefactor.io/repository/github/wailsapp/wails"><img src="https://www.codefactor.io/repository/github/wailsapp/wails/badge" alt="CodeFactor" /></a>
|
<a href="https://www.codefactor.io/repository/github/wailsapp/wails"><img src="https://www.codefactor.io/repository/github/wailsapp/wails/badge" alt="CodeFactor" /></a>
|
||||||
<a href="https://github.com/wailsapp/wails/issues"><img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat" alt="CodeFactor" /></a>
|
<a href="https://github.com/wailsapp/wails/issues"><img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat" alt="CodeFactor" /></a>
|
||||||
<a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fwailsapp%2Fwails?ref=badge_shield" alt="FOSSA Status"><img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fwailsapp%2Fwails.svg?type=shield"/></a>
|
|
||||||
<a href="https://houndci.com"><img src="https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg"/></a>
|
<a href="https://houndci.com"><img src="https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg"/></a>
|
||||||
<a href="https://github.com/avelino/awesome-go" rel="nofollow"><img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome"></a>
|
<a href="https://github.com/avelino/awesome-go" rel="nofollow"><img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome"></a>
|
||||||
<a href="https://dev.azure.com/leaanthony/Wails/_build/latest?definitionId=1&branchName=master" rel="nofollow"><img src="https://dev.azure.com/leaanthony/Wails/_apis/build/status/wailsapp.wails?branchName=master" alt="Pipelines"></a>
|
<a href="https://dashboard.guardrails.io/default/gh/wailsapp/wails"><img src="https://badges.guardrails.io/wailsapp/wails.svg?token=53657bc22ec360d7673c894fdd70568e918ec581d10d84427ed4de5fe1eeff1a"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
The traditional method of providing web interfaces to Go programs is via a built-in web server. Wails offers a different approach: it provides the ability to wrap both Go code and a web frontend into a single binary. Tools are provided to make this easy for you by handling project creation, compilation and bundling. All you have to do is get creative!
|
The traditional method of providing web interfaces to Go programs is via a built-in web server. Wails offers a different approach: it provides the ability to wrap both Go code and a web frontend into a single binary. Tools are provided to make this easy for you by handling project creation, compilation and bundling. All you have to do is get creative!
|
||||||
@@ -47,38 +46,22 @@ Make sure you have the xcode command line tools installed. This can be done by r
|
|||||||
|
|
||||||
### Linux
|
### Linux
|
||||||
|
|
||||||
#### Debian/Ubuntu
|
#### Debian 9, Ubuntu 18.04, Zorin 15, Parrot 4.7
|
||||||
|
|
||||||
`sudo apt install libgtk-3-dev libwebkit2gtk-4.0-dev`
|
`sudo apt install libgtk-3-dev libwebkit2gtk-4.0-dev`
|
||||||
|
|
||||||
_Debian: 8, 9, 10_
|
|
||||||
|
|
||||||
_Ubuntu: 16.04, 18.04, 19.04_
|
|
||||||
|
|
||||||
_Also succesfully tested on: Zorin 15, Parrot 4.7, Linuxmint 19, Elementary 5, Kali, Neon_
|
|
||||||
|
|
||||||
#### Arch Linux
|
#### Arch Linux
|
||||||
|
|
||||||
`sudo pacman -S webkit2gtk gtk3`
|
`sudo pacman -S webkit2gtk gtk3`
|
||||||
|
|
||||||
_Also succesfully test on: Manjaro & ArcoLinux_
|
#### Centos 7
|
||||||
|
|
||||||
#### Centos
|
|
||||||
|
|
||||||
`sudo yum install webkitgtk3-devel gtk3-devel`
|
`sudo yum install webkitgtk3-devel gtk3-devel`
|
||||||
|
|
||||||
_CentOS 6, 7_
|
#### Fedora 30
|
||||||
|
|
||||||
#### Fedora
|
|
||||||
|
|
||||||
`sudo yum install webkit2gtk3-devel gtk3-devel`
|
`sudo yum install webkit2gtk3-devel gtk3-devel`
|
||||||
|
|
||||||
_Fedora 29, 30_
|
|
||||||
|
|
||||||
#### VoidLinux & VoidLinux-musl
|
|
||||||
|
|
||||||
`xbps-install gtk+3-devel webkit2gtk-devel`
|
|
||||||
|
|
||||||
#### Gentoo
|
#### Gentoo
|
||||||
|
|
||||||
`sudo emerge gtk+:3 webkit-gtk`
|
`sudo emerge gtk+:3 webkit-gtk`
|
||||||
@@ -144,7 +127,3 @@ This project was mainly coded to the following albums:
|
|||||||
* [Bloc Party - Silent Alarm](https://open.spotify.com/album/6SsIdN05HQg2GwYLfXuzLB)
|
* [Bloc Party - Silent Alarm](https://open.spotify.com/album/6SsIdN05HQg2GwYLfXuzLB)
|
||||||
* [Maxthor - Another World](https://open.spotify.com/album/3tklE2Fgw1hCIUstIwPBJF)
|
* [Maxthor - Another World](https://open.spotify.com/album/3tklE2Fgw1hCIUstIwPBJF)
|
||||||
* [Alun Tan Lan - Y Distawrwydd](https://open.spotify.com/album/0c32OywcLpdJCWWMC6vB8v)
|
* [Alun Tan Lan - Y Distawrwydd](https://open.spotify.com/album/0c32OywcLpdJCWWMC6vB8v)
|
||||||
|
|
||||||
## Licensing
|
|
||||||
|
|
||||||
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fwailsapp%2Fwails?ref=badge_large)
|
|
||||||
|
|||||||
60
app.go
60
app.go
@@ -1,12 +1,6 @@
|
|||||||
package wails
|
package wails
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"runtime"
|
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/syossan27/tebata"
|
|
||||||
"github.com/wailsapp/wails/cmd"
|
"github.com/wailsapp/wails/cmd"
|
||||||
"github.com/wailsapp/wails/lib/binding"
|
"github.com/wailsapp/wails/lib/binding"
|
||||||
"github.com/wailsapp/wails/lib/event"
|
"github.com/wailsapp/wails/lib/event"
|
||||||
@@ -67,31 +61,11 @@ func CreateApp(optionalConfig ...*AppConfig) *App {
|
|||||||
result.config.DisableInspector = true
|
result.config.DisableInspector = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// If running windows, do a hidpi fix
|
|
||||||
if runtime.GOOS == "windows" {
|
|
||||||
err := SetProcessDPIAware()
|
|
||||||
if err != nil {
|
|
||||||
result.log.Fatalf(err.Error())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetProcessDPIAware via user32.dll
|
|
||||||
// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setprocessdpiaware
|
|
||||||
// Also, thanks Jack Mordaunt! https://github.com/wailsapp/wails/issues/293
|
|
||||||
func SetProcessDPIAware() error {
|
|
||||||
status, r, err := syscall.NewLazyDLL("user32.dll").NewProc("SetProcessDPIAware").Call()
|
|
||||||
if status == 0 {
|
|
||||||
return fmt.Errorf("exit status %d: %v %v", status, r, err)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run the app
|
// Run the app
|
||||||
func (a *App) Run() error {
|
func (a *App) Run() error {
|
||||||
|
|
||||||
if BuildMode != cmd.BuildModeProd {
|
if BuildMode != cmd.BuildModeProd {
|
||||||
return a.cli.Run()
|
return a.cli.Run()
|
||||||
}
|
}
|
||||||
@@ -123,13 +97,6 @@ func (a *App) start() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start signal handler
|
|
||||||
t := tebata.New(os.Interrupt, os.Kill, syscall.SIGTERM, syscall.SIGINT, syscall.SIGKILL)
|
|
||||||
t.Reserve(func() {
|
|
||||||
a.log.Debug("SIGNAL CAUGHT! Starting Shutdown")
|
|
||||||
a.renderer.Close()
|
|
||||||
})
|
|
||||||
|
|
||||||
// Start event manager and give it our renderer
|
// Start event manager and give it our renderer
|
||||||
a.eventManager.Start(a.renderer)
|
a.eventManager.Start(a.renderer)
|
||||||
|
|
||||||
@@ -145,33 +112,8 @@ func (a *App) start() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Defer the shutdown
|
|
||||||
defer a.shutdown()
|
|
||||||
|
|
||||||
// Run the renderer
|
// Run the renderer
|
||||||
err = a.renderer.Run()
|
return a.renderer.Run()
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// shutdown the app
|
|
||||||
func (a *App) shutdown() {
|
|
||||||
// Make sure this is only called once
|
|
||||||
a.log.Debug("Shutting down")
|
|
||||||
|
|
||||||
// Shutdown Binding Manager
|
|
||||||
a.bindingManager.Shutdown()
|
|
||||||
|
|
||||||
// Shutdown IPC Manager
|
|
||||||
a.ipc.Shutdown()
|
|
||||||
|
|
||||||
// Shutdown Event Manager
|
|
||||||
a.eventManager.Shutdown()
|
|
||||||
|
|
||||||
a.log.Debug("Cleanly Shutdown")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind allows the user to bind the given object
|
// Bind allows the user to bind the given object
|
||||||
|
|||||||
@@ -1,138 +0,0 @@
|
|||||||
# avoid double trigger by applying some rules
|
|
||||||
# start a pipeline when push to 'master' branch
|
|
||||||
trigger:
|
|
||||||
- master
|
|
||||||
# or when pull request on 'develop' branch
|
|
||||||
pr:
|
|
||||||
- develop
|
|
||||||
|
|
||||||
# for now there is only one stage 'Build'
|
|
||||||
# in the future we could use multistage strategy for releases
|
|
||||||
stages:
|
|
||||||
- stage: Build
|
|
||||||
|
|
||||||
# there are 3 jobs
|
|
||||||
# one for each os
|
|
||||||
jobs:
|
|
||||||
- deployment: Linux
|
|
||||||
displayName: Lin
|
|
||||||
variables:
|
|
||||||
GOPATH: '$(Agent.BuildDirectory)/gopath' # Go workspace path
|
|
||||||
GOROOT: '$(Agent.BuildDirectory)/go' # Go installation path
|
|
||||||
GOBIN: '$(GOPATH)/bin' # Go binaries path
|
|
||||||
GOMODULE: 'on'
|
|
||||||
modulePath: '$(Agent.BuildDirectory)/wails' # Path to the module's code
|
|
||||||
pool:
|
|
||||||
vmImage: 'Ubuntu-16.04'
|
|
||||||
environment: 'linux-dev'
|
|
||||||
strategy:
|
|
||||||
runOnce:
|
|
||||||
deploy:
|
|
||||||
steps:
|
|
||||||
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
|
|
||||||
clean: true # whether to fetch clean each time
|
|
||||||
path: wails # path to check out source code, relative to the agent's build directory (e.g. \_work\1)
|
|
||||||
# go version 1.12.7
|
|
||||||
- script: |
|
|
||||||
wget "https://storage.googleapis.com/golang/go1.12.7.linux-amd64.tar.gz" --output-document "$(Agent.BuildDirectory)/go1.12.7.tar.gz"
|
|
||||||
tar -C '$(Agent.BuildDirectory)' -xzf "$(Agent.BuildDirectory)/go1.12.7.tar.gz"
|
|
||||||
displayName: 'Install Go 1.12.7 Linux'
|
|
||||||
- script: |
|
|
||||||
mkdir -p '$(GOBIN)'
|
|
||||||
mkdir -p '$(GOPATH)/pkg'
|
|
||||||
mkdir -p '$(GOROOT)'
|
|
||||||
shopt -s extglob
|
|
||||||
shopt -s dotglob
|
|
||||||
echo '##vso[task.prependpath]$(GOBIN)'
|
|
||||||
echo '##vso[task.prependpath]$(GOROOT)/bin'
|
|
||||||
displayName: 'Set up the Go workspace'
|
|
||||||
- script: |
|
|
||||||
go version
|
|
||||||
go get -v -d ./...
|
|
||||||
cd cmd/wails
|
|
||||||
go install
|
|
||||||
workingDirectory: '$(modulePath)'
|
|
||||||
displayName: 'Get dependencies, then build'
|
|
||||||
- script: |
|
|
||||||
wails version
|
|
||||||
workingDirectory: '$(modulePath)'
|
|
||||||
displayName: 'Check we have output'
|
|
||||||
|
|
||||||
- deployment: Mac
|
|
||||||
displayName: Mac
|
|
||||||
variables:
|
|
||||||
GOPATH: '$(Agent.BuildDirectory)/gopath' # Go workspace path
|
|
||||||
GOROOT: '$(Agent.BuildDirectory)/go' # Go installation path
|
|
||||||
GOBIN: '$(GOPATH)/bin' # Go binaries path
|
|
||||||
GOMODULE: 'on'
|
|
||||||
modulePath: '$(Agent.BuildDirectory)/wails' # Path to the module's code
|
|
||||||
pool:
|
|
||||||
vmImage: 'macOS-10.14'
|
|
||||||
environment: 'mac-dev'
|
|
||||||
strategy:
|
|
||||||
runOnce:
|
|
||||||
deploy:
|
|
||||||
steps:
|
|
||||||
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
|
|
||||||
clean: true # whether to fetch clean each time
|
|
||||||
path: wails # path to check out source code, relative to the agent's build directory (e.g. \_work\1)
|
|
||||||
# go version 1.12.7
|
|
||||||
- script: |
|
|
||||||
wget "https://storage.googleapis.com/golang/go1.12.7.darwin-amd64.tar.gz" --output-document "$(Agent.BuildDirectory)/go1.12.7.tar.gz"
|
|
||||||
tar -C '$(Agent.BuildDirectory)' -xzf "$(Agent.BuildDirectory)/go1.12.7.tar.gz"
|
|
||||||
displayName: 'Install Go 1.12.7 Linux'
|
|
||||||
- script: |
|
|
||||||
mkdir -p '$(GOBIN)'
|
|
||||||
mkdir -p '$(GOPATH)/pkg'
|
|
||||||
mkdir -p '$(GOROOT)'
|
|
||||||
shopt -s extglob
|
|
||||||
shopt -s dotglob
|
|
||||||
echo '##vso[task.prependpath]$(GOBIN)'
|
|
||||||
echo '##vso[task.prependpath]$(GOROOT)/bin'
|
|
||||||
displayName: 'Set up the Go workspace'
|
|
||||||
- script: |
|
|
||||||
go version
|
|
||||||
go get -v -d ./...
|
|
||||||
cd cmd/wails
|
|
||||||
go install
|
|
||||||
workingDirectory: '$(modulePath)'
|
|
||||||
displayName: 'Get dependencies, then build'
|
|
||||||
- script: |
|
|
||||||
wails version
|
|
||||||
workingDirectory: '$(modulePath)'
|
|
||||||
displayName: 'Check we have output'
|
|
||||||
|
|
||||||
- deployment: Win
|
|
||||||
displayName: Win
|
|
||||||
variables:
|
|
||||||
GOMODULE: 'on'
|
|
||||||
modulePath: '$(Agent.BuildDirectory)/wails' # Path to the module's code
|
|
||||||
pool:
|
|
||||||
vmImage: 'windows-2019'
|
|
||||||
environment: 'win-dev'
|
|
||||||
strategy:
|
|
||||||
runOnce:
|
|
||||||
deploy:
|
|
||||||
steps:
|
|
||||||
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
|
|
||||||
clean: true # whether to fetch clean each time
|
|
||||||
path: wails # path to check out source code, relative to the agent's build directory (e.g. \_work\1)
|
|
||||||
# Go tool installer
|
|
||||||
# Find in cache or download a specific version of Go and add it to the PATH
|
|
||||||
- task: GoTool@0
|
|
||||||
inputs:
|
|
||||||
version: '1.12.7'
|
|
||||||
goPath: '$(Agent.BuildDirectory)/go'
|
|
||||||
goBin: '$(Agent.BuildDirectory)/go/bin'
|
|
||||||
displayName: 'Set up the Go workspace'
|
|
||||||
- script: |
|
|
||||||
go version
|
|
||||||
go get -v -d ./...
|
|
||||||
cd cmd/wails
|
|
||||||
go install
|
|
||||||
workingDirectory: '$(modulePath)'
|
|
||||||
displayName: 'Get dependencies, then build'
|
|
||||||
- script: |
|
|
||||||
wails version
|
|
||||||
workingDirectory: '$(Agent.BuildDirectory)/go/bin'
|
|
||||||
displayName: 'Check we have output'
|
|
||||||
@@ -1,138 +0,0 @@
|
|||||||
# avoid double trigger by applying some rules
|
|
||||||
# start a pipeline when push to 'master' branch
|
|
||||||
trigger:
|
|
||||||
- master
|
|
||||||
# or when pull request on 'develop' branch
|
|
||||||
pr:
|
|
||||||
- develop
|
|
||||||
|
|
||||||
# for now there is only one stage 'Build'
|
|
||||||
# in the future we could use multistage strategy for releases
|
|
||||||
stages:
|
|
||||||
- stage: Build
|
|
||||||
|
|
||||||
# there are 3 jobs
|
|
||||||
# one for each os
|
|
||||||
jobs:
|
|
||||||
- deployment: Linux
|
|
||||||
displayName: Lin
|
|
||||||
variables:
|
|
||||||
GOPATH: '$(Agent.BuildDirectory)/gopath' # Go workspace path
|
|
||||||
GOROOT: '$(Agent.BuildDirectory)/go' # Go installation path
|
|
||||||
GOBIN: '$(GOPATH)/bin' # Go binaries path
|
|
||||||
GOMODULE: 'on'
|
|
||||||
modulePath: '$(Agent.BuildDirectory)/wails' # Path to the module's code
|
|
||||||
pool:
|
|
||||||
vmImage: 'Ubuntu-16.04'
|
|
||||||
environment: 'linux-dev'
|
|
||||||
strategy:
|
|
||||||
runOnce:
|
|
||||||
deploy:
|
|
||||||
steps:
|
|
||||||
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
|
|
||||||
clean: true # whether to fetch clean each time
|
|
||||||
path: wails # path to check out source code, relative to the agent's build directory (e.g. \_work\1)
|
|
||||||
# go version 1.12.7
|
|
||||||
- script: |
|
|
||||||
wget "https://storage.googleapis.com/golang/go1.12.7.linux-amd64.tar.gz" --output-document "$(Agent.BuildDirectory)/go1.12.7.tar.gz"
|
|
||||||
tar -C '$(Agent.BuildDirectory)' -xzf "$(Agent.BuildDirectory)/go1.12.7.tar.gz"
|
|
||||||
displayName: 'Install Go 1.12.7 Linux'
|
|
||||||
- script: |
|
|
||||||
mkdir -p '$(GOBIN)'
|
|
||||||
mkdir -p '$(GOPATH)/pkg'
|
|
||||||
mkdir -p '$(GOROOT)'
|
|
||||||
shopt -s extglob
|
|
||||||
shopt -s dotglob
|
|
||||||
echo '##vso[task.prependpath]$(GOBIN)'
|
|
||||||
echo '##vso[task.prependpath]$(GOROOT)/bin'
|
|
||||||
displayName: 'Set up the Go workspace'
|
|
||||||
- script: |
|
|
||||||
go version
|
|
||||||
go get -v -d ./...
|
|
||||||
cd cmd/wails
|
|
||||||
go install
|
|
||||||
workingDirectory: '$(modulePath)'
|
|
||||||
displayName: 'Get dependencies, then build'
|
|
||||||
- script: |
|
|
||||||
wails version
|
|
||||||
workingDirectory: '$(modulePath)'
|
|
||||||
displayName: 'Check we have output'
|
|
||||||
|
|
||||||
- deployment: Mac
|
|
||||||
displayName: Mac
|
|
||||||
variables:
|
|
||||||
GOPATH: '$(Agent.BuildDirectory)/gopath' # Go workspace path
|
|
||||||
GOROOT: '$(Agent.BuildDirectory)/go' # Go installation path
|
|
||||||
GOBIN: '$(GOPATH)/bin' # Go binaries path
|
|
||||||
GOMODULE: 'on'
|
|
||||||
modulePath: '$(Agent.BuildDirectory)/wails' # Path to the module's code
|
|
||||||
pool:
|
|
||||||
vmImage: 'macOS-10.14'
|
|
||||||
environment: 'mac-dev'
|
|
||||||
strategy:
|
|
||||||
runOnce:
|
|
||||||
deploy:
|
|
||||||
steps:
|
|
||||||
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
|
|
||||||
clean: true # whether to fetch clean each time
|
|
||||||
path: wails # path to check out source code, relative to the agent's build directory (e.g. \_work\1)
|
|
||||||
# go version 1.12.7
|
|
||||||
- script: |
|
|
||||||
wget "https://storage.googleapis.com/golang/go1.12.7.darwin-amd64.tar.gz" --output-document "$(Agent.BuildDirectory)/go1.12.7.tar.gz"
|
|
||||||
tar -C '$(Agent.BuildDirectory)' -xzf "$(Agent.BuildDirectory)/go1.12.7.tar.gz"
|
|
||||||
displayName: 'Install Go 1.12.7 Linux'
|
|
||||||
- script: |
|
|
||||||
mkdir -p '$(GOBIN)'
|
|
||||||
mkdir -p '$(GOPATH)/pkg'
|
|
||||||
mkdir -p '$(GOROOT)'
|
|
||||||
shopt -s extglob
|
|
||||||
shopt -s dotglob
|
|
||||||
echo '##vso[task.prependpath]$(GOBIN)'
|
|
||||||
echo '##vso[task.prependpath]$(GOROOT)/bin'
|
|
||||||
displayName: 'Set up the Go workspace'
|
|
||||||
- script: |
|
|
||||||
go version
|
|
||||||
go get -v -d ./...
|
|
||||||
cd cmd/wails
|
|
||||||
go install
|
|
||||||
workingDirectory: '$(modulePath)'
|
|
||||||
displayName: 'Get dependencies, then build'
|
|
||||||
- script: |
|
|
||||||
wails version
|
|
||||||
workingDirectory: '$(modulePath)'
|
|
||||||
displayName: 'Check we have output'
|
|
||||||
|
|
||||||
- deployment: Win
|
|
||||||
displayName: Win
|
|
||||||
variables:
|
|
||||||
GOMODULE: 'on'
|
|
||||||
modulePath: '$(Agent.BuildDirectory)/wails' # Path to the module's code
|
|
||||||
pool:
|
|
||||||
vmImage: 'windows-2019'
|
|
||||||
environment: 'win-dev'
|
|
||||||
strategy:
|
|
||||||
runOnce:
|
|
||||||
deploy:
|
|
||||||
steps:
|
|
||||||
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
|
|
||||||
clean: true # whether to fetch clean each time
|
|
||||||
path: wails # path to check out source code, relative to the agent's build directory (e.g. \_work\1)
|
|
||||||
# Go tool installer
|
|
||||||
# Find in cache or download a specific version of Go and add it to the PATH
|
|
||||||
- task: GoTool@0
|
|
||||||
inputs:
|
|
||||||
version: '1.12.7'
|
|
||||||
goPath: '$(Agent.BuildDirectory)/go'
|
|
||||||
goBin: '$(Agent.BuildDirectory)/go/bin'
|
|
||||||
displayName: 'Set up the Go workspace'
|
|
||||||
- script: |
|
|
||||||
go version
|
|
||||||
go get -v -d ./...
|
|
||||||
cd cmd/wails
|
|
||||||
go install
|
|
||||||
workingDirectory: '$(modulePath)'
|
|
||||||
displayName: 'Get dependencies, then build'
|
|
||||||
- script: |
|
|
||||||
wails version
|
|
||||||
workingDirectory: '$(Agent.BuildDirectory)/go/bin'
|
|
||||||
displayName: 'Check we have output'
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -18,7 +18,7 @@ func NewGitHubHelper() *GitHubHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetVersionTags gets the list of tags on the Wails repo
|
// GetVersionTags gets the list of tags on the Wails repo
|
||||||
// It returns a list of sorted tags in descending order
|
// It retuns a list of sorted tags in descending order
|
||||||
func (g *GitHubHelper) GetVersionTags() ([]*SemanticVersion, error) {
|
func (g *GitHubHelper) GetVersionTags() ([]*SemanticVersion, error) {
|
||||||
|
|
||||||
result := []*SemanticVersion{}
|
result := []*SemanticVersion{}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/leaanthony/mewn"
|
"github.com/leaanthony/mewn"
|
||||||
@@ -88,17 +87,6 @@ func BuildApplication(binaryName string, forceRebuild bool, buildMode string, pa
|
|||||||
buildCommand.Add("build")
|
buildCommand.Add("build")
|
||||||
|
|
||||||
if binaryName != "" {
|
if binaryName != "" {
|
||||||
// Alter binary name based on OS
|
|
||||||
switch runtime.GOOS {
|
|
||||||
case "windows":
|
|
||||||
if !strings.HasSuffix(binaryName, ".exe") {
|
|
||||||
binaryName += ".exe"
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
if strings.HasSuffix(binaryName, ".exe") {
|
|
||||||
binaryName = strings.TrimSuffix(binaryName, ".exe")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
buildCommand.Add("-o")
|
buildCommand.Add("-o")
|
||||||
buildCommand.Add(binaryName)
|
buildCommand.Add(binaryName)
|
||||||
}
|
}
|
||||||
@@ -115,7 +103,7 @@ func BuildApplication(binaryName string, forceRebuild bool, buildMode string, pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add windows flags
|
// Add windows flags
|
||||||
if runtime.GOOS == "windows" && buildMode == BuildModeProd {
|
if runtime.GOOS == "windows" {
|
||||||
ldflags += "-H windowsgui "
|
ldflags += "-H windowsgui "
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,15 +219,6 @@ func InstallFrontendDeps(projectDir string, projectOptions *ProjectOptions, forc
|
|||||||
|
|
||||||
const md5sumFile = "package.json.md5"
|
const md5sumFile = "package.json.md5"
|
||||||
|
|
||||||
// If node_modules does not exist, force a rebuild.
|
|
||||||
nodeModulesPath, err := filepath.Abs(filepath.Join(".", "node_modules"))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if !fs.DirExists(nodeModulesPath) {
|
|
||||||
forceRebuild = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we aren't forcing the install and the md5sum file exists
|
// If we aren't forcing the install and the md5sum file exists
|
||||||
if !forceRebuild && fs.FileExists(md5sumFile) {
|
if !forceRebuild && fs.FileExists(md5sumFile) {
|
||||||
// Yes - read contents
|
// Yes - read contents
|
||||||
@@ -296,7 +275,7 @@ func InstallRuntime(caller string, projectDir string, projectOptions *ProjectOpt
|
|||||||
// InstallBridge installs the relevant bridge javascript library
|
// InstallBridge installs the relevant bridge javascript library
|
||||||
func InstallBridge(projectDir string, projectOptions *ProjectOptions) error {
|
func InstallBridge(projectDir string, projectOptions *ProjectOptions) error {
|
||||||
bridgeFileData := mewn.String("../runtime/assets/bridge.js")
|
bridgeFileData := mewn.String("../runtime/assets/bridge.js")
|
||||||
bridgeFileTarget := filepath.Join(projectDir, projectOptions.FrontEnd.Dir, "node_modules", "@wailsapp", "runtime", "init.js")
|
bridgeFileTarget := filepath.Join(projectDir, projectOptions.FrontEnd.Dir, "node_modules", "@wailsapp", "runtime", "main.js")
|
||||||
err := fs.CreateFile(bridgeFileTarget, []byte(bridgeFileData))
|
err := fs.CreateFile(bridgeFileTarget, []byte(bridgeFileData))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -304,7 +283,7 @@ func InstallBridge(projectDir string, projectOptions *ProjectOptions) error {
|
|||||||
// InstallProdRuntime installs the production runtime
|
// InstallProdRuntime installs the production runtime
|
||||||
func InstallProdRuntime(projectDir string, projectOptions *ProjectOptions) error {
|
func InstallProdRuntime(projectDir string, projectOptions *ProjectOptions) error {
|
||||||
prodInit := mewn.String("../runtime/js/runtime/init.js")
|
prodInit := mewn.String("../runtime/js/runtime/init.js")
|
||||||
bridgeFileTarget := filepath.Join(projectDir, projectOptions.FrontEnd.Dir, "node_modules", "@wailsapp", "runtime", "init.js")
|
bridgeFileTarget := filepath.Join(projectDir, projectOptions.FrontEnd.Dir, "node_modules", "@wailsapp", "runtime", "main.js")
|
||||||
err := fs.CreateFile(bridgeFileTarget, []byte(prodInit))
|
err := fs.CreateFile(bridgeFileTarget, []byte(prodInit))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
47
cmd/linux.go
47
cmd/linux.go
@@ -33,18 +33,6 @@ const (
|
|||||||
Zorin
|
Zorin
|
||||||
// Parrot distribution
|
// Parrot distribution
|
||||||
Parrot
|
Parrot
|
||||||
// Linuxmint distribution
|
|
||||||
Linuxmint
|
|
||||||
// VoidLinux distribution
|
|
||||||
VoidLinux
|
|
||||||
// Elementary distribution
|
|
||||||
Elementary
|
|
||||||
// Kali distribution
|
|
||||||
Kali
|
|
||||||
// Neon distribution
|
|
||||||
Neon
|
|
||||||
// Manjaro distribution
|
|
||||||
Manjaro
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// DistroInfo contains all the information relating to a linux distribution
|
// DistroInfo contains all the information relating to a linux distribution
|
||||||
@@ -101,6 +89,7 @@ func parseOsRelease(osRelease string) *DistroInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check distro name against list of distros
|
// Check distro name against list of distros
|
||||||
|
result.Release = version
|
||||||
switch osID {
|
switch osID {
|
||||||
case "fedora":
|
case "fedora":
|
||||||
result.Distribution = Fedora
|
result.Distribution = Fedora
|
||||||
@@ -118,32 +107,15 @@ func parseOsRelease(osRelease string) *DistroInfo {
|
|||||||
result.Distribution = Zorin
|
result.Distribution = Zorin
|
||||||
case "parrot":
|
case "parrot":
|
||||||
result.Distribution = Parrot
|
result.Distribution = Parrot
|
||||||
case "linuxmint":
|
|
||||||
result.Distribution = Linuxmint
|
|
||||||
case "void":
|
|
||||||
result.Distribution = VoidLinux
|
|
||||||
case "elementary":
|
|
||||||
result.Distribution = Elementary
|
|
||||||
case "kali":
|
|
||||||
result.Distribution = Kali
|
|
||||||
case "neon":
|
|
||||||
result.Distribution = Neon
|
|
||||||
case "manjaro":
|
|
||||||
result.Distribution = Manjaro
|
|
||||||
default:
|
default:
|
||||||
result.Distribution = Unknown
|
result.Distribution = Unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
result.Name = osNAME
|
|
||||||
result.ID = osID
|
result.ID = osID
|
||||||
result.Release = version
|
result.Name = osNAME
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckPkgInstalled is all functions that use local programs to see if a package is installed
|
|
||||||
type CheckPkgInstalled func(string) (bool, error)
|
|
||||||
|
|
||||||
// EqueryInstalled uses equery to see if a package is installed
|
// EqueryInstalled uses equery to see if a package is installed
|
||||||
func EqueryInstalled(packageName string) (bool, error) {
|
func EqueryInstalled(packageName string) (bool, error) {
|
||||||
program := NewProgramHelper()
|
program := NewProgramHelper()
|
||||||
@@ -177,17 +149,6 @@ func PacmanInstalled(packageName string) (bool, error) {
|
|||||||
return exitCode == 0, nil
|
return exitCode == 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// XbpsInstalled uses pacman to see if a package is installed.
|
|
||||||
func XbpsInstalled(packageName string) (bool, error) {
|
|
||||||
program := NewProgramHelper()
|
|
||||||
xbpsQuery := program.FindProgram("xbps-query")
|
|
||||||
if xbpsQuery == nil {
|
|
||||||
return false, fmt.Errorf("cannot check dependencies: xbps-query not found")
|
|
||||||
}
|
|
||||||
_, _, exitCode, _ := xbpsQuery.Run("-S", packageName)
|
|
||||||
return exitCode == 0, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// RpmInstalled uses rpm to see if a package is installed
|
// RpmInstalled uses rpm to see if a package is installed
|
||||||
func RpmInstalled(packageName string) (bool, error) {
|
func RpmInstalled(packageName string) (bool, error) {
|
||||||
program := NewProgramHelper()
|
program := NewProgramHelper()
|
||||||
@@ -201,9 +162,9 @@ func RpmInstalled(packageName string) (bool, error) {
|
|||||||
|
|
||||||
// RequestSupportForDistribution promts the user to submit a request to support their
|
// RequestSupportForDistribution promts the user to submit a request to support their
|
||||||
// currently unsupported distribution
|
// currently unsupported distribution
|
||||||
func RequestSupportForDistribution(distroInfo *DistroInfo) error {
|
func RequestSupportForDistribution(distroInfo *DistroInfo, libraryName string) error {
|
||||||
var logger = NewLogger()
|
var logger = NewLogger()
|
||||||
defaultError := fmt.Errorf("unable to check libraries on distribution '%s'", distroInfo.Name)
|
defaultError := fmt.Errorf("unable to check libraries on distribution '%s'. Please ensure that the '%s' equivalent is installed", distroInfo.Name, libraryName)
|
||||||
|
|
||||||
logger.Yellow("Distribution '%s' is not currently supported, but we would love to!", distroInfo.Name)
|
logger.Yellow("Distribution '%s' is not currently supported, but we would love to!", distroInfo.Name)
|
||||||
q := fmt.Sprintf("Would you like to submit a request to support distribution '%s'?", distroInfo.Name)
|
q := fmt.Sprintf("Would you like to submit a request to support distribution '%s'?", distroInfo.Name)
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ type Distribution struct {
|
|||||||
// GetRelease attempts to return the specific Release information
|
// GetRelease attempts to return the specific Release information
|
||||||
// for the given release name. If there is no specific match, the
|
// for the given release name. If there is no specific match, the
|
||||||
// default release data is returned.
|
// default release data is returned.
|
||||||
func (d *Distribution) GetRelease(version string) *Release {
|
func (d *Distribution) GetRelease(name string) *Release {
|
||||||
result := d.Releases[version]
|
result := d.Releases[name]
|
||||||
if result == nil {
|
if result == nil {
|
||||||
result = d.Releases["default"]
|
result = d.Releases["default"]
|
||||||
}
|
}
|
||||||
@@ -72,8 +72,8 @@ func (l *LinuxDB) ImportData(data []byte) error {
|
|||||||
// GetDistro returns the Distribution information for the
|
// GetDistro returns the Distribution information for the
|
||||||
// given distribution name. If the distribution is not supported,
|
// given distribution name. If the distribution is not supported,
|
||||||
// nil is returned.
|
// nil is returned.
|
||||||
func (l *LinuxDB) GetDistro(distro string) *Distribution {
|
func (l *LinuxDB) GetDistro(name string) *Distribution {
|
||||||
return l.Distributions[distro]
|
return l.Distributions[name]
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewLinuxDB creates a new LinuxDB instance from the bundled
|
// NewLinuxDB creates a new LinuxDB instance from the bundled
|
||||||
|
|||||||
174
cmd/linuxdb.yaml
174
cmd/linuxdb.yaml
@@ -1,51 +1,42 @@
|
|||||||
---
|
---
|
||||||
distributions:
|
distributions:
|
||||||
debian:
|
|
||||||
id: debian
|
|
||||||
releases:
|
|
||||||
default:
|
|
||||||
name: Debian
|
|
||||||
version: default
|
|
||||||
gccversioncommand: &gccdumpversion -dumpversion
|
|
||||||
programs: &debiandefaultprograms
|
|
||||||
- name: gcc
|
|
||||||
help: Please install with `sudo apt-get install build-essential` and try again
|
|
||||||
- name: pkg-config
|
|
||||||
help: Please install with `sudo apt-get install pkg-config` and try again
|
|
||||||
- name: npm
|
|
||||||
help: Please install with `curl -sL https://deb.nodesource.com/setup_12.x | sudo bash - && sudo apt-get install -y nodejs` and try again
|
|
||||||
libraries: &debiandefaultlibraries
|
|
||||||
- name: libgtk-3-dev
|
|
||||||
help: Please install with `sudo apt-get install libgtk-3-dev` and try again
|
|
||||||
- name: libwebkit2gtk-4.0-dev
|
|
||||||
help: Please install with `sudo apt-get install libwebkit2gtk-4.0-dev` and try again
|
|
||||||
ubuntu:
|
ubuntu:
|
||||||
id: ubuntu
|
id: ubuntu
|
||||||
releases:
|
releases:
|
||||||
default:
|
default:
|
||||||
version: default
|
|
||||||
name: Ubuntu
|
name: Ubuntu
|
||||||
|
version: default
|
||||||
gccversioncommand: &gccdumpfullversion -dumpfullversion
|
gccversioncommand: &gccdumpfullversion -dumpfullversion
|
||||||
programs: *debiandefaultprograms
|
programs: &ubuntudefaultprograms
|
||||||
libraries: *debiandefaultlibraries
|
- name: gcc
|
||||||
kali:
|
help: Please install with `sudo apt install build-essential` and try again
|
||||||
id: kali
|
- name: pkg-config
|
||||||
|
help: Please install with `sudo apt install pkg-config` and try again
|
||||||
|
- name: npm
|
||||||
|
help: Please install with `curl -sL https://deb.nodesource.com/setup_12.x | sudo bash - && sudo apt-get install -y nodejs` and try again
|
||||||
|
libraries: &ubuntudefaultlibraries
|
||||||
|
- name: libgtk-3-dev
|
||||||
|
help: Please install with `sudo apt install libgtk-3-dev` and try again
|
||||||
|
- name: libwebkit2gtk-4.0-dev
|
||||||
|
help: Please install with `sudo apt install libwebkit2gtk-4.0-dev` and try again
|
||||||
|
debian:
|
||||||
|
id: debian
|
||||||
releases:
|
releases:
|
||||||
default:
|
default:
|
||||||
version: default
|
version: default
|
||||||
name: Kali GNU/Linux
|
name: Debian
|
||||||
gccversioncommand: *gccdumpfullversion
|
gccversioncommand: &gccdumpversion -dumpversion
|
||||||
programs: *debiandefaultprograms
|
programs: *ubuntudefaultprograms
|
||||||
libraries: *debiandefaultlibraries
|
libraries: *ubuntudefaultlibraries
|
||||||
parrot:
|
parrot:
|
||||||
id: parrot
|
id: parrot
|
||||||
releases:
|
releases:
|
||||||
default:
|
default:
|
||||||
version: default
|
version: default
|
||||||
name: Parrot GNU/Linux
|
name: Parrot
|
||||||
gccversioncommand: *gccdumpversion
|
gccversioncommand: *gccdumpversion
|
||||||
programs: *debiandefaultprograms
|
programs: *ubuntudefaultprograms
|
||||||
libraries: *debiandefaultlibraries
|
libraries: *ubuntudefaultlibraries
|
||||||
zorin:
|
zorin:
|
||||||
id: zorin
|
id: zorin
|
||||||
releases:
|
releases:
|
||||||
@@ -53,60 +44,20 @@ distributions:
|
|||||||
version: default
|
version: default
|
||||||
name: Zorin
|
name: Zorin
|
||||||
gccversioncommand: *gccdumpversion
|
gccversioncommand: *gccdumpversion
|
||||||
programs: *debiandefaultprograms
|
|
||||||
libraries: *debiandefaultlibraries
|
|
||||||
linuxmint:
|
|
||||||
id: linuxmint
|
|
||||||
releases:
|
|
||||||
default:
|
|
||||||
version: default
|
|
||||||
name: Linux Mint
|
|
||||||
gccversioncommand: *gccdumpversion
|
|
||||||
programs: *debiandefaultprograms
|
|
||||||
libraries: *debiandefaultlibraries
|
|
||||||
elementary:
|
|
||||||
id: elementary
|
|
||||||
releases:
|
|
||||||
default:
|
|
||||||
version: default
|
|
||||||
name: elementary OS
|
|
||||||
gccversioncommand: *gccdumpfullversion
|
|
||||||
programs: *debiandefaultprograms
|
|
||||||
libraries: *debiandefaultlibraries
|
|
||||||
neon:
|
|
||||||
id: neon
|
|
||||||
releases:
|
|
||||||
default:
|
|
||||||
version: default
|
|
||||||
name: KDE neon
|
|
||||||
gccversioncommand: *gccdumpfullversion
|
|
||||||
programs: *debiandefaultprograms
|
|
||||||
libraries: *debiandefaultlibraries
|
|
||||||
void:
|
|
||||||
id: void
|
|
||||||
releases:
|
|
||||||
default:
|
|
||||||
version: default
|
|
||||||
name: VoidLinux
|
|
||||||
gccversioncommand: *gccdumpversion
|
|
||||||
programs:
|
programs:
|
||||||
- name: gcc
|
- name: gcc
|
||||||
help: Please install with `xbps-install base-devel` and try again
|
help: Please install with `sudo apt install build-essential` and try again
|
||||||
- name: pkg-config
|
- name: pkg-config
|
||||||
help: Please install with `xbps-install pkg-config` and try again
|
help: Please install with `sudo apt install pkg-config` and try again
|
||||||
- name: npm
|
- name: npm
|
||||||
help: Please install with `xbps-install nodejs` and try again
|
help: Please install with `sudo snap install node --channel=12/stable --classic` and try again
|
||||||
libraries:
|
libraries: *ubuntudefaultlibraries
|
||||||
- name: gtk+3-devel
|
|
||||||
help: Please install with `xbps-install gtk+3-devel` and try again
|
|
||||||
- name: webkit2gtk-devel
|
|
||||||
help: Please install with `xbps-install webkit2gtk-devel` and try again
|
|
||||||
centos:
|
centos:
|
||||||
id: centos
|
id: centos
|
||||||
releases:
|
releases:
|
||||||
default:
|
default:
|
||||||
version: default
|
version: default
|
||||||
name: CentOS Linux
|
name: CentOS
|
||||||
gccversioncommand: *gccdumpversion
|
gccversioncommand: *gccdumpversion
|
||||||
programs:
|
programs:
|
||||||
- name: gcc
|
- name: gcc
|
||||||
@@ -114,12 +65,12 @@ distributions:
|
|||||||
- name: pkg-config
|
- name: pkg-config
|
||||||
help: Please install with `sudo yum install pkgconf-pkg-config` and try again
|
help: Please install with `sudo yum install pkgconf-pkg-config` and try again
|
||||||
- name: npm
|
- name: npm
|
||||||
help: Please install with `sudo yum install epel-release && sudo yum install nodejs` and try again
|
help: Please install with `curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash - && sudo yum install -y nodejs` and try again
|
||||||
libraries:
|
libraries: ¢osdefaultlibraries
|
||||||
- name: gtk3-devel
|
- name: gtk3-devel
|
||||||
help: Please install with `sudo yum install gtk3-devel` and try again
|
help: Please install with `sudo yum install gtk3-devel` and try again
|
||||||
- name: webkitgtk3-devel
|
- name: webkit2gtk3-devel
|
||||||
help: Please install with `sudo yum install webkitgtk3-devel` and try again
|
help: Please install with `sudo yum install webkit2gtk3-devel` and try again
|
||||||
fedora:
|
fedora:
|
||||||
id: fedora
|
id: fedora
|
||||||
releases:
|
releases:
|
||||||
@@ -133,12 +84,8 @@ distributions:
|
|||||||
- name: pkg-config
|
- name: pkg-config
|
||||||
help: Please install with `sudo yum install pkgconf-pkg-config` and try again
|
help: Please install with `sudo yum install pkgconf-pkg-config` and try again
|
||||||
- name: npm
|
- name: npm
|
||||||
help: Please install `sudo yum install nodejs` and try again
|
help: Please install `sudo yum install -y nodejs` and try again
|
||||||
libraries:
|
libraries: *centosdefaultlibraries
|
||||||
- name: gtk3-devel
|
|
||||||
help: Please install with `sudo yum install gtk3-devel` and try again
|
|
||||||
- name: webkit2gtk3-devel
|
|
||||||
help: Please install with `sudo yum install webkit2gtk3-devel` and try again
|
|
||||||
arch:
|
arch:
|
||||||
id: arch
|
id: arch
|
||||||
releases:
|
releases:
|
||||||
@@ -146,27 +93,17 @@ distributions:
|
|||||||
version: default
|
version: default
|
||||||
name: Arch Linux
|
name: Arch Linux
|
||||||
gccversioncommand: *gccdumpversion
|
gccversioncommand: *gccdumpversion
|
||||||
programs: &archdefaultprograms
|
prerequisites:
|
||||||
- name: gcc
|
- name: gtk3
|
||||||
help: Please install with `sudo pacman -S gcc` and try again
|
help: Please install with `sudo pacman -S gtk3` and try again
|
||||||
- name: pkgconf
|
- name: webkit2gtk
|
||||||
help: Please install with `sudo pacman -S pkgconf` and try again
|
help: Please install with `sudo pacman -S webkit2gtk` and try again
|
||||||
- name: npm
|
- name: gcc
|
||||||
help: Please install with `sudo pacman -S npm` and try again
|
help: Please install with `sudo pacman -S gcc` and try again
|
||||||
libraries: &archdefaultlibraries
|
- name: pkgconf
|
||||||
- name: gtk3
|
help: Please install with `sudo pacman -S pkgconf` and try again
|
||||||
help: Please install with `sudo pacman -S gtk3` and try again
|
- name: npm
|
||||||
- name: webkit2gtk
|
help: Please install with `sudo pacman -S npm` and try again
|
||||||
help: Please install with `sudo pacman -S webkit2gtk` and try again
|
|
||||||
manjaro:
|
|
||||||
id: manjaro
|
|
||||||
releases:
|
|
||||||
default:
|
|
||||||
version: default
|
|
||||||
name: Manjaro Linux
|
|
||||||
gccversioncommand: *gccdumpversion
|
|
||||||
programs: *archdefaultprograms
|
|
||||||
libraries: *archdefaultlibraries
|
|
||||||
gentoo:
|
gentoo:
|
||||||
id: gentoo
|
id: gentoo
|
||||||
releases:
|
releases:
|
||||||
@@ -174,15 +111,14 @@ distributions:
|
|||||||
version: default
|
version: default
|
||||||
name: Gentoo
|
name: Gentoo
|
||||||
gccversioncommand: *gccdumpversion
|
gccversioncommand: *gccdumpversion
|
||||||
programs:
|
prerequisites:
|
||||||
- name: gcc
|
- name: gtk+:3
|
||||||
help: Please install using your system's package manager
|
help: Please install with `sudo emerge gtk+:3` and try again
|
||||||
- name: pkg-config
|
- name: webkit-gtk
|
||||||
help: Please install using your system's package manager
|
help: Please install with `sudo emerge webkit-gtk` and try again
|
||||||
- name: npm
|
- name: gcc
|
||||||
help: Please install using your system's package manager
|
help: Please install using your system's package manager
|
||||||
libraries:
|
- name: pkg-config
|
||||||
- name: gtk+:3
|
help: Please install using your system's package manager
|
||||||
help: Please install with `sudo emerge gtk+:3` and try again
|
- name: npm
|
||||||
- name: webkit-gtk
|
help: Please install using your system's package manager
|
||||||
help: Please install with `sudo emerge webkit-gtk` and try again
|
|
||||||
|
|||||||
@@ -191,15 +191,8 @@ func (b *PackageHelper) PackageWindows(po *ProjectOptions, cleanUp bool) error {
|
|||||||
|
|
||||||
// Build syso
|
// Build syso
|
||||||
sysofile := filepath.Join(b.fs.Cwd(), basename+"-res.syso")
|
sysofile := filepath.Join(b.fs.Cwd(), basename+"-res.syso")
|
||||||
|
windresCommand := []string{"windres", "-o", sysofile, tgtRCFile}
|
||||||
batfile, err := fs.LocalDir(".")
|
err := NewProgramHelper().RunCommandArray(windresCommand)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
windresBatFile := filepath.Join(batfile.fullPath, "windres.bat")
|
|
||||||
windresCommand := []string{windresBatFile, sysofile, tgtRCFile}
|
|
||||||
err = NewProgramHelper().RunCommandArray(windresCommand)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,19 +100,6 @@ func (p *ProgramHelper) InstallGoPackage(packageName string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// InstallNPMPackage installs the given npm package
|
|
||||||
func (p *ProgramHelper) InstallNPMPackage(packageName string, save bool) error {
|
|
||||||
args := strings.Split("install "+packageName, " ")
|
|
||||||
if save {
|
|
||||||
args = append(args, "--save")
|
|
||||||
}
|
|
||||||
_, stderr, err := p.shell.Run("npm", args...)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println(stderr)
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// RunCommand runs the given command
|
// RunCommand runs the given command
|
||||||
func (p *ProgramHelper) RunCommand(command string) error {
|
func (p *ProgramHelper) RunCommand(command string) error {
|
||||||
args := strings.Split(command, " ")
|
args := strings.Split(command, " ")
|
||||||
@@ -128,7 +115,6 @@ func (p *ProgramHelper) RunCommandArray(args []string, dir ...string) error {
|
|||||||
fmt.Printf("ERROR: Looks like '%s' isn't installed. Please install and try again.", program)
|
fmt.Printf("ERROR: Looks like '%s' isn't installed. Please install and try again.", program)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
args = args[1:]
|
args = args[1:]
|
||||||
var stderr string
|
var stderr string
|
||||||
var stdout string
|
var stdout string
|
||||||
|
|||||||
@@ -13,18 +13,6 @@ import (
|
|||||||
"github.com/leaanthony/slicer"
|
"github.com/leaanthony/slicer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PackageManager indicates different package managers
|
|
||||||
type PackageManager int
|
|
||||||
|
|
||||||
const (
|
|
||||||
// UNKNOWN package manager
|
|
||||||
UNKNOWN PackageManager = iota
|
|
||||||
// NPM package manager
|
|
||||||
NPM
|
|
||||||
// YARN package manager
|
|
||||||
YARN
|
|
||||||
)
|
|
||||||
|
|
||||||
type author struct {
|
type author struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
@@ -124,9 +112,9 @@ func (ph *ProjectHelper) NewProjectOptions() *ProjectOptions {
|
|||||||
Description: "Enter your project description",
|
Description: "Enter your project description",
|
||||||
Version: "0.1.0",
|
Version: "0.1.0",
|
||||||
BinaryName: "",
|
BinaryName: "",
|
||||||
system: ph.system,
|
system: NewSystemHelper(),
|
||||||
log: ph.log,
|
log: NewLogger(),
|
||||||
templates: ph.templates,
|
templates: NewTemplateHelper(),
|
||||||
Author: &author{},
|
Author: &author{},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,23 +153,6 @@ func (po *ProjectOptions) Defaults() {
|
|||||||
po.WailsVersion = Version
|
po.WailsVersion = Version
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetNPMBinaryName returns the type of package manager used by the project
|
|
||||||
func (po *ProjectOptions) GetNPMBinaryName() (PackageManager, error) {
|
|
||||||
if po.FrontEnd == nil {
|
|
||||||
return UNKNOWN, fmt.Errorf("No frontend specified in project options")
|
|
||||||
}
|
|
||||||
|
|
||||||
if strings.Index(po.FrontEnd.Install, "npm") > -1 {
|
|
||||||
return NPM, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if strings.Index(po.FrontEnd.Install, "yarn") > -1 {
|
|
||||||
return YARN, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return UNKNOWN, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// PromptForInputs asks the user to input project details
|
// PromptForInputs asks the user to input project details
|
||||||
func (po *ProjectOptions) PromptForInputs() error {
|
func (po *ProjectOptions) PromptForInputs() error {
|
||||||
|
|
||||||
|
|||||||
@@ -269,35 +269,55 @@ func CheckDependencies(logger *Logger) (bool, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var libraryChecker CheckPkgInstalled
|
|
||||||
distroInfo := GetLinuxDistroInfo()
|
distroInfo := GetLinuxDistroInfo()
|
||||||
|
|
||||||
switch distroInfo.Distribution {
|
|
||||||
case Ubuntu, Debian, Zorin, Parrot, Linuxmint, Elementary, Kali, Neon:
|
|
||||||
libraryChecker = DpkgInstalled
|
|
||||||
case Arch, Manjaro:
|
|
||||||
libraryChecker = PacmanInstalled
|
|
||||||
case CentOS, Fedora:
|
|
||||||
libraryChecker = RpmInstalled
|
|
||||||
case Gentoo:
|
|
||||||
libraryChecker = EqueryInstalled
|
|
||||||
case VoidLinux:
|
|
||||||
libraryChecker = XbpsInstalled
|
|
||||||
default:
|
|
||||||
return false, RequestSupportForDistribution(distroInfo)
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, library := range *requiredLibraries {
|
for _, library := range *requiredLibraries {
|
||||||
installed, err := libraryChecker(library.Name)
|
switch distroInfo.Distribution {
|
||||||
if err != nil {
|
case Ubuntu, Debian, Zorin, Parrot:
|
||||||
return false, err
|
installed, err := DpkgInstalled(library.Name)
|
||||||
}
|
if err != nil {
|
||||||
if !installed {
|
return false, err
|
||||||
errors = true
|
}
|
||||||
logger.Error("Library '%s' not found. %s", library.Name, library.Help)
|
if !installed {
|
||||||
} else {
|
errors = true
|
||||||
logger.Green("Library '%s' installed.", library.Name)
|
logger.Error("Library '%s' not found. %s", library.Name, library.Help)
|
||||||
|
} else {
|
||||||
|
logger.Green("Library '%s' installed.", library.Name)
|
||||||
|
}
|
||||||
|
case Arch:
|
||||||
|
installed, err := PacmanInstalled(library.Name)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
if !installed {
|
||||||
|
errors = true
|
||||||
|
logger.Error("Library '%s' not found. %s", library.Name, library.Help)
|
||||||
|
} else {
|
||||||
|
logger.Green("Library '%s' installed.", library.Name)
|
||||||
|
}
|
||||||
|
case CentOS, Fedora:
|
||||||
|
installed, err := RpmInstalled(library.Name)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
if !installed {
|
||||||
|
errors = true
|
||||||
|
logger.Error("Library '%s' not found. %s", library.Name, library.Help)
|
||||||
|
} else {
|
||||||
|
logger.Green("Library '%s' installed.", library.Name)
|
||||||
|
}
|
||||||
|
case Gentoo:
|
||||||
|
installed, err := EqueryInstalled(library.Name)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
if !installed {
|
||||||
|
errors = true
|
||||||
|
logger.Error("Library '%s' not found. %s", library.Name, library.Help)
|
||||||
|
} else {
|
||||||
|
logger.Green("Library '%s' installed.", library.Name)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return false, RequestSupportForDistribution(distroInfo, library.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ func NewTemplateHelper() *TemplateHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsValidTemplate returns true if the given template name resides on disk
|
// IsValidTemplate returns true if the given tempalte name resides on disk
|
||||||
func (t *TemplateHelper) IsValidTemplate(templateName string) bool {
|
func (t *TemplateHelper) IsValidTemplate(templateName string) bool {
|
||||||
pathToTemplate := filepath.Join(t.templateDir.fullPath, templateName)
|
pathToTemplate := filepath.Join(t.templateDir.fullPath, templateName)
|
||||||
return t.fs.DirExists(pathToTemplate)
|
return t.fs.DirExists(pathToTemplate)
|
||||||
|
|||||||
@@ -9,4 +9,4 @@
|
|||||||
last 2 versions
|
last 2 versions
|
||||||
Firefox ESR
|
Firefox ESR
|
||||||
not dead
|
not dead
|
||||||
IE 9-11 # For IE 9-11 support, remove 'not'.
|
not IE 9-11 # For IE 9-11 support, remove 'not'.
|
||||||
@@ -22,7 +22,6 @@
|
|||||||
"@angular/platform-browser-dynamic": "~8.0.1",
|
"@angular/platform-browser-dynamic": "~8.0.1",
|
||||||
"@angular/router": "~8.0.1",
|
"@angular/router": "~8.0.1",
|
||||||
"@wailsapp/runtime": "^1.0.0",
|
"@wailsapp/runtime": "^1.0.0",
|
||||||
"core-js": "^3.4.4",
|
|
||||||
"ngx-build-plus": "^8.0.3",
|
"ngx-build-plus": "^8.0.3",
|
||||||
"rxjs": "~6.4.0",
|
"rxjs": "~6.4.0",
|
||||||
"tslib": "^1.9.0",
|
"tslib": "^1.9.0",
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'core-js/stable';
|
|
||||||
import { enableProdMode } from '@angular/core';
|
import { enableProdMode } from '@angular/core';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
@@ -7,7 +6,7 @@ import { environment } from './environments/environment';
|
|||||||
|
|
||||||
import 'zone.js'
|
import 'zone.js'
|
||||||
|
|
||||||
import * as Wails from '@wailsapp/runtime';
|
import Wails from '@wailsapp/runtime';
|
||||||
|
|
||||||
if (environment.production) {
|
if (environment.production) {
|
||||||
enableProdMode();
|
enableProdMode();
|
||||||
|
|||||||
17
cmd/templates/angular-template/frontend/src/wailsbridge.js
vendored
Normal file
17
cmd/templates/angular-template/frontend/src/wailsbridge.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
Wails Bridge (c) 2019-present Lea Anthony
|
||||||
|
|
||||||
|
This prod version is to get around having to rewrite your code
|
||||||
|
for production. When doing a release build, this file will be used
|
||||||
|
instead of the full version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export default {
|
||||||
|
// The main function
|
||||||
|
// Passes the main Wails object to the callback if given.
|
||||||
|
Start: function(callback) {
|
||||||
|
if (callback) {
|
||||||
|
window.wails.events.on("wails:ready", callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"importHelpers": true,
|
"importHelpers": true,
|
||||||
"target": "es5",
|
"target": "es2015",
|
||||||
"typeRoots": [
|
"typeRoots": [
|
||||||
"node_modules/@types"
|
"node_modules/@types"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ func basic() string {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
js := mewn.String("./frontend/dist/my-app/main.js")
|
js := mewn.String("./frontend/dist/my-app/main-es2015.js")
|
||||||
css := mewn.String("./frontend/dist/my-app/styles.css")
|
css := mewn.String("./frontend/dist/my-app/styles.css")
|
||||||
|
|
||||||
app := wails.CreateApp(&wails.AppConfig{
|
app := wails.CreateApp(&wails.AppConfig{
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import 'core-js/stable';
|
|||||||
import './index.css';
|
import './index.css';
|
||||||
import App from './App';
|
import App from './App';
|
||||||
|
|
||||||
import * as Wails from '@wailsapp/runtime';
|
import Wails from '@wailsapp/runtime';
|
||||||
|
|
||||||
Wails.Init(() => {
|
Wails.Init(() => {
|
||||||
ReactDOM.render(<App />, document.getElementById('app'));
|
ReactDOM.render(<App />, document.getElementById('app'));
|
||||||
|
|||||||
17
cmd/templates/create-react-app/frontend/src/wailsbridge.js
Normal file
17
cmd/templates/create-react-app/frontend/src/wailsbridge.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
Wails Bridge (c) 2019-present Lea Anthony
|
||||||
|
|
||||||
|
This prod version is to get around having to rewrite your code
|
||||||
|
for production. When doing a release build, this file will be used
|
||||||
|
instead of the full version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export default {
|
||||||
|
// The main function
|
||||||
|
// Passes the main Wails object to the callback if given.
|
||||||
|
Start: function (callback) {
|
||||||
|
if (callback) {
|
||||||
|
window.wails.Events.On("wails:ready", callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -4,7 +4,7 @@ import App from './App.vue';
|
|||||||
Vue.config.productionTip = false;
|
Vue.config.productionTip = false;
|
||||||
Vue.config.devtools = true;
|
Vue.config.devtools = true;
|
||||||
|
|
||||||
import * as Wails from '@wailsapp/runtime';
|
import Wails from '@wailsapp/runtime';
|
||||||
|
|
||||||
Wails.Init(() => {
|
Wails.Init(() => {
|
||||||
new Vue({
|
new Vue({
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import App from './App.vue';
|
|||||||
Vue.config.productionTip = false;
|
Vue.config.productionTip = false;
|
||||||
Vue.config.devtools = true;
|
Vue.config.devtools = true;
|
||||||
|
|
||||||
import * as Wails from '@wailsapp/runtime';
|
import Wails from '@wailsapp/runtime';
|
||||||
|
|
||||||
Wails.Init(() => {
|
Wails.Init(() => {
|
||||||
new Vue({
|
new Vue({
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
// Version - Wails version
|
// Version - Wails version
|
||||||
const Version = "v0.19.0"
|
const Version = "v0.17.11-pre"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/cmd"
|
"github.com/wailsapp/wails/cmd"
|
||||||
@@ -23,7 +24,7 @@ func init() {
|
|||||||
|
|
||||||
system := cmd.NewSystemHelper()
|
system := cmd.NewSystemHelper()
|
||||||
err = system.Initialise()
|
err = system.Initialise()
|
||||||
if err != nil {
|
if err == nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,9 +33,23 @@ Create your first project by running 'wails init'.`
|
|||||||
if runtime.GOOS != "windows" {
|
if runtime.GOOS != "windows" {
|
||||||
successMessage = "🚀 " + successMessage
|
successMessage = "🚀 " + successMessage
|
||||||
}
|
}
|
||||||
|
// Platform check
|
||||||
|
err = platformCheck()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// Chrck for programs and libraries dependencies
|
// Check we have a cgo capable environment
|
||||||
errors, err := cmd.CheckDependencies(logger)
|
logger.Yellow("Checking for prerequisites...")
|
||||||
|
var requiredProgramErrors bool
|
||||||
|
requiredProgramErrors, err = checkRequiredPrograms()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Linux has library deps
|
||||||
|
var libraryErrors bool
|
||||||
|
libraryErrors, err = checkLibraries()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -45,14 +60,76 @@ Create your first project by running 'wails init'.`
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.White("")
|
||||||
|
|
||||||
// Check for errors
|
// Check for errors
|
||||||
// CheckDependencies() returns !errors
|
var errors = libraryErrors || requiredProgramErrors
|
||||||
// so to get the right message in this
|
if !errors {
|
||||||
// check we have to do it in reversed
|
|
||||||
if errors {
|
|
||||||
logger.Yellow(successMessage)
|
logger.Yellow(successMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func platformCheck() error {
|
||||||
|
switch runtime.GOOS {
|
||||||
|
case "darwin":
|
||||||
|
logger.Yellow("Detected Platform: OSX")
|
||||||
|
case "windows":
|
||||||
|
logger.Yellow("Detected Platform: Windows")
|
||||||
|
case "linux":
|
||||||
|
logger.Yellow("Detected Platform: Linux")
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("Platform %s is currently not supported", runtime.GOOS)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkLibraries() (errors bool, err error) {
|
||||||
|
if runtime.GOOS == "linux" {
|
||||||
|
// Check library prerequisites
|
||||||
|
requiredLibraries, err := cmd.GetRequiredLibraries()
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
distroInfo := cmd.GetLinuxDistroInfo()
|
||||||
|
for _, library := range *requiredLibraries {
|
||||||
|
switch distroInfo.Distribution {
|
||||||
|
case cmd.Ubuntu, cmd.Zorin, cmd.Debian:
|
||||||
|
installed, err := cmd.DpkgInstalled(library.Name)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
if !installed {
|
||||||
|
errors = true
|
||||||
|
logger.Red("Library '%s' not found. %s", library.Name, library.Help)
|
||||||
|
} else {
|
||||||
|
logger.Green("Library '%s' installed.", library.Name)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return false, cmd.RequestSupportForDistribution(distroInfo, library.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkRequiredPrograms() (errors bool, err error) {
|
||||||
|
requiredPrograms, err := cmd.GetRequiredPrograms()
|
||||||
|
if err != nil {
|
||||||
|
return true, err
|
||||||
|
}
|
||||||
|
errors = false
|
||||||
|
programHelper := cmd.NewProgramHelper()
|
||||||
|
for _, program := range *requiredPrograms {
|
||||||
|
bin := programHelper.FindProgram(program.Name)
|
||||||
|
if bin == nil {
|
||||||
|
errors = true
|
||||||
|
logger.Red("Program '%s' not found. %s", program.Name, program.Help)
|
||||||
|
} else {
|
||||||
|
logger.Green("Program '%s' found: %s", program.Name, bin.Path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,408 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bufio"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/Masterminds/semver"
|
|
||||||
"github.com/leaanthony/spinner"
|
|
||||||
"github.com/wailsapp/wails/cmd"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Constants
|
|
||||||
var checkSpinner = spinner.NewSpinner()
|
|
||||||
var migrateProjectOptions = &cmd.ProjectOptions{}
|
|
||||||
var migrateFS = cmd.NewFSHelper()
|
|
||||||
var migrateGithub = cmd.NewGitHubHelper()
|
|
||||||
var programHelper = cmd.NewProgramHelper()
|
|
||||||
var lessThanV1 *semver.Constraints
|
|
||||||
|
|
||||||
// The user's go.mod
|
|
||||||
var goMod string
|
|
||||||
var goModFile string
|
|
||||||
|
|
||||||
// The user's main.js
|
|
||||||
var mainJSFile string
|
|
||||||
var mainJSContents string
|
|
||||||
|
|
||||||
// Frontend directory
|
|
||||||
var frontEndDir string
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
|
|
||||||
var dryrun bool
|
|
||||||
var err error
|
|
||||||
|
|
||||||
lessThanV1, err = semver.NewConstraint("< v1.0.0")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// var forceRebuild = false
|
|
||||||
checkSpinner.SetSpinSpeed(50)
|
|
||||||
|
|
||||||
commandDescription := `EXPERIMENTAL - This command attempts to migrate projects to the latest Wails version.`
|
|
||||||
updateCmd := app.Command("migrate", "Migrate projects to latest Wails release").
|
|
||||||
LongDescription(commandDescription).
|
|
||||||
BoolFlag("dryrun", "Only display what would be done", &dryrun)
|
|
||||||
|
|
||||||
updateCmd.Action(func() error {
|
|
||||||
|
|
||||||
message := "Migrate Project"
|
|
||||||
logger.PrintSmallBanner(message)
|
|
||||||
logger.Red("WARNING: This is an experimental command. Ensure you have backups of your project!")
|
|
||||||
logger.Red("It currently only supports npm based projects.")
|
|
||||||
fmt.Println()
|
|
||||||
|
|
||||||
// Check project directory
|
|
||||||
err := checkProjectDirectory()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find Wails version from go.mod
|
|
||||||
wailsVersion, err := getWailsVersion()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get latest stable version
|
|
||||||
var latestVersion *semver.Version
|
|
||||||
latestVersion, err = getLatestWailsVersion()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
var canMigrate bool
|
|
||||||
canMigrate, err = canMigrateVersion(wailsVersion, latestVersion)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if !canMigrate {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for wailsbridge
|
|
||||||
wailsBridge, err := checkWailsBridge()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is main.js using bridge.Init()
|
|
||||||
canUpdateMainJS, err := checkMainJS()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Check if we are using legacy js runtime
|
|
||||||
|
|
||||||
// Operations
|
|
||||||
logger.Yellow("Operations to perform:")
|
|
||||||
|
|
||||||
logger.Yellowf(" - Update to Wails v%s\n", latestVersion)
|
|
||||||
|
|
||||||
if len(wailsBridge) > 0 {
|
|
||||||
logger.Yellow(" - Delete wailsbridge.js")
|
|
||||||
}
|
|
||||||
|
|
||||||
if canUpdateMainJS {
|
|
||||||
logger.Yellow(" - Patch main.js")
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.Yellow(" - Ensure '@wailsapp/runtime` module is installed")
|
|
||||||
|
|
||||||
if dryrun {
|
|
||||||
logger.White("Exiting: Dry Run")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.Red("*WARNING* About to modify your project!")
|
|
||||||
logger.Red("Type 'YES' to continue: ")
|
|
||||||
scanner := bufio.NewScanner(os.Stdin)
|
|
||||||
scanner.Scan()
|
|
||||||
input := scanner.Text()
|
|
||||||
if input != "YES" {
|
|
||||||
logger.Red("ABORTED!")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.Yellow("Let's do this!")
|
|
||||||
|
|
||||||
err = updateWailsVersion(wailsVersion, latestVersion)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(wailsBridge) > 0 {
|
|
||||||
err = deleteWailsBridge(wailsBridge)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if canUpdateMainJS {
|
|
||||||
err = patchMainJS()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Install runtime
|
|
||||||
err = installWailsRuntime()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Println()
|
|
||||||
logger.Yellow("Migration complete! Check project by running `wails build`.")
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkProjectDirectory() error {
|
|
||||||
// Get versions
|
|
||||||
checkSpinner.Start("Check Project Directory")
|
|
||||||
|
|
||||||
// Check we are in project directory
|
|
||||||
err := migrateProjectOptions.LoadConfig(migrateFS.Cwd())
|
|
||||||
if err != nil {
|
|
||||||
checkSpinner.Error()
|
|
||||||
return fmt.Errorf("Unable to find 'project.json'. Please check you are in a Wails project directory")
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSpinner.Success()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getWailsVersion() (*semver.Version, error) {
|
|
||||||
checkSpinner.Start("Get Wails Version")
|
|
||||||
var result *semver.Version
|
|
||||||
|
|
||||||
// Load file
|
|
||||||
var err error
|
|
||||||
goModFile, err = filepath.Abs(filepath.Join(".", "go.mod"))
|
|
||||||
if err != nil {
|
|
||||||
checkSpinner.Error()
|
|
||||||
return nil, fmt.Errorf("Unable to load go.mod at %s", goModFile)
|
|
||||||
}
|
|
||||||
goMod, err = migrateFS.LoadAsString(goModFile)
|
|
||||||
if err != nil {
|
|
||||||
checkSpinner.Error()
|
|
||||||
return nil, fmt.Errorf("Unable to load go.mod")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find wails version
|
|
||||||
versionRegexp := regexp.MustCompile(`.*github.com/wailsapp/wails.*(v\d+.\d+.\d+)`)
|
|
||||||
versions := versionRegexp.FindStringSubmatch(goMod)
|
|
||||||
|
|
||||||
if len(versions) != 2 {
|
|
||||||
return nil, fmt.Errorf("Unable to determine Wails version")
|
|
||||||
}
|
|
||||||
|
|
||||||
version := versions[1]
|
|
||||||
result, err = semver.NewVersion(version)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("Unable to parse Wails version: %s", version)
|
|
||||||
}
|
|
||||||
checkSpinner.Success("Found Wails Version: " + version)
|
|
||||||
return result, nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func canMigrateVersion(wailsVersion *semver.Version, latestVersion *semver.Version) (bool, error) {
|
|
||||||
checkSpinner.Start("Checking ability to Migrate")
|
|
||||||
|
|
||||||
// Check if we are at the latest version!!!!
|
|
||||||
if wailsVersion.Equal(latestVersion) || wailsVersion.GreaterThan(latestVersion) {
|
|
||||||
checkSpinner.Errorf("Checking ability to Migrate: No! (v%s >= v%s)", wailsVersion, latestVersion)
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for < v1.0.0
|
|
||||||
if lessThanV1.Check(wailsVersion) {
|
|
||||||
checkSpinner.Successf("Checking ability to Migrate: Yes! (v%s < v1.0.0)", wailsVersion)
|
|
||||||
return true, nil
|
|
||||||
}
|
|
||||||
checkSpinner.Error("Unable to migrate")
|
|
||||||
return false, fmt.Errorf("No migration rules for version %s", wailsVersion)
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkWailsBridge() (string, error) {
|
|
||||||
checkSpinner.Start("Checking if legacy Wails Bridge present")
|
|
||||||
|
|
||||||
// Check frontend dir is available
|
|
||||||
if migrateProjectOptions.FrontEnd == nil ||
|
|
||||||
len(migrateProjectOptions.FrontEnd.Dir) == 0 ||
|
|
||||||
!migrateFS.DirExists(migrateProjectOptions.FrontEnd.Dir) {
|
|
||||||
checkSpinner.Error("Unable to determine frontend directory")
|
|
||||||
return "", fmt.Errorf("Unable to determine frontend directory")
|
|
||||||
}
|
|
||||||
|
|
||||||
frontEndDir = migrateProjectOptions.FrontEnd.Dir
|
|
||||||
|
|
||||||
wailsBridgePath, err := filepath.Abs(filepath.Join(".", frontEndDir, "src", "wailsbridge.js"))
|
|
||||||
if err != nil {
|
|
||||||
checkSpinner.Error(err.Error())
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
// If it doesn't exist, return blank string
|
|
||||||
if !migrateFS.FileExists(wailsBridgePath) {
|
|
||||||
checkSpinner.Success("Checking if legacy Wails Bridge present: No")
|
|
||||||
return "", nil
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSpinner.Success("Checking if legacy Wails Bridge present: Yes")
|
|
||||||
return wailsBridgePath, nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// This function determines if the main.js file using wailsbridge can be auto-updated
|
|
||||||
func checkMainJS() (bool, error) {
|
|
||||||
|
|
||||||
checkSpinner.Start("Checking if main.js can be migrated")
|
|
||||||
var err error
|
|
||||||
|
|
||||||
// Check main.js is there
|
|
||||||
if migrateProjectOptions.FrontEnd == nil ||
|
|
||||||
len(migrateProjectOptions.FrontEnd.Dir) == 0 ||
|
|
||||||
!migrateFS.DirExists(migrateProjectOptions.FrontEnd.Dir) {
|
|
||||||
checkSpinner.Error("Unable to determine frontend directory")
|
|
||||||
return false, fmt.Errorf("Unable to determine frontend directory")
|
|
||||||
}
|
|
||||||
|
|
||||||
frontEndDir = migrateProjectOptions.FrontEnd.Dir
|
|
||||||
|
|
||||||
mainJSFile, err = filepath.Abs(filepath.Join(".", frontEndDir, "src", "main.js"))
|
|
||||||
if err != nil {
|
|
||||||
checkSpinner.Error("Unable to find main.js")
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
|
|
||||||
mainJSContents, err = migrateFS.LoadAsString(mainJSFile)
|
|
||||||
if err != nil {
|
|
||||||
checkSpinner.Error("Unable to load main.js")
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check we have a line like: import Bridge from "./wailsbridge";
|
|
||||||
if strings.Index(mainJSContents, `import Bridge from "./wailsbridge";`) == -1 {
|
|
||||||
checkSpinner.Success("Checking if main.js can be migrated: No - Cannot find `import Bridge`")
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check we have a line like: Bridge.Start(() => {
|
|
||||||
if strings.Index(mainJSContents, `Bridge.Start(`) == -1 {
|
|
||||||
checkSpinner.Success("Checking if main.js can be migrated: No - Cannot find `Bridge.Start`")
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
checkSpinner.Success("Checking if main.js can be migrated: Yes")
|
|
||||||
return true, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getLatestWailsVersion() (*semver.Version, error) {
|
|
||||||
checkSpinner.Start("Checking GitHub for latest Wails version")
|
|
||||||
version, err := migrateGithub.GetLatestStableRelease()
|
|
||||||
if err != nil {
|
|
||||||
checkSpinner.Error("Checking GitHub for latest Wails version: Failed")
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSpinner.Successf("Checking GitHub for latest Wails version: v%s", version)
|
|
||||||
return version.Version, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func updateWailsVersion(currentVersion, latestVersion *semver.Version) error {
|
|
||||||
// Patch go.mod
|
|
||||||
checkSpinner.Start("Patching go.mod")
|
|
||||||
|
|
||||||
wailsModule := "github.com/wailsapp/wails"
|
|
||||||
old := fmt.Sprintf("%s v%s", wailsModule, currentVersion)
|
|
||||||
new := fmt.Sprintf("%s v%s", wailsModule, latestVersion)
|
|
||||||
|
|
||||||
goMod = strings.Replace(goMod, old, new, -1)
|
|
||||||
err := ioutil.WriteFile(goModFile, []byte(goMod), 0600)
|
|
||||||
if err != nil {
|
|
||||||
checkSpinner.Error()
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSpinner.Success()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func deleteWailsBridge(bridgeFilename string) error {
|
|
||||||
// Patch go.mod
|
|
||||||
checkSpinner.Start("Delete legacy wailsbridge.js")
|
|
||||||
|
|
||||||
err := migrateFS.RemoveFile(bridgeFilename)
|
|
||||||
if err != nil {
|
|
||||||
checkSpinner.Error()
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSpinner.Success()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func patchMainJS() error {
|
|
||||||
// Patch main.js
|
|
||||||
checkSpinner.Start("Patching main.js")
|
|
||||||
|
|
||||||
// Patch import line
|
|
||||||
oldImportLine := `import Bridge from "./wailsbridge";`
|
|
||||||
newImportLine := `import * as Wails from "@wailsapp/runtime";`
|
|
||||||
mainJSContents = strings.Replace(mainJSContents, oldImportLine, newImportLine, -1)
|
|
||||||
|
|
||||||
// Patch Start line
|
|
||||||
oldStartLine := `Bridge.Start`
|
|
||||||
newStartLine := `Wails.Init`
|
|
||||||
mainJSContents = strings.Replace(mainJSContents, oldStartLine, newStartLine, -1)
|
|
||||||
|
|
||||||
err := ioutil.WriteFile(mainJSFile, []byte(mainJSContents), 0600)
|
|
||||||
if err != nil {
|
|
||||||
checkSpinner.Error()
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSpinner.Success()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func installWailsRuntime() error {
|
|
||||||
|
|
||||||
checkSpinner.Start("Installing @wailsapp/runtime module")
|
|
||||||
|
|
||||||
// Change to the frontend directory
|
|
||||||
err := os.Chdir(frontEndDir)
|
|
||||||
if err != nil {
|
|
||||||
checkSpinner.Error()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine package manager
|
|
||||||
packageManager, err := migrateProjectOptions.GetNPMBinaryName()
|
|
||||||
if err != nil {
|
|
||||||
checkSpinner.Error()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch packageManager {
|
|
||||||
case cmd.NPM:
|
|
||||||
// npm install --save @wailsapp/runtime
|
|
||||||
programHelper.InstallNPMPackage("@wailsapp/runtime", true)
|
|
||||||
default:
|
|
||||||
checkSpinner.Error()
|
|
||||||
return fmt.Errorf("Unknown package manager")
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSpinner.Success()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -80,16 +80,15 @@ To help you in this process, we will ask for some information, add Go/Wails deta
|
|||||||
npm := program.FindProgram("npm")
|
npm := program.FindProgram("npm")
|
||||||
if npm != nil {
|
if npm != nil {
|
||||||
stdout, _, _, _ := npm.Run("--version")
|
stdout, _, _, _ := npm.Run("--version")
|
||||||
npmVersion = stdout
|
nodeVersion = stdout
|
||||||
npmVersion = npmVersion[:len(npmVersion)-1]
|
nodeVersion = nodeVersion[:len(nodeVersion)-1]
|
||||||
npmVersion = strings.TrimSpace(npmVersion)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
node := program.FindProgram("node")
|
node := program.FindProgram("node")
|
||||||
if node != nil {
|
if node != nil {
|
||||||
stdout, _, _, _ := node.Run("--version")
|
stdout, _, _, _ := node.Run("--version")
|
||||||
nodeVersion = stdout
|
npmVersion = stdout
|
||||||
nodeVersion = nodeVersion[:len(nodeVersion)-1]
|
npmVersion = npmVersion[:len(npmVersion)-1]
|
||||||
}
|
}
|
||||||
|
|
||||||
str.WriteString("\n| Name | Value |\n| ----- | ----- |\n")
|
str.WriteString("\n| Name | Value |\n| ----- | ----- |\n")
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"os/exec"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/cmd"
|
"github.com/wailsapp/wails/cmd"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -18,9 +15,5 @@ func main() {
|
|||||||
err := app.Run()
|
err := app.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error(err.Error())
|
logger.Error(err.Error())
|
||||||
if exitErr, ok := err.(*exec.ExitError); ok {
|
|
||||||
os.Exit(exitErr.ExitCode())
|
|
||||||
}
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
windres.exe -o %1 %2
|
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
package wails
|
package wails
|
||||||
|
|
||||||
import (
|
import "github.com/leaanthony/mewn"
|
||||||
"github.com/leaanthony/mewn"
|
|
||||||
"github.com/wailsapp/wails/runtime"
|
|
||||||
)
|
|
||||||
|
|
||||||
// AppConfig is the configuration structure used when creating a Wails App object
|
// AppConfig is the configuration structure used when creating a Wails App object
|
||||||
type AppConfig struct {
|
type AppConfig struct {
|
||||||
@@ -68,7 +65,7 @@ func (a *AppConfig) merge(in *AppConfig) error {
|
|||||||
a.CSS = in.CSS
|
a.CSS = in.CSS
|
||||||
}
|
}
|
||||||
if in.Title != "" {
|
if in.Title != "" {
|
||||||
a.Title = runtime.ProcessEncoding(in.Title)
|
a.Title = in.Title
|
||||||
}
|
}
|
||||||
|
|
||||||
if in.Colour != "" {
|
if in.Colour != "" {
|
||||||
|
|||||||
4
go.mod
4
go.mod
@@ -2,7 +2,6 @@ module github.com/wailsapp/wails
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Masterminds/semver v1.4.2
|
github.com/Masterminds/semver v1.4.2
|
||||||
github.com/abadojack/whatlanggo v1.0.1
|
|
||||||
github.com/dchest/cssmin v0.0.0-20151210170030-fb8d9b44afdc // indirect
|
github.com/dchest/cssmin v0.0.0-20151210170030-fb8d9b44afdc // indirect
|
||||||
github.com/dchest/htmlmin v0.0.0-20150526090704-e254725e81ac
|
github.com/dchest/htmlmin v0.0.0-20150526090704-e254725e81ac
|
||||||
github.com/dchest/jsmin v0.0.0-20160823214000-faeced883947 // indirect
|
github.com/dchest/jsmin v0.0.0-20160823214000-faeced883947 // indirect
|
||||||
@@ -23,11 +22,10 @@ require (
|
|||||||
github.com/pkg/errors v0.8.1 // indirect
|
github.com/pkg/errors v0.8.1 // indirect
|
||||||
github.com/sirupsen/logrus v1.4.1
|
github.com/sirupsen/logrus v1.4.1
|
||||||
github.com/stretchr/testify v1.3.0 // indirect
|
github.com/stretchr/testify v1.3.0 // indirect
|
||||||
github.com/syossan27/tebata v0.0.0-20180602121909-b283fe4bc5ba
|
github.com/wailsapp/webview v0.2.7
|
||||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529 // indirect
|
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529 // indirect
|
||||||
golang.org/x/net v0.0.0-20190509222800-a4d6f7feada5 // indirect
|
golang.org/x/net v0.0.0-20190509222800-a4d6f7feada5 // indirect
|
||||||
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862
|
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862
|
||||||
golang.org/x/text v0.3.0
|
|
||||||
gopkg.in/AlecAivazis/survey.v1 v1.8.4
|
gopkg.in/AlecAivazis/survey.v1 v1.8.4
|
||||||
gopkg.in/yaml.v3 v3.0.0-20190709130402-674ba3eaed22
|
gopkg.in/yaml.v3 v3.0.0-20190709130402-674ba3eaed22
|
||||||
)
|
)
|
||||||
|
|||||||
8
go.sum
8
go.sum
@@ -2,8 +2,6 @@ github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITg
|
|||||||
github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
|
github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
|
||||||
github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw=
|
github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw=
|
||||||
github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc=
|
github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc=
|
||||||
github.com/abadojack/whatlanggo v1.0.1 h1:19N6YogDnf71CTHm3Mp2qhYfkRdyvbgwWdd2EPxJRG4=
|
|
||||||
github.com/abadojack/whatlanggo v1.0.1/go.mod h1:66WiQbSbJBIlOZMsvbKe5m6pzQovxCH9B/K8tQB2uoc=
|
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@@ -70,8 +68,9 @@ github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
|
|||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/syossan27/tebata v0.0.0-20180602121909-b283fe4bc5ba h1:2DHfQOxcpWdGf5q5IzCUFPNvRX9Icf+09RvQK2VnJq0=
|
github.com/wailsapp/webview v0.2.7 h1:fN5L5H9Oivg9IJPk7uaXQnjqB68Fny11ZWkIaTIZHmk=
|
||||||
github.com/syossan27/tebata v0.0.0-20180602121909-b283fe4bc5ba/go.mod h1:iLnlXG2Pakcii2CU0cbY07DRCSvpWNa7nFxtevhOChk=
|
github.com/wailsapp/webview v0.2.7/go.mod h1:XO9HJbKWokDxUYTWQEBCYg95n/To1v7PxvanDNVf8hY=
|
||||||
|
github.com/zserge/webview v0.0.0-20190123072648-16c93bcaeaeb/go.mod h1:a1CV8KR4Dd1eP2g+mEijGOp+HKczwdKHWyx0aPHKvo4=
|
||||||
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529 h1:iMGN4xG0cnqj3t+zOM8wUB0BiPKHEwSxEZCvzcbZuvk=
|
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529 h1:iMGN4xG0cnqj3t+zOM8wUB0BiPKHEwSxEZCvzcbZuvk=
|
||||||
@@ -87,7 +86,6 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h
|
|||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862 h1:rM0ROo5vb9AdYJi1110yjWGMej9ITfKddS89P3Fkhug=
|
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862 h1:rM0ROo5vb9AdYJi1110yjWGMej9ITfKddS89P3Fkhug=
|
||||||
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
gopkg.in/AlecAivazis/survey.v1 v1.8.4 h1:10xXXN3wgIhPheb5NI58zFgZv32Ana7P3Tl4shW+0Qc=
|
gopkg.in/AlecAivazis/survey.v1 v1.8.4 h1:10xXXN3wgIhPheb5NI58zFgZv32Ana7P3Tl4shW+0Qc=
|
||||||
gopkg.in/AlecAivazis/survey.v1 v1.8.4/go.mod h1:iBNOmqKz/NUbZx3bA+4hAGLRC7fSK7tgtVDT4tB22XA=
|
gopkg.in/AlecAivazis/survey.v1 v1.8.4/go.mod h1:iBNOmqKz/NUbZx3bA+4hAGLRC7fSK7tgtVDT4tB22XA=
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/lib/interfaces"
|
|
||||||
"github.com/wailsapp/wails/lib/logger"
|
"github.com/wailsapp/wails/lib/logger"
|
||||||
"github.com/wailsapp/wails/lib/messages"
|
"github.com/wailsapp/wails/lib/messages"
|
||||||
|
"github.com/wailsapp/wails/lib/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Manager handles method binding
|
// Manager handles method binding
|
||||||
@@ -16,7 +16,6 @@ type Manager struct {
|
|||||||
functions map[string]*boundFunction
|
functions map[string]*boundFunction
|
||||||
internalMethods *internalMethods
|
internalMethods *internalMethods
|
||||||
initMethods []*boundMethod
|
initMethods []*boundMethod
|
||||||
shutdownMethods []*boundMethod
|
|
||||||
log *logger.CustomLogger
|
log *logger.CustomLogger
|
||||||
renderer interfaces.Renderer
|
renderer interfaces.Renderer
|
||||||
runtime interfaces.Runtime // The runtime object to pass to bound structs
|
runtime interfaces.Runtime // The runtime object to pass to bound structs
|
||||||
@@ -128,9 +127,6 @@ func (b *Manager) bindMethod(object interface{}) error {
|
|||||||
if newMethod.isWailsInit {
|
if newMethod.isWailsInit {
|
||||||
b.log.Debugf("Detected WailsInit function: %s", fullMethodName)
|
b.log.Debugf("Detected WailsInit function: %s", fullMethodName)
|
||||||
b.initMethods = append(b.initMethods, newMethod)
|
b.initMethods = append(b.initMethods, newMethod)
|
||||||
} else if newMethod.isWailsShutdown {
|
|
||||||
b.log.Debugf("Detected WailsShutdown function: %s", fullMethodName)
|
|
||||||
b.shutdownMethods = append(b.shutdownMethods, newMethod)
|
|
||||||
} else {
|
} else {
|
||||||
// Save boundMethod
|
// Save boundMethod
|
||||||
b.log.Infof("Bound Method: %s()", fullMethodName)
|
b.log.Infof("Bound Method: %s()", fullMethodName)
|
||||||
@@ -199,11 +195,7 @@ func (b *Manager) processFunctionCall(callData *messages.CallData) (interface{},
|
|||||||
return nil, errorResult.Interface().(error)
|
return nil, errorResult.Interface().(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// fmt.Printf("result = '%+v'\n", result)
|
return result[0].Interface(), nil
|
||||||
if len(result) > 0 {
|
|
||||||
return result[0].Interface(), nil
|
|
||||||
}
|
|
||||||
return nil, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Manager) processMethodCall(callData *messages.CallData) (interface{}, error) {
|
func (b *Manager) processMethodCall(callData *messages.CallData) (interface{}, error) {
|
||||||
@@ -296,13 +288,3 @@ func (b *Manager) callWailsInitMethods() error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shutdown the binding manager
|
|
||||||
func (b *Manager) Shutdown() {
|
|
||||||
b.log.Debug("Shutdown called")
|
|
||||||
for _, method := range b.shutdownMethods {
|
|
||||||
b.log.Debugf("Calling Shutdown for method: %s", method.fullName)
|
|
||||||
method.call("[]")
|
|
||||||
}
|
|
||||||
b.log.Debug("Shutdown complete")
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ type boundMethod struct {
|
|||||||
log *logger.CustomLogger
|
log *logger.CustomLogger
|
||||||
hasErrorReturnType bool // Indicates if there is an error return type
|
hasErrorReturnType bool // Indicates if there is an error return type
|
||||||
isWailsInit bool
|
isWailsInit bool
|
||||||
isWailsShutdown bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a new bound method based on the given method + type
|
// Creates a new bound method based on the given method + type
|
||||||
@@ -40,11 +39,6 @@ func newBoundMethod(name string, fullName string, method reflect.Value, objectTy
|
|||||||
err = result.processWailsInit()
|
err = result.processWailsInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Are we a WailsShutdown method?
|
|
||||||
if result.Name == "WailsShutdown" {
|
|
||||||
err = result.processWailsShutdown()
|
|
||||||
}
|
|
||||||
|
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,20 +211,3 @@ func (b *boundMethod) processWailsInit() error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *boundMethod) processWailsShutdown() error {
|
|
||||||
// We must have only 1 input, it must be *wails.Runtime
|
|
||||||
if len(b.inputs) != 0 {
|
|
||||||
return fmt.Errorf("Invalid WailsShutdown() definition. Expected 0 inputs, but got %d", len(b.inputs))
|
|
||||||
}
|
|
||||||
|
|
||||||
// We must have only 1 output, it must be error
|
|
||||||
if len(b.returnTypes) != 0 {
|
|
||||||
return fmt.Errorf("Invalid WailsShutdown() definition. Expected 0 return types, but got %d", len(b.returnTypes))
|
|
||||||
}
|
|
||||||
|
|
||||||
// We are indeed a wails Shutdown method
|
|
||||||
b.isWailsShutdown = true
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,21 +3,18 @@ package event
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/lib/interfaces"
|
|
||||||
"github.com/wailsapp/wails/lib/logger"
|
"github.com/wailsapp/wails/lib/logger"
|
||||||
"github.com/wailsapp/wails/lib/messages"
|
"github.com/wailsapp/wails/lib/messages"
|
||||||
|
"github.com/wailsapp/wails/lib/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Manager handles and processes events
|
// Manager handles and processes events
|
||||||
type Manager struct {
|
type Manager struct {
|
||||||
incomingEvents chan *messages.EventData
|
incomingEvents chan *messages.EventData
|
||||||
listeners map[string][]*eventListener
|
listeners map[string][]*eventListener
|
||||||
running bool
|
exit bool
|
||||||
log *logger.CustomLogger
|
log *logger.CustomLogger
|
||||||
renderer interfaces.Renderer // Messages will be dispatched to the frontend
|
renderer interfaces.Renderer // Messages will be dispatched to the frontend
|
||||||
wg sync.WaitGroup
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewManager creates a new event manager with a 100 event buffer
|
// NewManager creates a new event manager with a 100 event buffer
|
||||||
@@ -25,7 +22,7 @@ func NewManager() interfaces.EventManager {
|
|||||||
return &Manager{
|
return &Manager{
|
||||||
incomingEvents: make(chan *messages.EventData, 100),
|
incomingEvents: make(chan *messages.EventData, 100),
|
||||||
listeners: make(map[string][]*eventListener),
|
listeners: make(map[string][]*eventListener),
|
||||||
running: false,
|
exit: false,
|
||||||
log: logger.NewCustomLogger("Events"),
|
log: logger.NewCustomLogger("Events"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,14 +87,15 @@ func (e *Manager) Start(renderer interfaces.Renderer) {
|
|||||||
// Store renderer
|
// Store renderer
|
||||||
e.renderer = renderer
|
e.renderer = renderer
|
||||||
|
|
||||||
// Set up waitgroup so we can wait for goroutine to quit
|
// Set up waitgroup so we can wait for goroutine to start
|
||||||
e.running = true
|
var wg sync.WaitGroup
|
||||||
e.wg.Add(1)
|
wg.Add(1)
|
||||||
|
|
||||||
// Run main loop in separate goroutine
|
// Run main loop in separate goroutine
|
||||||
go func() {
|
go func() {
|
||||||
|
wg.Done()
|
||||||
e.log.Info("Listening")
|
e.log.Info("Listening")
|
||||||
for e.running {
|
for e.exit == false {
|
||||||
// TODO: Listen for application exit
|
// TODO: Listen for application exit
|
||||||
select {
|
select {
|
||||||
case event := <-e.incomingEvents:
|
case event := <-e.incomingEvents:
|
||||||
@@ -141,18 +139,14 @@ func (e *Manager) Start(renderer interfaces.Renderer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
time.Sleep(1 * time.Millisecond)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
e.wg.Done()
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
// Wait for goroutine to start
|
||||||
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shutdown is called when exiting the Application
|
func (e *Manager) stop() {
|
||||||
func (e *Manager) Shutdown() {
|
e.exit = true
|
||||||
e.log.Debug("Shutting Down")
|
|
||||||
e.running = false
|
|
||||||
e.log.Debug("Waiting for main loop to exit")
|
|
||||||
e.wg.Wait()
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,5 +7,4 @@ type BindingManager interface {
|
|||||||
Bind(object interface{})
|
Bind(object interface{})
|
||||||
Start(renderer Renderer, runtime Runtime) error
|
Start(renderer Renderer, runtime Runtime) error
|
||||||
ProcessCall(callData *messages.CallData) (result interface{}, err error)
|
ProcessCall(callData *messages.CallData) (result interface{}, err error)
|
||||||
Shutdown()
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,5 +8,4 @@ type EventManager interface {
|
|||||||
Emit(eventName string, optionalData ...interface{})
|
Emit(eventName string, optionalData ...interface{})
|
||||||
On(eventName string, callback func(...interface{}))
|
On(eventName string, callback func(...interface{}))
|
||||||
Start(Renderer)
|
Start(Renderer)
|
||||||
Shutdown()
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,5 +5,4 @@ type IPCManager interface {
|
|||||||
BindRenderer(Renderer)
|
BindRenderer(Renderer)
|
||||||
Dispatch(message string)
|
Dispatch(message string)
|
||||||
Start(eventManager EventManager, bindingManager BindingManager)
|
Start(eventManager EventManager, bindingManager BindingManager)
|
||||||
Shutdown()
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package ipc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/lib/interfaces"
|
"github.com/wailsapp/wails/lib/interfaces"
|
||||||
"github.com/wailsapp/wails/lib/logger"
|
"github.com/wailsapp/wails/lib/logger"
|
||||||
@@ -14,20 +12,18 @@ import (
|
|||||||
type Manager struct {
|
type Manager struct {
|
||||||
renderer interfaces.Renderer // The renderer
|
renderer interfaces.Renderer // The renderer
|
||||||
messageQueue chan *ipcMessage
|
messageQueue chan *ipcMessage
|
||||||
quitChannel chan struct{}
|
// quitChannel chan struct{}
|
||||||
// signals chan os.Signal
|
// signals chan os.Signal
|
||||||
log *logger.CustomLogger
|
log *logger.CustomLogger
|
||||||
eventManager interfaces.EventManager
|
eventManager interfaces.EventManager
|
||||||
bindingManager interfaces.BindingManager
|
bindingManager interfaces.BindingManager
|
||||||
running bool
|
|
||||||
wg sync.WaitGroup
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewManager creates a new IPC Manager
|
// NewManager creates a new IPC Manager
|
||||||
func NewManager() interfaces.IPCManager {
|
func NewManager() interfaces.IPCManager {
|
||||||
result := &Manager{
|
result := &Manager{
|
||||||
messageQueue: make(chan *ipcMessage, 100),
|
messageQueue: make(chan *ipcMessage, 100),
|
||||||
quitChannel: make(chan struct{}),
|
// quitChannel: make(chan struct{}),
|
||||||
// signals: make(chan os.Signal, 1),
|
// signals: make(chan os.Signal, 1),
|
||||||
log: logger.NewCustomLogger("IPC"),
|
log: logger.NewCustomLogger("IPC"),
|
||||||
}
|
}
|
||||||
@@ -48,12 +44,9 @@ func (i *Manager) Start(eventManager interfaces.EventManager, bindingManager int
|
|||||||
|
|
||||||
i.log.Info("Starting")
|
i.log.Info("Starting")
|
||||||
// signal.Notify(manager.signals, os.Interrupt)
|
// signal.Notify(manager.signals, os.Interrupt)
|
||||||
i.running = true
|
|
||||||
|
|
||||||
// Keep track of this goroutine
|
|
||||||
i.wg.Add(1)
|
|
||||||
go func() {
|
go func() {
|
||||||
for i.running {
|
running := true
|
||||||
|
for running {
|
||||||
select {
|
select {
|
||||||
case incomingMessage := <-i.messageQueue:
|
case incomingMessage := <-i.messageQueue:
|
||||||
i.log.DebugFields("Processing message", logger.Fields{
|
i.log.DebugFields("Processing message", logger.Fields{
|
||||||
@@ -124,12 +117,15 @@ func (i *Manager) Start(eventManager interfaces.EventManager, bindingManager int
|
|||||||
i.log.DebugFields("Finished processing message", logger.Fields{
|
i.log.DebugFields("Finished processing message", logger.Fields{
|
||||||
"1D": &incomingMessage,
|
"1D": &incomingMessage,
|
||||||
})
|
})
|
||||||
default:
|
// case <-manager.quitChannel:
|
||||||
time.Sleep(1 * time.Millisecond)
|
// Debug("[MessageQueue] Quit caught")
|
||||||
|
// running = false
|
||||||
|
// case <-manager.signals:
|
||||||
|
// Debug("[MessageQueue] Signal caught")
|
||||||
|
// running = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i.log.Debug("Stopping")
|
i.log.Debug("Stopping")
|
||||||
i.wg.Done()
|
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,11 +167,3 @@ func (i *Manager) SendResponse(response *ipcResponse) error {
|
|||||||
// Call back to the front end
|
// Call back to the front end
|
||||||
return i.renderer.Callback(data)
|
return i.renderer.Callback(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shutdown is called when exiting the Application
|
|
||||||
func (i *Manager) Shutdown() {
|
|
||||||
i.log.Debug("Shutdown called")
|
|
||||||
i.running = false
|
|
||||||
i.log.Debug("Waiting of main loop shutdown")
|
|
||||||
i.wg.Wait()
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ func (h *Bridge) Run() error {
|
|||||||
h.log.Info("The frontend will connect automatically.")
|
h.log.Info("The frontend will connect automatically.")
|
||||||
|
|
||||||
err := h.server.ListenAndServe()
|
err := h.server.ListenAndServe()
|
||||||
if err != nil && err != http.ErrServerClosed {
|
if err != nil {
|
||||||
h.log.Fatal(err.Error())
|
h.log.Fatal(err.Error())
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
@@ -250,9 +250,5 @@ func (h *Bridge) SetTitle(title string) {
|
|||||||
// Close is unsupported for Bridge but required
|
// Close is unsupported for Bridge but required
|
||||||
// for the Renderer interface
|
// for the Renderer interface
|
||||||
func (h *Bridge) Close() {
|
func (h *Bridge) Close() {
|
||||||
h.log.Debug("Shutting down")
|
h.log.Warn("Close() unsupported in bridge mode")
|
||||||
err := h.server.Close()
|
|
||||||
if err != nil {
|
|
||||||
h.log.Errorf(err.Error())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -13,13 +13,13 @@ import (
|
|||||||
"github.com/wailsapp/wails/lib/interfaces"
|
"github.com/wailsapp/wails/lib/interfaces"
|
||||||
"github.com/wailsapp/wails/lib/logger"
|
"github.com/wailsapp/wails/lib/logger"
|
||||||
"github.com/wailsapp/wails/lib/messages"
|
"github.com/wailsapp/wails/lib/messages"
|
||||||
wv "github.com/wailsapp/wails/lib/renderer/webview"
|
"github.com/wailsapp/webview"
|
||||||
)
|
)
|
||||||
|
|
||||||
// WebView defines the main webview application window
|
// WebView defines the main webview application window
|
||||||
// Default values in []
|
// Default values in []
|
||||||
type WebView struct {
|
type WebView struct {
|
||||||
window wv.WebView // The webview object
|
window webview.WebView // The webview object
|
||||||
ipc interfaces.IPCManager
|
ipc interfaces.IPCManager
|
||||||
log *logger.CustomLogger
|
log *logger.CustomLogger
|
||||||
config interfaces.AppConfig
|
config interfaces.AppConfig
|
||||||
@@ -49,14 +49,14 @@ func (w *WebView) Initialise(config interfaces.AppConfig, ipc interfaces.IPCMana
|
|||||||
w.config = config
|
w.config = config
|
||||||
|
|
||||||
// Create the WebView instance
|
// Create the WebView instance
|
||||||
w.window = wv.NewWebview(wv.Settings{
|
w.window = webview.NewWebview(webview.Settings{
|
||||||
Width: config.GetWidth(),
|
Width: config.GetWidth(),
|
||||||
Height: config.GetHeight(),
|
Height: config.GetHeight(),
|
||||||
Title: config.GetTitle(),
|
Title: config.GetTitle(),
|
||||||
Resizable: config.GetResizable(),
|
Resizable: config.GetResizable(),
|
||||||
URL: config.GetDefaultHTML(),
|
URL: config.GetDefaultHTML(),
|
||||||
Debug: !config.GetDisableInspector(),
|
Debug: !config.GetDisableInspector(),
|
||||||
ExternalInvokeCallback: func(_ wv.WebView, message string) {
|
ExternalInvokeCallback: func(_ webview.WebView, message string) {
|
||||||
w.ipc.Dispatch(message)
|
w.ipc.Dispatch(message)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -170,12 +170,16 @@ func (w *WebView) Exit() {
|
|||||||
// Run the window main loop
|
// Run the window main loop
|
||||||
func (w *WebView) Run() error {
|
func (w *WebView) Run() error {
|
||||||
|
|
||||||
w.log.Info("Running...")
|
w.log.Info("Run()")
|
||||||
|
|
||||||
// Runtime assets
|
// Runtime assets
|
||||||
wailsRuntime := mewn.String("../../runtime/assets/wails.js")
|
wailsRuntime := mewn.String("../../runtime/assets/wails.js")
|
||||||
|
w.log.Info("1")
|
||||||
|
|
||||||
w.evalJS(wailsRuntime)
|
w.evalJS(wailsRuntime)
|
||||||
|
|
||||||
|
w.log.Info("2")
|
||||||
|
|
||||||
// Ping the wait channel when the wails runtime is loaded
|
// Ping the wait channel when the wails runtime is loaded
|
||||||
w.eventManager.On("wails:loaded", func(...interface{}) {
|
w.eventManager.On("wails:loaded", func(...interface{}) {
|
||||||
|
|
||||||
@@ -242,7 +246,7 @@ func (w *WebView) SelectFile() string {
|
|||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
w.window.Dispatch(func() {
|
w.window.Dispatch(func() {
|
||||||
result = w.window.Dialog(wv.DialogTypeOpen, 0, "Select File", "")
|
result = w.window.Dialog(webview.DialogTypeOpen, 0, "Select File", "")
|
||||||
wg.Done()
|
wg.Done()
|
||||||
})
|
})
|
||||||
}()
|
}()
|
||||||
@@ -260,7 +264,7 @@ func (w *WebView) SelectDirectory() string {
|
|||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
w.window.Dispatch(func() {
|
w.window.Dispatch(func() {
|
||||||
result = w.window.Dialog(wv.DialogTypeOpen, wv.DialogFlagDirectory, "Select Directory", "")
|
result = w.window.Dialog(webview.DialogTypeOpen, webview.DialogFlagDirectory, "Select Directory", "")
|
||||||
wg.Done()
|
wg.Done()
|
||||||
})
|
})
|
||||||
}()
|
}()
|
||||||
@@ -278,7 +282,7 @@ func (w *WebView) SelectSaveFile() string {
|
|||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
w.window.Dispatch(func() {
|
w.window.Dispatch(func() {
|
||||||
result = w.window.Dialog(wv.DialogTypeSave, 0, "Save file", "")
|
result = w.window.Dialog(webview.DialogTypeSave, 0, "Save file", "")
|
||||||
wg.Done()
|
wg.Done()
|
||||||
})
|
})
|
||||||
}()
|
}()
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2017 Serge Zaitsev
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
@@ -1,371 +0,0 @@
|
|||||||
// Package webview implements Go bindings to https://github.com/zserge/webview C library.
|
|
||||||
// It is a modified version of webview.go from that repository
|
|
||||||
// Bindings closely repeat the C APIs and include both, a simplified
|
|
||||||
// single-function API to just open a full-screen webview window, and a more
|
|
||||||
// advanced and featureful set of APIs, including Go-to-JavaScript bindings.
|
|
||||||
//
|
|
||||||
// The library uses gtk-webkit, Cocoa/Webkit and MSHTML (IE8..11) as a browser
|
|
||||||
// engine and supports Linux, MacOS and Windows 7..10 respectively.
|
|
||||||
//
|
|
||||||
package webview
|
|
||||||
|
|
||||||
/*
|
|
||||||
#cgo linux openbsd freebsd CFLAGS: -DWEBVIEW_GTK=1 -Wno-deprecated-declarations
|
|
||||||
#cgo linux openbsd freebsd pkg-config: gtk+-3.0 webkit2gtk-4.0
|
|
||||||
|
|
||||||
#cgo windows CFLAGS: -DWEBVIEW_WINAPI=1 -std=c99
|
|
||||||
#cgo windows LDFLAGS: -lole32 -lcomctl32 -loleaut32 -luuid -lgdi32
|
|
||||||
|
|
||||||
#cgo darwin CFLAGS: -DWEBVIEW_COCOA=1 -x objective-c
|
|
||||||
#cgo darwin LDFLAGS: -framework Cocoa -framework WebKit
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#define WEBVIEW_STATIC
|
|
||||||
#define WEBVIEW_IMPLEMENTATION
|
|
||||||
#include "webview.h"
|
|
||||||
|
|
||||||
extern void _webviewExternalInvokeCallback(void *, void *);
|
|
||||||
|
|
||||||
static inline void CgoWebViewFree(void *w) {
|
|
||||||
free((void *)((struct webview *)w)->title);
|
|
||||||
free((void *)((struct webview *)w)->url);
|
|
||||||
free(w);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void *CgoWebViewCreate(int width, int height, char *title, char *url, int resizable, int debug) {
|
|
||||||
struct webview *w = (struct webview *) calloc(1, sizeof(*w));
|
|
||||||
w->width = width;
|
|
||||||
w->height = height;
|
|
||||||
w->title = title;
|
|
||||||
w->url = url;
|
|
||||||
w->resizable = resizable;
|
|
||||||
w->debug = debug;
|
|
||||||
w->external_invoke_cb = (webview_external_invoke_cb_t) _webviewExternalInvokeCallback;
|
|
||||||
if (webview_init(w) != 0) {
|
|
||||||
CgoWebViewFree(w);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return (void *)w;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int CgoWebViewLoop(void *w, int blocking) {
|
|
||||||
return webview_loop((struct webview *)w, blocking);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void CgoWebViewTerminate(void *w) {
|
|
||||||
webview_terminate((struct webview *)w);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void CgoWebViewExit(void *w) {
|
|
||||||
webview_exit((struct webview *)w);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void CgoWebViewSetTitle(void *w, char *title) {
|
|
||||||
webview_set_title((struct webview *)w, title);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void CgoWebViewSetFullscreen(void *w, int fullscreen) {
|
|
||||||
webview_set_fullscreen((struct webview *)w, fullscreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void CgoWebViewSetColor(void *w, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
|
|
||||||
webview_set_color((struct webview *)w, r, g, b, a);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void CgoDialog(void *w, int dlgtype, int flags,
|
|
||||||
char *title, char *arg, char *res, size_t ressz) {
|
|
||||||
webview_dialog(w, dlgtype, flags,
|
|
||||||
(const char*)title, (const char*) arg, res, ressz);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int CgoWebViewEval(void *w, char *js) {
|
|
||||||
return webview_eval((struct webview *)w, js);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void CgoWebViewInjectCSS(void *w, char *css) {
|
|
||||||
webview_inject_css((struct webview *)w, css);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern void _webviewDispatchGoCallback(void *);
|
|
||||||
static inline void _webview_dispatch_cb(struct webview *w, void *arg) {
|
|
||||||
_webviewDispatchGoCallback(arg);
|
|
||||||
}
|
|
||||||
static inline void CgoWebViewDispatch(void *w, uintptr_t arg) {
|
|
||||||
webview_dispatch((struct webview *)w, _webview_dispatch_cb, (void *)arg);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
import "C"
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"runtime"
|
|
||||||
"sync"
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
// Ensure that main.main is called from the main thread
|
|
||||||
runtime.LockOSThread()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Open is a simplified API to open a single native window with a full-size webview in
|
|
||||||
// it. It can be helpful if you want to communicate with the core app using XHR
|
|
||||||
// or WebSockets (as opposed to using JavaScript bindings).
|
|
||||||
//
|
|
||||||
// Window appearance can be customized using title, width, height and resizable parameters.
|
|
||||||
// URL must be provided and can user either a http or https protocol, or be a
|
|
||||||
// local file:// URL. On some platforms "data:" URLs are also supported
|
|
||||||
// (Linux/MacOS).
|
|
||||||
func Open(title, url string, w, h int, resizable bool) error {
|
|
||||||
titleStr := C.CString(title)
|
|
||||||
defer C.free(unsafe.Pointer(titleStr))
|
|
||||||
urlStr := C.CString(url)
|
|
||||||
defer C.free(unsafe.Pointer(urlStr))
|
|
||||||
resize := C.int(0)
|
|
||||||
if resizable {
|
|
||||||
resize = C.int(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
r := C.webview(titleStr, urlStr, C.int(w), C.int(h), resize)
|
|
||||||
if r != 0 {
|
|
||||||
return errors.New("failed to create webview")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ExternalInvokeCallbackFunc is a function type that is called every time
|
|
||||||
// "window.external.invoke()" is called from JavaScript. Data is the only
|
|
||||||
// obligatory string parameter passed into the "invoke(data)" function from
|
|
||||||
// JavaScript. To pass more complex data serialized JSON or base64 encoded
|
|
||||||
// string can be used.
|
|
||||||
type ExternalInvokeCallbackFunc func(w WebView, data string)
|
|
||||||
|
|
||||||
// Settings is a set of parameters to customize the initial WebView appearance
|
|
||||||
// and behavior. It is passed into the webview.New() constructor.
|
|
||||||
type Settings struct {
|
|
||||||
// WebView main window title
|
|
||||||
Title string
|
|
||||||
// URL to open in a webview
|
|
||||||
URL string
|
|
||||||
// Window width in pixels
|
|
||||||
Width int
|
|
||||||
// Window height in pixels
|
|
||||||
Height int
|
|
||||||
// Allows/disallows window resizing
|
|
||||||
Resizable bool
|
|
||||||
// Enable debugging tools (Linux/BSD/MacOS, on Windows use Firebug)
|
|
||||||
Debug bool
|
|
||||||
// A callback that is executed when JavaScript calls "window.external.invoke()"
|
|
||||||
ExternalInvokeCallback ExternalInvokeCallbackFunc
|
|
||||||
}
|
|
||||||
|
|
||||||
// WebView is an interface that wraps the basic methods for controlling the UI
|
|
||||||
// loop, handling multithreading and providing JavaScript bindings.
|
|
||||||
type WebView interface {
|
|
||||||
// Run() starts the main UI loop until the user closes the webview window or
|
|
||||||
// Terminate() is called.
|
|
||||||
Run()
|
|
||||||
// Loop() runs a single iteration of the main UI.
|
|
||||||
Loop(blocking bool) bool
|
|
||||||
// SetTitle() changes window title. This method must be called from the main
|
|
||||||
// thread only. See Dispatch() for more details.
|
|
||||||
SetTitle(title string)
|
|
||||||
// SetFullscreen() controls window full-screen mode. This method must be
|
|
||||||
// called from the main thread only. See Dispatch() for more details.
|
|
||||||
SetFullscreen(fullscreen bool)
|
|
||||||
// SetColor() changes window background color. This method must be called from
|
|
||||||
// the main thread only. See Dispatch() for more details.
|
|
||||||
SetColor(r, g, b, a uint8)
|
|
||||||
// Eval() evaluates an arbitrary JS code inside the webview. This method must
|
|
||||||
// be called from the main thread only. See Dispatch() for more details.
|
|
||||||
Eval(js string) error
|
|
||||||
// InjectJS() injects an arbitrary block of CSS code using the JS API. This
|
|
||||||
// method must be called from the main thread only. See Dispatch() for more
|
|
||||||
// details.
|
|
||||||
InjectCSS(css string)
|
|
||||||
// Dialog() opens a system dialog of the given type and title. String
|
|
||||||
// argument can be provided for certain dialogs, such as alert boxes. For
|
|
||||||
// alert boxes argument is a message inside the dialog box.
|
|
||||||
Dialog(dlgType DialogType, flags int, title string, arg string) string
|
|
||||||
// Terminate() breaks the main UI loop. This method must be called from the main thread
|
|
||||||
// only. See Dispatch() for more details.
|
|
||||||
Terminate()
|
|
||||||
// Dispatch() schedules some arbitrary function to be executed on the main UI
|
|
||||||
// thread. This may be helpful if you want to run some JavaScript from
|
|
||||||
// background threads/goroutines, or to terminate the app.
|
|
||||||
Dispatch(func())
|
|
||||||
// Exit() closes the window and cleans up the resources. Use Terminate() to
|
|
||||||
// forcefully break out of the main UI loop.
|
|
||||||
Exit()
|
|
||||||
}
|
|
||||||
|
|
||||||
// DialogType is an enumeration of all supported system dialog types
|
|
||||||
type DialogType int
|
|
||||||
|
|
||||||
const (
|
|
||||||
// DialogTypeOpen is a system file open dialog
|
|
||||||
DialogTypeOpen DialogType = iota
|
|
||||||
// DialogTypeSave is a system file save dialog
|
|
||||||
DialogTypeSave
|
|
||||||
// DialogTypeAlert is a system alert dialog (message box)
|
|
||||||
DialogTypeAlert
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
// DialogFlagFile is a normal file picker dialog
|
|
||||||
DialogFlagFile = C.WEBVIEW_DIALOG_FLAG_FILE
|
|
||||||
// DialogFlagDirectory is an open directory dialog
|
|
||||||
DialogFlagDirectory = C.WEBVIEW_DIALOG_FLAG_DIRECTORY
|
|
||||||
// DialogFlagInfo is an info alert dialog
|
|
||||||
DialogFlagInfo = C.WEBVIEW_DIALOG_FLAG_INFO
|
|
||||||
// DialogFlagWarning is a warning alert dialog
|
|
||||||
DialogFlagWarning = C.WEBVIEW_DIALOG_FLAG_WARNING
|
|
||||||
// DialogFlagError is an error dialog
|
|
||||||
DialogFlagError = C.WEBVIEW_DIALOG_FLAG_ERROR
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
m sync.Mutex
|
|
||||||
index uintptr
|
|
||||||
fns = map[uintptr]func(){}
|
|
||||||
cbs = map[WebView]ExternalInvokeCallbackFunc{}
|
|
||||||
)
|
|
||||||
|
|
||||||
type webview struct {
|
|
||||||
w unsafe.Pointer
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ WebView = &webview{}
|
|
||||||
|
|
||||||
func boolToInt(b bool) int {
|
|
||||||
if b {
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewWebview creates and opens a new webview window using the given settings. The
|
|
||||||
// returned object implements the WebView interface. This function returns nil
|
|
||||||
// if a window can not be created.
|
|
||||||
func NewWebview(settings Settings) WebView {
|
|
||||||
if settings.Width == 0 {
|
|
||||||
settings.Width = 640
|
|
||||||
}
|
|
||||||
if settings.Height == 0 {
|
|
||||||
settings.Height = 480
|
|
||||||
}
|
|
||||||
if settings.Title == "" {
|
|
||||||
settings.Title = "WebView"
|
|
||||||
}
|
|
||||||
w := &webview{}
|
|
||||||
w.w = C.CgoWebViewCreate(C.int(settings.Width), C.int(settings.Height),
|
|
||||||
C.CString(settings.Title), C.CString(settings.URL),
|
|
||||||
C.int(boolToInt(settings.Resizable)), C.int(boolToInt(settings.Debug)))
|
|
||||||
m.Lock()
|
|
||||||
if settings.ExternalInvokeCallback != nil {
|
|
||||||
cbs[w] = settings.ExternalInvokeCallback
|
|
||||||
} else {
|
|
||||||
cbs[w] = func(w WebView, data string) {}
|
|
||||||
}
|
|
||||||
m.Unlock()
|
|
||||||
return w
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *webview) Loop(blocking bool) bool {
|
|
||||||
block := C.int(0)
|
|
||||||
if blocking {
|
|
||||||
block = 1
|
|
||||||
}
|
|
||||||
return C.CgoWebViewLoop(w.w, block) == 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *webview) Run() {
|
|
||||||
for w.Loop(true) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *webview) Exit() {
|
|
||||||
C.CgoWebViewExit(w.w)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *webview) Dispatch(f func()) {
|
|
||||||
m.Lock()
|
|
||||||
for ; fns[index] != nil; index++ {
|
|
||||||
}
|
|
||||||
fns[index] = f
|
|
||||||
m.Unlock()
|
|
||||||
C.CgoWebViewDispatch(w.w, C.uintptr_t(index))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *webview) SetTitle(title string) {
|
|
||||||
p := C.CString(title)
|
|
||||||
defer C.free(unsafe.Pointer(p))
|
|
||||||
C.CgoWebViewSetTitle(w.w, p)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *webview) SetColor(r, g, b, a uint8) {
|
|
||||||
C.CgoWebViewSetColor(w.w, C.uint8_t(r), C.uint8_t(g), C.uint8_t(b), C.uint8_t(a))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *webview) SetFullscreen(fullscreen bool) {
|
|
||||||
C.CgoWebViewSetFullscreen(w.w, C.int(boolToInt(fullscreen)))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *webview) Dialog(dlgType DialogType, flags int, title string, arg string) string {
|
|
||||||
const maxPath = 4096
|
|
||||||
titlePtr := C.CString(title)
|
|
||||||
defer C.free(unsafe.Pointer(titlePtr))
|
|
||||||
argPtr := C.CString(arg)
|
|
||||||
defer C.free(unsafe.Pointer(argPtr))
|
|
||||||
resultPtr := (*C.char)(C.calloc((C.size_t)(unsafe.Sizeof((*C.char)(nil))), (C.size_t)(maxPath)))
|
|
||||||
defer C.free(unsafe.Pointer(resultPtr))
|
|
||||||
C.CgoDialog(w.w, C.int(dlgType), C.int(flags), titlePtr,
|
|
||||||
argPtr, resultPtr, C.size_t(maxPath))
|
|
||||||
return C.GoString(resultPtr)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *webview) Eval(js string) error {
|
|
||||||
p := C.CString(js)
|
|
||||||
defer C.free(unsafe.Pointer(p))
|
|
||||||
switch C.CgoWebViewEval(w.w, p) {
|
|
||||||
case -1:
|
|
||||||
return errors.New("evaluation failed")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *webview) InjectCSS(css string) {
|
|
||||||
p := C.CString(css)
|
|
||||||
defer C.free(unsafe.Pointer(p))
|
|
||||||
C.CgoWebViewInjectCSS(w.w, p)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *webview) Terminate() {
|
|
||||||
C.CgoWebViewTerminate(w.w)
|
|
||||||
}
|
|
||||||
|
|
||||||
//export _webviewDispatchGoCallback
|
|
||||||
func _webviewDispatchGoCallback(index unsafe.Pointer) {
|
|
||||||
var f func()
|
|
||||||
m.Lock()
|
|
||||||
f = fns[uintptr(index)]
|
|
||||||
delete(fns, uintptr(index))
|
|
||||||
m.Unlock()
|
|
||||||
f()
|
|
||||||
}
|
|
||||||
|
|
||||||
//export _webviewExternalInvokeCallback
|
|
||||||
func _webviewExternalInvokeCallback(w unsafe.Pointer, data unsafe.Pointer) {
|
|
||||||
m.Lock()
|
|
||||||
var (
|
|
||||||
cb ExternalInvokeCallbackFunc
|
|
||||||
wv WebView
|
|
||||||
)
|
|
||||||
for wv, cb = range cbs {
|
|
||||||
if wv.(*webview).w == w {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m.Unlock()
|
|
||||||
cb(wv, C.GoString((*C.char)(data)))
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -95,6 +95,13 @@ function startBridge() {
|
|||||||
window.wailsbridge.reconnectOverlay.style.display = 'none';
|
window.wailsbridge.reconnectOverlay.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bridge external.invoke
|
||||||
|
window.external = {
|
||||||
|
invoke: function (msg) {
|
||||||
|
window.wailsbridge.websocket.send(msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Adds a script to the Dom.
|
// Adds a script to the Dom.
|
||||||
// Removes it if second parameter is true.
|
// Removes it if second parameter is true.
|
||||||
function addScript(script, remove) {
|
function addScript(script, remove) {
|
||||||
@@ -207,4 +214,4 @@ function Init(callback) {
|
|||||||
start(callback);
|
start(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Init;
|
module.exports = { Init };
|
||||||
File diff suppressed because one or more lines are too long
@@ -15,7 +15,10 @@
|
|||||||
"error",
|
"error",
|
||||||
"tab"
|
"tab"
|
||||||
],
|
],
|
||||||
"linebreak-style": 0,
|
"linebreak-style": [
|
||||||
|
"error",
|
||||||
|
"unix"
|
||||||
|
],
|
||||||
"quotes": [
|
"quotes": [
|
||||||
"error",
|
"error",
|
||||||
"single"
|
"single"
|
||||||
|
|||||||
@@ -46,15 +46,13 @@ export function NewBinding(bindingName) {
|
|||||||
// Check if we have a path (IE Struct)
|
// Check if we have a path (IE Struct)
|
||||||
if (bindingSections.length > 1) {
|
if (bindingSections.length > 1) {
|
||||||
// Iterate over binding sections, adding them to the window.backend object
|
// Iterate over binding sections, adding them to the window.backend object
|
||||||
for (let index = 0; index < bindingSections.length-1; index += 1) {
|
for (let index = 0; index < bindingSections.length - 1; index += 1) {
|
||||||
const name = bindingSections[index];
|
const name = bindingSections[index];
|
||||||
// Is name a valid javascript identifier?
|
// Is name a valid javascript identifier?
|
||||||
if (!isValidIdentifier(name)) {
|
if (!isValidIdentifier(name)) {
|
||||||
return new Error(`${name} is not a valid javascript identifier.`);
|
return new Error(`${name} is not a valid javascript identifier.`);
|
||||||
}
|
}
|
||||||
if (!pathToBinding[name]) {
|
pathToBinding[name] = {};
|
||||||
pathToBinding[name] = {};
|
|
||||||
}
|
|
||||||
pathToBinding = pathToBinding[name];
|
pathToBinding = pathToBinding[name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,11 +15,7 @@ The lightweight framework for web-like apps
|
|||||||
* @param {string} message
|
* @param {string} message
|
||||||
*/
|
*/
|
||||||
function Invoke(message) {
|
function Invoke(message) {
|
||||||
if ( window.wailsbridge ) {
|
window.external.invoke(message);
|
||||||
window.wailsbridge.websocket.send(message);
|
|
||||||
} else {
|
|
||||||
window.external.invoke(message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ The lightweight framework for web-like apps
|
|||||||
/* jshint esversion: 6 */
|
/* jshint esversion: 6 */
|
||||||
import * as Log from './log';
|
import * as Log from './log';
|
||||||
import * as Browser from './browser';
|
import * as Browser from './browser';
|
||||||
import { On, OnMultiple, Emit, Notify, Heartbeat, Acknowledge } from './events';
|
import { On, Emit, Notify, Heartbeat, Acknowledge } from './events';
|
||||||
import { NewBinding } from './bindings';
|
import { NewBinding } from './bindings';
|
||||||
import { Callback } from './calls';
|
import { Callback } from './calls';
|
||||||
import { AddScript, InjectCSS } from './utils';
|
import { AddScript, InjectCSS } from './utils';
|
||||||
@@ -35,7 +35,6 @@ var runtime = {
|
|||||||
Browser,
|
Browser,
|
||||||
Events: {
|
Events: {
|
||||||
On,
|
On,
|
||||||
OnMultiple,
|
|
||||||
Emit,
|
Emit,
|
||||||
Heartbeat,
|
Heartbeat,
|
||||||
Acknowledge,
|
Acknowledge,
|
||||||
@@ -46,16 +45,6 @@ var runtime = {
|
|||||||
// Augment global
|
// Augment global
|
||||||
Object.assign(window.wails, runtime);
|
Object.assign(window.wails, runtime);
|
||||||
|
|
||||||
// Setup global error handler
|
|
||||||
window.onerror = function (msg, url, lineNo, columnNo, error) {
|
|
||||||
window.wails.Log.Error('**** Caught Unhandled Error ****');
|
|
||||||
window.wails.Log.Error('Message: ' + msg);
|
|
||||||
window.wails.Log.Error('URL: ' + url);
|
|
||||||
window.wails.Log.Error('Line No: ' + lineNo);
|
|
||||||
window.wails.Log.Error('Column No: ' + columnNo);
|
|
||||||
window.wails.Log.Error('error: ' + error);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Emit loaded event
|
// Emit loaded event
|
||||||
Emit('wails:loaded');
|
Emit('wails:loaded');
|
||||||
|
|
||||||
|
|||||||
262
runtime/js/package-lock.json
generated
262
runtime/js/package-lock.json
generated
@@ -56,15 +56,13 @@
|
|||||||
"version": "0.3.2",
|
"version": "0.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz",
|
||||||
"integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=",
|
"integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"braces": {
|
"braces": {
|
||||||
"version": "2.3.2",
|
"version": "2.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz",
|
||||||
"integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
|
"integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"arr-flatten": "^1.1.0",
|
"arr-flatten": "^1.1.0",
|
||||||
"array-unique": "^0.3.2",
|
"array-unique": "^0.3.2",
|
||||||
@@ -83,7 +81,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
|
||||||
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
|
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"is-extendable": "^0.1.0"
|
"is-extendable": "^0.1.0"
|
||||||
}
|
}
|
||||||
@@ -256,7 +253,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
|
||||||
"integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=",
|
"integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"extend-shallow": "^2.0.1",
|
"extend-shallow": "^2.0.1",
|
||||||
"is-number": "^3.0.0",
|
"is-number": "^3.0.0",
|
||||||
@@ -269,7 +265,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
|
||||||
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
|
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"is-extendable": "^0.1.0"
|
"is-extendable": "^0.1.0"
|
||||||
}
|
}
|
||||||
@@ -335,8 +330,7 @@
|
|||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
||||||
"integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
|
"integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"is-glob": {
|
"is-glob": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
@@ -353,7 +347,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
|
||||||
"integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
|
"integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"kind-of": "^3.0.2"
|
"kind-of": "^3.0.2"
|
||||||
},
|
},
|
||||||
@@ -363,7 +356,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
|
||||||
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
|
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"is-buffer": "^1.1.5"
|
"is-buffer": "^1.1.5"
|
||||||
}
|
}
|
||||||
@@ -374,15 +366,13 @@
|
|||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
|
||||||
"integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
|
"integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"kind-of": {
|
"kind-of": {
|
||||||
"version": "6.0.2",
|
"version": "6.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
|
||||||
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",
|
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"micromatch": {
|
"micromatch": {
|
||||||
"version": "3.1.10",
|
"version": "3.1.10",
|
||||||
@@ -1650,9 +1640,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"acorn-jsx": {
|
"acorn-jsx": {
|
||||||
"version": "5.0.2",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.1.tgz",
|
||||||
"integrity": "sha512-tiNTrP1MP0QrChmD2DdupCr6HWSFeKVw5d/dHTu4Y7rkAkRhU/Dt7dphAfIUyxtHpl/eBVip5uTNSpQJHylpAw==",
|
"integrity": "sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"ajv": {
|
"ajv": {
|
||||||
@@ -2891,9 +2881,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"eslint": {
|
"eslint": {
|
||||||
"version": "6.5.1",
|
"version": "6.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-6.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-6.0.1.tgz",
|
||||||
"integrity": "sha512-32h99BoLYStT1iq1v2P9uwpyznQ4M2jRiFB6acitKz52Gqn+vPaMDUTB1bYi1WN4Nquj2w+t+bimYUG83DC55A==",
|
"integrity": "sha512-DyQRaMmORQ+JsWShYsSg4OPTjY56u1nCjAmICrE8vLWqyLKxhFXOthwMj1SA8xwfrv0CofLNVnqbfyhwCkaO0w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/code-frame": "^7.0.0",
|
"@babel/code-frame": "^7.0.0",
|
||||||
@@ -2902,37 +2892,36 @@
|
|||||||
"cross-spawn": "^6.0.5",
|
"cross-spawn": "^6.0.5",
|
||||||
"debug": "^4.0.1",
|
"debug": "^4.0.1",
|
||||||
"doctrine": "^3.0.0",
|
"doctrine": "^3.0.0",
|
||||||
"eslint-scope": "^5.0.0",
|
"eslint-scope": "^4.0.3",
|
||||||
"eslint-utils": "^1.4.2",
|
"eslint-utils": "^1.3.1",
|
||||||
"eslint-visitor-keys": "^1.1.0",
|
"eslint-visitor-keys": "^1.0.0",
|
||||||
"espree": "^6.1.1",
|
"espree": "^6.0.0",
|
||||||
"esquery": "^1.0.1",
|
"esquery": "^1.0.1",
|
||||||
"esutils": "^2.0.2",
|
"esutils": "^2.0.2",
|
||||||
"file-entry-cache": "^5.0.1",
|
"file-entry-cache": "^5.0.1",
|
||||||
"functional-red-black-tree": "^1.0.1",
|
"functional-red-black-tree": "^1.0.1",
|
||||||
"glob-parent": "^5.0.0",
|
"glob-parent": "^3.1.0",
|
||||||
"globals": "^11.7.0",
|
"globals": "^11.7.0",
|
||||||
"ignore": "^4.0.6",
|
"ignore": "^4.0.6",
|
||||||
"import-fresh": "^3.0.0",
|
"import-fresh": "^3.0.0",
|
||||||
"imurmurhash": "^0.1.4",
|
"imurmurhash": "^0.1.4",
|
||||||
"inquirer": "^6.4.1",
|
"inquirer": "^6.2.2",
|
||||||
"is-glob": "^4.0.0",
|
"is-glob": "^4.0.0",
|
||||||
"js-yaml": "^3.13.1",
|
"js-yaml": "^3.13.1",
|
||||||
"json-stable-stringify-without-jsonify": "^1.0.1",
|
"json-stable-stringify-without-jsonify": "^1.0.1",
|
||||||
"levn": "^0.3.0",
|
"levn": "^0.3.0",
|
||||||
"lodash": "^4.17.14",
|
"lodash": "^4.17.11",
|
||||||
"minimatch": "^3.0.4",
|
"minimatch": "^3.0.4",
|
||||||
"mkdirp": "^0.5.1",
|
"mkdirp": "^0.5.1",
|
||||||
"natural-compare": "^1.4.0",
|
"natural-compare": "^1.4.0",
|
||||||
"optionator": "^0.8.2",
|
"optionator": "^0.8.2",
|
||||||
"progress": "^2.0.0",
|
"progress": "^2.0.0",
|
||||||
"regexpp": "^2.0.1",
|
"regexpp": "^2.0.1",
|
||||||
"semver": "^6.1.2",
|
"semver": "^5.5.1",
|
||||||
"strip-ansi": "^5.2.0",
|
"strip-ansi": "^4.0.0",
|
||||||
"strip-json-comments": "^3.0.1",
|
"strip-json-comments": "^2.0.1",
|
||||||
"table": "^5.2.3",
|
"table": "^5.2.3",
|
||||||
"text-table": "^0.2.0",
|
"text-table": "^0.2.0"
|
||||||
"v8-compile-cache": "^2.0.3"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": {
|
"debug": {
|
||||||
@@ -2944,33 +2933,11 @@
|
|||||||
"ms": "^2.1.1"
|
"ms": "^2.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eslint-scope": {
|
|
||||||
"version": "5.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz",
|
|
||||||
"integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"esrecurse": "^4.1.0",
|
|
||||||
"estraverse": "^4.1.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lodash": {
|
|
||||||
"version": "4.17.15",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
|
||||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"ms": {
|
"ms": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
|
||||||
"semver": {
|
|
||||||
"version": "6.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
|
||||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
|
||||||
"dev": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -2985,37 +2952,26 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eslint-utils": {
|
"eslint-utils": {
|
||||||
"version": "1.4.2",
|
"version": "1.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz",
|
||||||
"integrity": "sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q==",
|
"integrity": "sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"requires": {
|
|
||||||
"eslint-visitor-keys": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"eslint-visitor-keys": {
|
"eslint-visitor-keys": {
|
||||||
"version": "1.1.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz",
|
||||||
"integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==",
|
"integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"espree": {
|
"espree": {
|
||||||
"version": "6.1.1",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/espree/-/espree-6.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/espree/-/espree-6.0.0.tgz",
|
||||||
"integrity": "sha512-EYbr8XZUhWbYCqQRW0duU5LxzL5bETN6AjKBGy1302qqzPaCH10QbRg3Wvco79Z8x9WbiE8HYB4e75xl6qUYvQ==",
|
"integrity": "sha512-lJvCS6YbCn3ImT3yKkPe0+tJ+mH6ljhGNjHQH9mRtiO6gjhVAOhVXW1yjnwqGwTkK3bGbye+hb00nFNmu0l/1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"acorn": "^7.0.0",
|
"acorn": "^6.0.7",
|
||||||
"acorn-jsx": "^5.0.2",
|
"acorn-jsx": "^5.0.0",
|
||||||
"eslint-visitor-keys": "^1.1.0"
|
"eslint-visitor-keys": "^1.0.0"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"acorn": {
|
|
||||||
"version": "7.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz",
|
|
||||||
"integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==",
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"esprima": {
|
"esprima": {
|
||||||
@@ -3587,8 +3543,7 @@
|
|||||||
"ansi-regex": {
|
"ansi-regex": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"aproba": {
|
"aproba": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
@@ -3609,14 +3564,12 @@
|
|||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"brace-expansion": {
|
"brace-expansion": {
|
||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"balanced-match": "^1.0.0",
|
"balanced-match": "^1.0.0",
|
||||||
"concat-map": "0.0.1"
|
"concat-map": "0.0.1"
|
||||||
@@ -3631,20 +3584,17 @@
|
|||||||
"code-point-at": {
|
"code-point-at": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"concat-map": {
|
"concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"console-control-strings": {
|
"console-control-strings": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"core-util-is": {
|
"core-util-is": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
@@ -3761,8 +3711,7 @@
|
|||||||
"inherits": {
|
"inherits": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"ini": {
|
"ini": {
|
||||||
"version": "1.3.5",
|
"version": "1.3.5",
|
||||||
@@ -3774,7 +3723,6 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"number-is-nan": "^1.0.0"
|
"number-is-nan": "^1.0.0"
|
||||||
}
|
}
|
||||||
@@ -3789,7 +3737,6 @@
|
|||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
}
|
}
|
||||||
@@ -3797,14 +3744,12 @@
|
|||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "0.0.8",
|
"version": "0.0.8",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"minipass": {
|
"minipass": {
|
||||||
"version": "2.3.5",
|
"version": "2.3.5",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"safe-buffer": "^5.1.2",
|
"safe-buffer": "^5.1.2",
|
||||||
"yallist": "^3.0.0"
|
"yallist": "^3.0.0"
|
||||||
@@ -3823,7 +3768,6 @@
|
|||||||
"version": "0.5.1",
|
"version": "0.5.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"minimist": "0.0.8"
|
"minimist": "0.0.8"
|
||||||
}
|
}
|
||||||
@@ -3904,8 +3848,7 @@
|
|||||||
"number-is-nan": {
|
"number-is-nan": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"object-assign": {
|
"object-assign": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.1",
|
||||||
@@ -3917,7 +3860,6 @@
|
|||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
}
|
}
|
||||||
@@ -4003,8 +3945,7 @@
|
|||||||
"safe-buffer": {
|
"safe-buffer": {
|
||||||
"version": "5.1.2",
|
"version": "5.1.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"safer-buffer": {
|
"safer-buffer": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
@@ -4040,7 +3981,6 @@
|
|||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"code-point-at": "^1.0.0",
|
"code-point-at": "^1.0.0",
|
||||||
"is-fullwidth-code-point": "^1.0.0",
|
"is-fullwidth-code-point": "^1.0.0",
|
||||||
@@ -4060,7 +4000,6 @@
|
|||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-regex": "^2.0.0"
|
"ansi-regex": "^2.0.0"
|
||||||
}
|
}
|
||||||
@@ -4104,14 +4043,12 @@
|
|||||||
"wrappy": {
|
"wrappy": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"yallist": {
|
"yallist": {
|
||||||
"version": "3.0.3",
|
"version": "3.0.3",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -4163,12 +4100,24 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"glob-parent": {
|
"glob-parent": {
|
||||||
"version": "5.1.0",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz",
|
||||||
"integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==",
|
"integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"is-glob": "^4.0.1"
|
"is-glob": "^3.1.0",
|
||||||
|
"path-dirname": "^1.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"is-glob": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz",
|
||||||
|
"integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"is-extglob": "^2.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"global-modules": {
|
"global-modules": {
|
||||||
@@ -4426,9 +4375,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"inquirer": {
|
"inquirer": {
|
||||||
"version": "6.5.2",
|
"version": "6.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.4.1.tgz",
|
||||||
"integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==",
|
"integrity": "sha512-/Jw+qPZx4EDYsaT6uz7F4GJRNFMRdKNeUZw3ZnKV8lyuUgz/YWRCSUAJMZSVhSq4Ec0R2oYnyi6b3d4JXcL5Nw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-escapes": "^3.2.0",
|
"ansi-escapes": "^3.2.0",
|
||||||
@@ -4437,7 +4386,7 @@
|
|||||||
"cli-width": "^2.0.0",
|
"cli-width": "^2.0.0",
|
||||||
"external-editor": "^3.0.3",
|
"external-editor": "^3.0.3",
|
||||||
"figures": "^2.0.0",
|
"figures": "^2.0.0",
|
||||||
"lodash": "^4.17.12",
|
"lodash": "^4.17.11",
|
||||||
"mute-stream": "0.0.7",
|
"mute-stream": "0.0.7",
|
||||||
"run-async": "^2.2.0",
|
"run-async": "^2.2.0",
|
||||||
"rxjs": "^6.4.0",
|
"rxjs": "^6.4.0",
|
||||||
@@ -4446,12 +4395,6 @@
|
|||||||
"through": "^2.3.6"
|
"through": "^2.3.6"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lodash": {
|
|
||||||
"version": "4.17.15",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
|
||||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"string-width": {
|
"string-width": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
|
||||||
@@ -4472,6 +4415,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"strip-ansi": {
|
||||||
|
"version": "5.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
|
||||||
|
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"ansi-regex": "^4.1.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-regex": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -6001,9 +5961,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rxjs": {
|
"rxjs": {
|
||||||
"version": "6.5.3",
|
"version": "6.5.2",
|
||||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.2.tgz",
|
||||||
"integrity": "sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA==",
|
"integrity": "sha512-HUb7j3kvb7p7eCUHE3FqjoDsC1xfZQ4AHFWfTKSpZ+sAhhz5X1WX0ZuUqWbzB2QhSLp3DoLUG+hMdEDKqWo2Zg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"tslib": "^1.9.0"
|
"tslib": "^1.9.0"
|
||||||
@@ -6391,20 +6351,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"strip-ansi": {
|
"strip-ansi": {
|
||||||
"version": "5.2.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
|
||||||
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
|
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-regex": "^4.1.0"
|
"ansi-regex": "^3.0.0"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-regex": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"strip-eof": {
|
"strip-eof": {
|
||||||
@@ -6414,9 +6366,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"strip-json-comments": {
|
"strip-json-comments": {
|
||||||
"version": "3.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
|
||||||
"integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==",
|
"integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"supports-color": {
|
"supports-color": {
|
||||||
@@ -6429,35 +6381,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"table": {
|
"table": {
|
||||||
"version": "5.4.6",
|
"version": "5.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz",
|
"resolved": "https://registry.npmjs.org/table/-/table-5.4.1.tgz",
|
||||||
"integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==",
|
"integrity": "sha512-E6CK1/pZe2N75rGZQotFOdmzWQ1AILtgYbMAbAjvms0S1l5IDB47zG3nCnFGB/w+7nB3vKofbLXCH7HPBo864w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ajv": "^6.10.2",
|
"ajv": "^6.9.1",
|
||||||
"lodash": "^4.17.14",
|
"lodash": "^4.17.11",
|
||||||
"slice-ansi": "^2.1.0",
|
"slice-ansi": "^2.1.0",
|
||||||
"string-width": "^3.0.0"
|
"string-width": "^3.0.0"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"ajv": {
|
|
||||||
"version": "6.10.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz",
|
|
||||||
"integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"fast-deep-equal": "^2.0.1",
|
|
||||||
"fast-json-stable-stringify": "^2.0.0",
|
|
||||||
"json-schema-traverse": "^0.4.1",
|
|
||||||
"uri-js": "^4.2.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lodash": {
|
|
||||||
"version": "4.17.15",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
|
||||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tapable": {
|
"tapable": {
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
"description": "The Javascript Wails Runtime",
|
"description": "The Javascript Wails Runtime",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "./node_modules/.bin/eslint core/ && npm run build:prod",
|
"build": "eslint core/ && npm run build:prod",
|
||||||
"build:prod": "./node_modules/.bin/webpack --env prod --colors",
|
"build:prod": "webpack --env prod --colors",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
"babel-loader": "^8.0.6",
|
"babel-loader": "^8.0.6",
|
||||||
"babel-preset-minify": "^0.5.0",
|
"babel-preset-minify": "^0.5.0",
|
||||||
"core-js": "^3.1.4",
|
"core-js": "^3.1.4",
|
||||||
"eslint": "^6.5.1",
|
"eslint": "^6.0.1",
|
||||||
"webpack": "^4.35.3",
|
"webpack": "^4.35.3",
|
||||||
"webpack-cli": "^3.3.5"
|
"webpack-cli": "^3.3.5"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,6 @@ function OpenFile(filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
OpenURL: OpenURL,
|
OpenURL,
|
||||||
OpenFile: OpenFile
|
OpenFile
|
||||||
};
|
};
|
||||||
@@ -61,9 +61,9 @@ function Emit(eventName) {
|
|||||||
* the event is acknowledged via `Event.Acknowledge`. Once this happens, `callback` is invoked ONCE
|
* the event is acknowledged via `Event.Acknowledge`. Once this happens, `callback` is invoked ONCE
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @param {string} eventName
|
* @param {*} eventName
|
||||||
* @param {number} timeInMilliseconds
|
* @param {*} timeInMilliseconds
|
||||||
* @param {function} callback
|
* @param {*} callback
|
||||||
*/
|
*/
|
||||||
function Heartbeat(eventName, timeInMilliseconds, callback) {
|
function Heartbeat(eventName, timeInMilliseconds, callback) {
|
||||||
window.wails.Events.Heartbeat(eventName, timeInMilliseconds, callback);
|
window.wails.Events.Heartbeat(eventName, timeInMilliseconds, callback);
|
||||||
@@ -80,10 +80,10 @@ function Acknowledge(eventName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
OnMultiple: OnMultiple,
|
OnMultiple,
|
||||||
On: On,
|
On,
|
||||||
Once: Once,
|
Once,
|
||||||
Emit: Emit,
|
Emit,
|
||||||
Heartbeat: Heartbeat,
|
Heartbeat,
|
||||||
Acknowledge: Acknowledge
|
Acknowledge
|
||||||
};
|
};
|
||||||
@@ -18,4 +18,6 @@ function Init(callback) {
|
|||||||
window.wails._.Init(callback);
|
window.wails._.Init(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Init;
|
module.exports = {
|
||||||
|
Init
|
||||||
|
};
|
||||||
@@ -62,9 +62,9 @@ function Fatal(message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
Debug: Debug,
|
Debug,
|
||||||
Info: Info,
|
Info,
|
||||||
Warning: Warning,
|
Warning,
|
||||||
Error: Error,
|
Error,
|
||||||
Fatal: Fatal
|
Fatal
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ const Events = require('./events');
|
|||||||
const Init = require('./init');
|
const Init = require('./init');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
Log: Log,
|
Log,
|
||||||
Browser: Browser,
|
Browser,
|
||||||
Events: Events,
|
Events,
|
||||||
Init: Init
|
Init
|
||||||
};
|
};
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "@wailsapp/runtime",
|
"name": "@wailsapp/runtime",
|
||||||
"version": "1.0.9",
|
"version": "1.0.2",
|
||||||
"description": "Wails Javascript runtime library",
|
"description": "Wails Javascript runtime library",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"types": "runtime.d.ts",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
@@ -21,8 +20,5 @@
|
|||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/wailsapp/wails/issues"
|
"url": "https://github.com/wailsapp/wails/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/wailsapp/wails#readme",
|
"homepage": "https://github.com/wailsapp/wails#readme"
|
||||||
"devDependencies": {
|
|
||||||
"dts-gen": "^0.5.8"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
26
runtime/js/runtime/runtime.d.ts
vendored
26
runtime/js/runtime/runtime.d.ts
vendored
@@ -1,26 +0,0 @@
|
|||||||
export = wailsapp__runtime;
|
|
||||||
|
|
||||||
declare const wailsapp__runtime: {
|
|
||||||
Browser: {
|
|
||||||
OpenFile(filename: string): Promise<any>;
|
|
||||||
OpenURL(url: string): Promise<any>;
|
|
||||||
};
|
|
||||||
Events: {
|
|
||||||
Acknowledge(eventName: string): void;
|
|
||||||
Emit(eventName: string): void;
|
|
||||||
Heartbeat(eventName: string, timeInMilliseconds: number, callback: () => void): void;
|
|
||||||
On(eventName: string, callback: () => void): void;
|
|
||||||
OnMultiple(eventName: string, callback: () => void, maxCallbacks: number): void;
|
|
||||||
Once(eventName: string, callback: () => void): void;
|
|
||||||
};
|
|
||||||
Init(callback: () => void): void;
|
|
||||||
Log: {
|
|
||||||
Debug(message: string): void;
|
|
||||||
Error(message: string): void;
|
|
||||||
Fatal(message: string): void;
|
|
||||||
Info(message: string): void;
|
|
||||||
Warning(message: string): void;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,54 +1,6 @@
|
|||||||
package runtime
|
package runtime
|
||||||
|
|
||||||
import (
|
import "github.com/wailsapp/wails/lib/interfaces"
|
||||||
"bytes"
|
|
||||||
"runtime"
|
|
||||||
|
|
||||||
"github.com/abadojack/whatlanggo"
|
|
||||||
"github.com/wailsapp/wails/lib/interfaces"
|
|
||||||
"golang.org/x/text/encoding"
|
|
||||||
"golang.org/x/text/encoding/japanese"
|
|
||||||
"golang.org/x/text/encoding/korean"
|
|
||||||
"golang.org/x/text/encoding/simplifiedchinese"
|
|
||||||
"golang.org/x/text/transform"
|
|
||||||
)
|
|
||||||
|
|
||||||
func detectEncoding(text string) (encoding.Encoding, string) {
|
|
||||||
// korean
|
|
||||||
var enc encoding.Encoding
|
|
||||||
info := whatlanggo.Detect(text)
|
|
||||||
//fmt.Println("Language:", info.Lang.String(), " Script:", whatlanggo.Scripts[info.Script], " Confidence: ", info.Confidence)
|
|
||||||
switch info.Lang.String() {
|
|
||||||
case "Korean":
|
|
||||||
enc = korean.EUCKR
|
|
||||||
case "Mandarin":
|
|
||||||
enc = simplifiedchinese.GBK
|
|
||||||
case "Japanese":
|
|
||||||
enc = japanese.EUCJP
|
|
||||||
}
|
|
||||||
return enc, info.Lang.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
// ProcessEncoding attempts to convert CKJ strings to UTF-8
|
|
||||||
func ProcessEncoding(text string) string {
|
|
||||||
if runtime.GOOS != "windows" {
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
|
|
||||||
encoding, _ := detectEncoding(text)
|
|
||||||
if encoding != nil {
|
|
||||||
var bufs bytes.Buffer
|
|
||||||
wr := transform.NewWriter(&bufs, encoding.NewEncoder())
|
|
||||||
_, err := wr.Write([]byte(text))
|
|
||||||
defer wr.Close()
|
|
||||||
if err != nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
return bufs.String()
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
|
|
||||||
// Window exposes an interface for manipulating the window
|
// Window exposes an interface for manipulating the window
|
||||||
type Window struct {
|
type Window struct {
|
||||||
@@ -79,7 +31,6 @@ func (r *Window) UnFullscreen() {
|
|||||||
|
|
||||||
// SetTitle sets the the window title
|
// SetTitle sets the the window title
|
||||||
func (r *Window) SetTitle(title string) {
|
func (r *Window) SetTitle(title string) {
|
||||||
title = ProcessEncoding(title)
|
|
||||||
r.renderer.SetTitle(title)
|
r.renderer.SetTitle(title)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"os/exec"
|
|
||||||
"path/filepath"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Default target to run when none is specified
|
|
||||||
// If not set, running mage will list available targets
|
|
||||||
// var Default = Build
|
|
||||||
|
|
||||||
/*
|
|
||||||
# Build runtime
|
|
||||||
echo "**** Building Runtime ****"
|
|
||||||
cd runtime/js
|
|
||||||
npm install
|
|
||||||
npm run build
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo "**** Packing Assets ****"
|
|
||||||
cd cmd
|
|
||||||
mewn
|
|
||||||
cd ..
|
|
||||||
cd lib/renderer
|
|
||||||
mewn
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo "**** Installing Wails locally ****"
|
|
||||||
cd cmd/wails
|
|
||||||
go install
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo "**** Tidying the mods! ****"
|
|
||||||
go mod tidy
|
|
||||||
|
|
||||||
echo "**** WE ARE DONE! ****"
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
func runCommand(command string, args ...string) {
|
|
||||||
cmd := exec.Command(command, args...)
|
|
||||||
output, err := cmd.CombinedOutput()
|
|
||||||
if err != nil {
|
|
||||||
log.Println(string(output))
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
cmd.Run()
|
|
||||||
fmt.Println(string(output))
|
|
||||||
}
|
|
||||||
|
|
||||||
// A build step that requires additional params, or platform specific steps for example
|
|
||||||
func main() {
|
|
||||||
|
|
||||||
dir, _ := os.Getwd()
|
|
||||||
|
|
||||||
// Build Runtime
|
|
||||||
fmt.Println("**** Building Runtime ****")
|
|
||||||
runtimeDir, _ := filepath.Abs(filepath.Join(dir, "..", "runtime", "js"))
|
|
||||||
os.Chdir(runtimeDir)
|
|
||||||
runCommand("npm", "install")
|
|
||||||
runCommand("npm", "run", "build")
|
|
||||||
|
|
||||||
// Pack assets
|
|
||||||
fmt.Println("**** Packing Assets ****")
|
|
||||||
rendererDir, _ := filepath.Abs(filepath.Join(dir, "..", "lib", "renderer"))
|
|
||||||
os.Chdir(rendererDir)
|
|
||||||
runCommand("mewn")
|
|
||||||
cmdDir, _ := filepath.Abs(filepath.Join(dir, "..", "cmd"))
|
|
||||||
os.Chdir(cmdDir)
|
|
||||||
runCommand("mewn")
|
|
||||||
|
|
||||||
// Install Wails
|
|
||||||
fmt.Println("**** Installing Wails locally ****")
|
|
||||||
execDir, _ := filepath.Abs(filepath.Join(dir, "..", "cmd", "wails"))
|
|
||||||
os.Chdir(execDir)
|
|
||||||
runCommand("go", "install")
|
|
||||||
|
|
||||||
baseDir, _ := filepath.Abs(filepath.Join(dir, ".."))
|
|
||||||
os.Chdir(baseDir)
|
|
||||||
runCommand("go", "mod", "tidy")
|
|
||||||
}
|
|
||||||
@@ -3,17 +3,11 @@
|
|||||||
# Build runtime
|
# Build runtime
|
||||||
echo "**** Building Runtime ****"
|
echo "**** Building Runtime ****"
|
||||||
cd runtime/js
|
cd runtime/js
|
||||||
npm install
|
|
||||||
npm run build
|
npm run build
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
echo "**** Packing Assets ****"
|
echo "**** Packing Assets ****"
|
||||||
cd cmd
|
|
||||||
mewn
|
mewn
|
||||||
cd ..
|
|
||||||
cd lib/renderer
|
|
||||||
mewn
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo "**** Installing Wails locally ****"
|
echo "**** Installing Wails locally ****"
|
||||||
cd cmd/wails
|
cd cmd/wails
|
||||||
|
|||||||
4
wails-mewn.go
Normal file
4
wails-mewn.go
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
package wails
|
||||||
|
|
||||||
|
// Autogenerated by Mewn - Do not alter
|
||||||
|
|
||||||
Reference in New Issue
Block a user