mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 06:50:22 +08:00
Feature/1.16 (#646)
* Initial support for embed * Security (#644) * Bump y18n from 3.2.1 to 3.2.2 in /runtime/js/runtime (#639) * Create FUNDING.yml * Update README.md * Bump y18n from 3.2.1 to 3.2.2 in /runtime/js/runtime Bumps [y18n](https://github.com/yargs/y18n) from 3.2.1 to 3.2.2. - [Release notes](https://github.com/yargs/y18n/releases) - [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/yargs/y18n/commits) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Lea Anthony <lea.anthony@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump elliptic from 6.5.3 to 6.5.4 in /runtime/js (#617) Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.3 to 6.5.4. - [Release notes](https://github.com/indutny/elliptic/releases) - [Commits](https://github.com/indutny/elliptic/compare/v6.5.3...v6.5.4) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump y18n from 4.0.0 to 4.0.1 in /runtime/js (#643) * Create FUNDING.yml * Update README.md * Updated sponsors * Consistent styling of README.md * Bump y18n from 4.0.0 to 4.0.1 in /runtime/js (#638) Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1. - [Release notes](https://github.com/yargs/y18n/releases) - [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/yargs/y18n/commits) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Revert "Bump y18n from 4.0.0 to 4.0.1 in /runtime/js (#638)" (#642) This reverts commit17b28a26bd
. * Bump y18n from 4.0.0 to 4.0.1 in /runtime/js Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1. - [Release notes](https://github.com/yargs/y18n/releases) - [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/yargs/y18n/commits) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Lea Anthony <lea.anthony@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Support for minimum and maximum window sizes (#612) * add support for minimum and maximum window sizes * attempt to fix windows * bug fixes * support min/max window sizes on Linux and Windows * fix min/max window sizes on Linux * formatting and comments * fixes Windows DPI issue, clamps width/height values to min/max * App can't go into full screen when max size is set for Mac * fixed Linux maximum width/height on window maximize * Revert "fixed Linux maximum width/height on window maximize" This reverts commit3f7ba8b264
. The fix glitches on PopOS Co-authored-by: Lea Anthony <lea.anthony@gmail.com> * v1.13.0 * Remove mewn. Update templates. Remove logging. * Import embed in templates! * Fix react import path * Update README.md * Updated sponsors * Consistent styling of README.md * Revert "Bump y18n from 4.0.0 to 4.0.1 in /runtime/js (#638)" (#642) This reverts commit17b28a26bd
. * Update actions to use 1.16 * v1.16.0 Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: RH12503 <48951973+RH12503@users.noreply.github.com>
This commit is contained in:
parent
79af447109
commit
a2f16aba9b
4
.github/workflows/latest-pre.yml
vendored
4
.github/workflows/latest-pre.yml
vendored
@ -13,10 +13,10 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
steps:
|
||||
|
||||
- name: Set up Go 1.13
|
||||
- name: Set up Go 1.16
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.13
|
||||
go-version: 1.16
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
|
4
.github/workflows/pr.yml
vendored
4
.github/workflows/pr.yml
vendored
@ -13,10 +13,10 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
steps:
|
||||
|
||||
- name: Set up Go 1.13
|
||||
- name: Set up Go 1.16
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.13
|
||||
go-version: 1.16
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
|
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@ -15,10 +15,10 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
steps:
|
||||
|
||||
- name: Set up Go 1.13
|
||||
- name: Set up Go 1.16
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.13
|
||||
go-version: 1.16
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
|
File diff suppressed because one or more lines are too long
108
cmd/helpers.go
108
cmd/helpers.go
@ -2,7 +2,6 @@ package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
@ -12,10 +11,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/leaanthony/mewn"
|
||||
"github.com/leaanthony/mewn/lib"
|
||||
"github.com/leaanthony/slicer"
|
||||
"github.com/leaanthony/spinner"
|
||||
wailsruntime "github.com/wailsapp/wails/runtime"
|
||||
)
|
||||
|
||||
const xgoVersion = "1.0.1"
|
||||
@ -61,30 +59,6 @@ func InstallGoDependencies(verbose bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// EmbedAssets will embed the built frontend assets via mewn.
|
||||
func EmbedAssets() ([]string, error) {
|
||||
mewnFiles := lib.GetMewnFiles([]string{}, false)
|
||||
|
||||
referencedAssets, err := lib.GetReferencedAssets(mewnFiles)
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
|
||||
targetFiles := []string{}
|
||||
|
||||
for _, referencedAsset := range referencedAssets {
|
||||
packfileData, err := lib.GeneratePackFileString(referencedAsset, false)
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
targetFile := filepath.Join(referencedAsset.BaseDir, referencedAsset.PackageName+"-mewn.go")
|
||||
targetFiles = append(targetFiles, targetFile)
|
||||
ioutil.WriteFile(targetFile, []byte(packfileData), 0644)
|
||||
}
|
||||
|
||||
return targetFiles, nil
|
||||
}
|
||||
|
||||
func InitializeCrossCompilation(verbose bool) error {
|
||||
// Check Docker
|
||||
if err := CheckIfInstalled("docker"); err != nil {
|
||||
@ -127,7 +101,10 @@ func BuildDocker(binaryName string, buildMode string, projectOptions *ProjectOpt
|
||||
// Check build directory
|
||||
buildDirectory := filepath.Join(fs.Cwd(), "build")
|
||||
if !fs.DirExists(buildDirectory) {
|
||||
fs.MkDir(buildDirectory)
|
||||
err := fs.MkDir(buildDirectory)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
buildCommand := slicer.String()
|
||||
@ -198,11 +175,6 @@ func BuildDocker(binaryName string, buildMode string, projectOptions *ProjectOpt
|
||||
// BuildNative builds on the target platform itself.
|
||||
func BuildNative(binaryName string, forceRebuild bool, buildMode string, projectOptions *ProjectOptions) error {
|
||||
|
||||
// Check Mewn is installed
|
||||
if err := CheckMewn(projectOptions.Verbose); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := CheckWindres(); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -275,12 +247,6 @@ func BuildNative(binaryName string, forceRebuild bool, buildMode string, project
|
||||
func BuildApplication(binaryName string, forceRebuild bool, buildMode string, packageApp bool, projectOptions *ProjectOptions) error {
|
||||
var err error
|
||||
|
||||
// embed resources
|
||||
targetFiles, err := EmbedAssets()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if projectOptions.CrossCompile {
|
||||
if err := InitializeCrossCompilation(projectOptions.Verbose); err != nil {
|
||||
return err
|
||||
@ -296,20 +262,6 @@ func BuildApplication(binaryName string, forceRebuild bool, buildMode string, pa
|
||||
}
|
||||
}
|
||||
|
||||
// cleanup temporary embedded assets
|
||||
defer func() {
|
||||
for _, filename := range targetFiles {
|
||||
if err := os.Remove(filename); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
// Removed by popular demand
|
||||
// TODO: Potentially add a flag to cleanup
|
||||
// if projectOptions.Platform == "windows" {
|
||||
// helper.CleanWindows(projectOptions)
|
||||
// }
|
||||
}()
|
||||
|
||||
if projectOptions.CrossCompile {
|
||||
err = BuildDocker(binaryName, buildMode, projectOptions)
|
||||
} else {
|
||||
@ -374,30 +326,6 @@ func BuildFrontend(projectOptions *ProjectOptions) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// CheckMewn checks if mewn is installed and if not, attempts to fetch it
|
||||
func CheckMewn(verbose bool) (err error) {
|
||||
programHelper := NewProgramHelper(verbose)
|
||||
if !programHelper.IsInstalled("mewn") {
|
||||
var buildSpinner *spinner.Spinner
|
||||
if !verbose {
|
||||
buildSpinner = spinner.New()
|
||||
buildSpinner.SetSpinSpeed(50)
|
||||
buildSpinner.Start("Installing Mewn asset packer...")
|
||||
}
|
||||
err := programHelper.InstallGoPackage("github.com/leaanthony/mewn/cmd/mewn")
|
||||
if err != nil {
|
||||
if buildSpinner != nil {
|
||||
buildSpinner.Error()
|
||||
}
|
||||
return err
|
||||
}
|
||||
if buildSpinner != nil {
|
||||
buildSpinner.Success()
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// CheckWindres checks if Windres is installed and if not, aborts
|
||||
func CheckWindres() (err error) {
|
||||
if runtime.GOOS != "windows" { // FIXME: Handle windows cross-compile for windows!
|
||||
@ -493,11 +421,18 @@ func InstallFrontendDeps(projectDir string, projectOptions *ProjectOptions, forc
|
||||
}
|
||||
|
||||
// Update md5sum file
|
||||
ioutil.WriteFile(md5sumFile, []byte(packageJSONMD5), 0644)
|
||||
err := os.WriteFile(md5sumFile, []byte(packageJSONMD5), 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Install the runtime
|
||||
err = InstallRuntime(caller, projectDir, projectOptions)
|
||||
if caller == "build" {
|
||||
err = InstallProdRuntime(projectDir, projectOptions)
|
||||
} else {
|
||||
err = InstallBridge(projectDir, projectOptions)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -510,28 +445,17 @@ func InstallFrontendDeps(projectDir string, projectOptions *ProjectOptions, forc
|
||||
return nil
|
||||
}
|
||||
|
||||
// InstallRuntime installs the correct runtime for the type of build
|
||||
func InstallRuntime(caller string, projectDir string, projectOptions *ProjectOptions) error {
|
||||
if caller == "build" {
|
||||
return InstallProdRuntime(projectDir, projectOptions)
|
||||
}
|
||||
|
||||
return InstallBridge(projectDir, projectOptions)
|
||||
}
|
||||
|
||||
// InstallBridge installs the relevant bridge javascript library
|
||||
func InstallBridge(projectDir string, projectOptions *ProjectOptions) error {
|
||||
bridgeFileData := mewn.String("../runtime/assets/bridge.js")
|
||||
bridgeFileTarget := filepath.Join(projectDir, projectOptions.FrontEnd.Dir, "node_modules", "@wailsapp", "runtime", "init.js")
|
||||
err := fs.CreateFile(bridgeFileTarget, []byte(bridgeFileData))
|
||||
err := fs.CreateFile(bridgeFileTarget, wailsruntime.BridgeJS)
|
||||
return err
|
||||
}
|
||||
|
||||
// InstallProdRuntime installs the production runtime
|
||||
func InstallProdRuntime(projectDir string, projectOptions *ProjectOptions) error {
|
||||
prodInit := mewn.String("../runtime/js/runtime/init.js")
|
||||
bridgeFileTarget := filepath.Join(projectDir, projectOptions.FrontEnd.Dir, "node_modules", "@wailsapp", "runtime", "init.js")
|
||||
err := fs.CreateFile(bridgeFileTarget, []byte(prodInit))
|
||||
err := fs.CreateFile(bridgeFileTarget, wailsruntime.InitJS)
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/leaanthony/mewn"
|
||||
_ "embed"
|
||||
"github.com/wailsapp/wails"
|
||||
)
|
||||
|
||||
@ -9,10 +9,13 @@ func basic() string {
|
||||
return "World!"
|
||||
}
|
||||
|
||||
func main() {
|
||||
//go:embed frontend/dist/my-app/main.js
|
||||
var js string
|
||||
|
||||
js := mewn.String("./frontend/dist/my-app/main.js")
|
||||
css := mewn.String("./frontend/dist/my-app/styles.css")
|
||||
//go:embed frontend/dist/my-app/styles.css
|
||||
var css string
|
||||
|
||||
func main() {
|
||||
|
||||
app := wails.CreateApp(&wails.AppConfig{
|
||||
Width: 1024,
|
||||
|
@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/leaanthony/mewn"
|
||||
_ "embed"
|
||||
"github.com/wailsapp/wails"
|
||||
)
|
||||
|
||||
@ -9,10 +9,13 @@ func basic() string {
|
||||
return "World!"
|
||||
}
|
||||
|
||||
func main() {
|
||||
//go:embed frontend/build/static/js/main.js
|
||||
var js string
|
||||
|
||||
js := mewn.String("./frontend/build/static/js/main.js")
|
||||
css := mewn.String("./frontend/build/static/css/main.css")
|
||||
//go:embed frontend/build/static/css/main.css
|
||||
var css string
|
||||
|
||||
func main() {
|
||||
|
||||
app := wails.CreateApp(&wails.AppConfig{
|
||||
Width: 1024,
|
||||
|
@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/leaanthony/mewn"
|
||||
_ "embed"
|
||||
"github.com/wailsapp/wails"
|
||||
)
|
||||
|
||||
@ -9,9 +9,13 @@ func basic() string {
|
||||
return "World!"
|
||||
}
|
||||
|
||||
//go:embed frontend/public/build/bundle.js
|
||||
var js string
|
||||
|
||||
//go:embed frontend/public/build/bundle.css
|
||||
var css string
|
||||
|
||||
func main() {
|
||||
js := mewn.String("./frontend/public/build/bundle.js")
|
||||
css := mewn.String("./frontend/public/build/bundle.css")
|
||||
|
||||
app := wails.CreateApp(&wails.AppConfig{
|
||||
Width: 1024,
|
||||
|
@ -1,14 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/leaanthony/mewn"
|
||||
_ "embed"
|
||||
"github.com/wailsapp/wails"
|
||||
)
|
||||
|
||||
func main() {
|
||||
//go:embed frontend/build/main.js
|
||||
var js string
|
||||
|
||||
js := mewn.String("./frontend/build/main.js")
|
||||
css := mewn.String("./frontend/build/main.css")
|
||||
//go:embed frontend/build/main.css
|
||||
var css string
|
||||
|
||||
func main() {
|
||||
|
||||
app := wails.CreateApp(&wails.AppConfig{
|
||||
Width: 1024,
|
||||
|
@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/leaanthony/mewn"
|
||||
_ "embed"
|
||||
"github.com/wailsapp/wails"
|
||||
)
|
||||
|
||||
@ -9,10 +9,13 @@ func basic() string {
|
||||
return "Hello World!"
|
||||
}
|
||||
|
||||
func main() {
|
||||
//go:embed frontend/dist/app.js
|
||||
var js string
|
||||
|
||||
js := mewn.String("./frontend/dist/app.js")
|
||||
css := mewn.String("./frontend/dist/app.css")
|
||||
//go:embed frontend/dist/app.css
|
||||
var css string
|
||||
|
||||
func main() {
|
||||
|
||||
app := wails.CreateApp(&wails.AppConfig{
|
||||
Width: 1024,
|
||||
|
@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/leaanthony/mewn"
|
||||
_ "embed"
|
||||
"github.com/wailsapp/wails"
|
||||
)
|
||||
|
||||
@ -9,10 +9,13 @@ func basic() string {
|
||||
return "Hello World!"
|
||||
}
|
||||
|
||||
func main() {
|
||||
//go:embed frontend/dist/app.js
|
||||
var js string
|
||||
|
||||
js := mewn.String("./frontend/dist/app.js")
|
||||
css := mewn.String("./frontend/dist/app.css")
|
||||
//go:embed frontend/dist/app.css
|
||||
var css string
|
||||
|
||||
func main() {
|
||||
|
||||
app := wails.CreateApp(&wails.AppConfig{
|
||||
Width: 1024,
|
||||
|
@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/leaanthony/mewn"
|
||||
_ "embed"
|
||||
"github.com/wailsapp/wails"
|
||||
)
|
||||
|
||||
@ -9,10 +9,13 @@ func basic() string {
|
||||
return "Hello World!"
|
||||
}
|
||||
|
||||
func main() {
|
||||
//go:embed frontend/dist/app.js
|
||||
var js string
|
||||
|
||||
js := mewn.String("./frontend/dist/app.js")
|
||||
css := mewn.String("./frontend/dist/app.css")
|
||||
//go:embed frontend/dist/app.css
|
||||
var css string
|
||||
|
||||
func main() {
|
||||
|
||||
app := wails.CreateApp(&wails.AppConfig{
|
||||
Width: 1024,
|
||||
|
@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/leaanthony/mewn"
|
||||
_ "embed"
|
||||
"github.com/wailsapp/wails"
|
||||
)
|
||||
|
||||
@ -9,10 +9,13 @@ func basic() string {
|
||||
return "Hello World!"
|
||||
}
|
||||
|
||||
func main() {
|
||||
//go:embed frontend/dist/app.js
|
||||
var js string
|
||||
|
||||
js := mewn.String("./frontend/dist/app.js")
|
||||
css := mewn.String("./frontend/dist/app.css")
|
||||
//go:embed frontend/dist/app.css
|
||||
var css string
|
||||
|
||||
func main() {
|
||||
|
||||
app := wails.CreateApp(&wails.AppConfig{
|
||||
Width: 1024,
|
||||
|
@ -1,4 +1,4 @@
|
||||
package cmd
|
||||
|
||||
// Version - Wails version
|
||||
const Version = "v1.13.0"
|
||||
const Version = "v1.16.0"
|
||||
|
@ -39,12 +39,6 @@ Create your first project by running 'wails init'.`
|
||||
return err
|
||||
}
|
||||
|
||||
// Check Mewn
|
||||
err = cmd.CheckMewn(false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Check for errors
|
||||
// CheckDependencies() returns !errors
|
||||
// so to get the right message in this
|
||||
|
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
@ -52,7 +53,10 @@ func init() {
|
||||
|
||||
var b strings.Builder
|
||||
for _, plat := range getSupportedPlatforms() {
|
||||
fmt.Fprintf(&b, " - %s\n", plat)
|
||||
_, err := fmt.Fprintf(&b, " - %s\n", plat)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
initCmd.StringFlag("x",
|
||||
fmt.Sprintf("Cross-compile application to specified platform via xgo\n%s", b.String()),
|
||||
@ -80,7 +84,7 @@ func init() {
|
||||
fs := cmd.NewFSHelper()
|
||||
err := projectOptions.LoadConfig(fs.Cwd())
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to find 'project.json'. Please check you are in a Wails project directory")
|
||||
return fmt.Errorf("unable to find 'project.json'. Please check you are in a Wails project directory")
|
||||
}
|
||||
|
||||
// Set firebug flag
|
||||
@ -143,12 +147,6 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Ensure that runtime init.js is the production version
|
||||
err = cmd.InstallProdRuntime(projectDir, projectOptions)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Move to project directory
|
||||
|
@ -27,19 +27,13 @@ func init() {
|
||||
logger.PrintSmallBanner(message)
|
||||
fmt.Println()
|
||||
|
||||
// Check Mewn is installed
|
||||
err := cmd.CheckMewn(verbose)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Project options
|
||||
projectOptions := &cmd.ProjectOptions{}
|
||||
|
||||
// Check we are in project directory
|
||||
// Check project.json loads correctly
|
||||
fs := cmd.NewFSHelper()
|
||||
err = projectOptions.LoadConfig(fs.Cwd())
|
||||
err := projectOptions.LoadConfig(fs.Cwd())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
3
go.mod
3
go.mod
@ -9,7 +9,6 @@ require (
|
||||
github.com/jackmordaunt/icns v1.0.0
|
||||
github.com/kennygrant/sanitize v1.2.4
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
|
||||
github.com/leaanthony/mewn v0.10.7
|
||||
github.com/leaanthony/slicer v1.4.0
|
||||
github.com/leaanthony/spinner v0.5.3
|
||||
github.com/mattn/go-colorable v0.1.1 // indirect
|
||||
@ -28,4 +27,4 @@ require (
|
||||
gopkg.in/yaml.v3 v3.0.0-20190709130402-674ba3eaed22
|
||||
)
|
||||
|
||||
go 1.13
|
||||
go 1.16
|
||||
|
3
go.sum
3
go.sum
@ -26,8 +26,6 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/leaanthony/mewn v0.10.7 h1:jCcNJyIUOpwj+I5SuATvCugDjHkoo+j6ubEOxxrxmPA=
|
||||
github.com/leaanthony/mewn v0.10.7/go.mod h1:CRkTx8unLiSSilu/Sd7i1LwrdaAL+3eQ3ses99qGMEQ=
|
||||
github.com/leaanthony/slicer v1.4.0 h1:Q9u4w+UBU4WHjXnEDdz+eRLMKF/rnyosRBiqULnc1J8=
|
||||
github.com/leaanthony/slicer v1.4.0/go.mod h1:FwrApmf8gOrpzEWM2J/9Lh79tyq8KTX5AzRtwV7m4AY=
|
||||
github.com/leaanthony/spinner v0.5.3 h1:IMTvgdQCec5QA4qRy0wil4XsRP+QcG1OwLWVK/LPZ5Y=
|
||||
@ -66,7 +64,6 @@ github.com/syossan27/tebata v0.0.0-20180602121909-b283fe4bc5ba h1:2DHfQOxcpWdGf5
|
||||
github.com/syossan27/tebata v0.0.0-20180602121909-b283fe4bc5ba/go.mod h1:iLnlXG2Pakcii2CU0cbY07DRCSvpWNa7nFxtevhOChk=
|
||||
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-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/image v0.0.0-20200430140353-33d19683fad8 h1:6WW6V3x1P/jokJBpRQYUJnMHRP6isStQwCozxnU7XQw=
|
||||
golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
|
File diff suppressed because one or more lines are too long
@ -3,8 +3,9 @@ package renderer
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/wailsapp/wails/runtime"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/leaanthony/mewn"
|
||||
"github.com/wailsapp/wails/lib/interfaces"
|
||||
"github.com/wailsapp/wails/lib/logger"
|
||||
)
|
||||
@ -58,8 +59,7 @@ func (s *session) start(firstSession bool) {
|
||||
s.log.Infof("Connected to frontend.")
|
||||
go s.writePump()
|
||||
|
||||
wailsRuntime := mewn.String("../../runtime/assets/wails.js")
|
||||
s.evalJS(wailsRuntime, wailsRuntimeMessage)
|
||||
s.evalJS(runtime.WailsJS, wailsRuntimeMessage)
|
||||
|
||||
// Inject bindings
|
||||
for _, binding := range s.bindingCache {
|
||||
|
File diff suppressed because one or more lines are too long
@ -8,8 +8,9 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/wailsapp/wails/runtime"
|
||||
|
||||
"github.com/go-playground/colors"
|
||||
"github.com/leaanthony/mewn"
|
||||
"github.com/wailsapp/wails/lib/interfaces"
|
||||
"github.com/wailsapp/wails/lib/logger"
|
||||
"github.com/wailsapp/wails/lib/messages"
|
||||
@ -29,7 +30,6 @@ type WebView struct {
|
||||
config interfaces.AppConfig
|
||||
eventManager interfaces.EventManager
|
||||
bindingCache []string
|
||||
|
||||
maximumSizeSet bool
|
||||
}
|
||||
|
||||
@ -104,6 +104,14 @@ func (w *WebView) Initialise(config interfaces.AppConfig, ipc interfaces.IPCMana
|
||||
fmt.Println("Max")
|
||||
}
|
||||
|
||||
// Set minimum and maximum sizes
|
||||
if setMinSize {
|
||||
w.SetMinSize(minWidth, minHeight)
|
||||
}
|
||||
if setMaxSize {
|
||||
w.SetMaxSize(maxWidth, maxHeight)
|
||||
}
|
||||
|
||||
// SignalManager.OnExit(w.Exit)
|
||||
|
||||
// Set colour
|
||||
@ -223,8 +231,8 @@ func (w *WebView) Run() error {
|
||||
}
|
||||
|
||||
// Runtime assets
|
||||
wailsRuntime := mewn.String("../../runtime/assets/wails.js")
|
||||
w.evalJS(wailsRuntime)
|
||||
w.log.DebugFields("Injecting wails JS runtime", logger.Fields{"js": runtime.WailsJS})
|
||||
w.evalJS(runtime.WailsJS)
|
||||
|
||||
// Ping the wait channel when the wails runtime is loaded
|
||||
w.eventManager.On("wails:loaded", func(...interface{}) {
|
||||
@ -247,10 +255,9 @@ func (w *WebView) Run() error {
|
||||
w.injectCSS(w.config.GetCSS())
|
||||
} else {
|
||||
// Use default wails css
|
||||
w.log.Debug("Injecting Default Wails CSS")
|
||||
defaultCSS := mewn.String("../../runtime/assets/wails.css")
|
||||
|
||||
w.injectCSS(defaultCSS)
|
||||
w.log.Debug("Injecting Default Wails CSS: " + runtime.WailsCSS)
|
||||
w.injectCSS(runtime.WailsCSS)
|
||||
}
|
||||
|
||||
// Inject user JS
|
||||
|
15
runtime/assets.go
Normal file
15
runtime/assets.go
Normal file
@ -0,0 +1,15 @@
|
||||
package runtime
|
||||
|
||||
import _ "embed"
|
||||
|
||||
//go:embed assets/bridge.js
|
||||
var BridgeJS []byte
|
||||
|
||||
//go:embed assets/wails.js
|
||||
var WailsJS string
|
||||
|
||||
//go:embed assets/wails.css
|
||||
var WailsCSS string
|
||||
|
||||
//go:embed js/runtime/init.js
|
||||
var InitJS []byte
|
@ -8,38 +8,6 @@ import (
|
||||
"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()
|
||||
@ -48,7 +16,6 @@ func runCommand(command string, args ...string) {
|
||||
log.Println(string(output))
|
||||
log.Fatal(err)
|
||||
}
|
||||
cmd.Run()
|
||||
fmt.Println(string(output))
|
||||
}
|
||||
|
||||
@ -60,26 +27,26 @@ func main() {
|
||||
// Build Runtime
|
||||
fmt.Println("**** Building Runtime ****")
|
||||
runtimeDir, _ := filepath.Abs(filepath.Join(dir, "..", "runtime", "js"))
|
||||
os.Chdir(runtimeDir)
|
||||
err := os.Chdir(runtimeDir)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
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)
|
||||
err = os.Chdir(execDir)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
runCommand("go", "install")
|
||||
|
||||
baseDir, _ := filepath.Abs(filepath.Join(dir, ".."))
|
||||
os.Chdir(baseDir)
|
||||
err = os.Chdir(baseDir)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
runCommand("go", "mod", "tidy")
|
||||
}
|
||||
|
@ -15,15 +15,6 @@ npm install
|
||||
npm run build
|
||||
cd ../..
|
||||
|
||||
echo "**** Packing Assets ****"
|
||||
cd cmd
|
||||
mewn
|
||||
cd ..
|
||||
cd lib/renderer
|
||||
mewn
|
||||
cd ../..
|
||||
|
||||
|
||||
cd cmd/wails
|
||||
echo "**** Checking if Wails compiles ****"
|
||||
if ! go build .
|
||||
|
@ -16,7 +16,6 @@ cd runtime/js
|
||||
npm run build
|
||||
|
||||
cd ../..
|
||||
mewn
|
||||
|
||||
git add cmd/version.go
|
||||
git commit cmd/version.go -m "Bump to ${TAG}"
|
||||
|
Loading…
Reference in New Issue
Block a user