diff --git a/cmd/helpers.go b/cmd/helpers.go index ea16d5ff..560c392a 100644 --- a/cmd/helpers.go +++ b/cmd/helpers.go @@ -11,7 +11,6 @@ import ( "strings" "time" - "github.com/leaanthony/mewn/lib" "github.com/leaanthony/slicer" "github.com/leaanthony/spinner" wailsruntime "github.com/wailsapp/wails/runtime" @@ -60,33 +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) - err = os.WriteFile(targetFile, []byte(packfileData), 0644) - if err != nil { - return []string{}, err - } - } - - return targetFiles, nil -} - func InitializeCrossCompilation(verbose bool) error { // Check Docker if err := CheckIfInstalled("docker"); err != nil { @@ -203,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 } @@ -280,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 @@ -301,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 { @@ -379,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! diff --git a/cmd/templates/angular-template/main.go.template b/cmd/templates/angular-template/main.go.template index bcba7df0..d7abf2c2 100644 --- a/cmd/templates/angular-template/main.go.template +++ b/cmd/templates/angular-template/main.go.template @@ -1,7 +1,6 @@ package main import ( - "github.com/leaanthony/mewn" "github.com/wailsapp/wails" ) @@ -9,10 +8,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, diff --git a/cmd/templates/create-react-app/main.go.template b/cmd/templates/create-react-app/main.go.template index 034c4346..68b4d35c 100644 --- a/cmd/templates/create-react-app/main.go.template +++ b/cmd/templates/create-react-app/main.go.template @@ -1,7 +1,6 @@ package main import ( - "github.com/leaanthony/mewn" "github.com/wailsapp/wails" ) @@ -9,10 +8,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/js/main.css +var css string + +func main() { app := wails.CreateApp(&wails.AppConfig{ Width: 1024, diff --git a/cmd/templates/svelte/main.go.template b/cmd/templates/svelte/main.go.template index b5718c49..3fd9a2c0 100644 --- a/cmd/templates/svelte/main.go.template +++ b/cmd/templates/svelte/main.go.template @@ -1,7 +1,6 @@ package main import ( - "github.com/leaanthony/mewn" "github.com/wailsapp/wails" ) @@ -9,9 +8,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, diff --git a/cmd/templates/vanilla/main.go.template b/cmd/templates/vanilla/main.go.template index b1a0e04b..d4829fb7 100644 --- a/cmd/templates/vanilla/main.go.template +++ b/cmd/templates/vanilla/main.go.template @@ -1,14 +1,16 @@ package main import ( - "github.com/leaanthony/mewn" "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, diff --git a/cmd/templates/vue3-full/main.go.template b/cmd/templates/vue3-full/main.go.template index e2262bd1..51c5b091 100644 --- a/cmd/templates/vue3-full/main.go.template +++ b/cmd/templates/vue3-full/main.go.template @@ -1,7 +1,6 @@ package main import ( - "github.com/leaanthony/mewn" "github.com/wailsapp/wails" ) @@ -9,10 +8,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, diff --git a/cmd/templates/vuebasic/main.go.template b/cmd/templates/vuebasic/main.go.template index e2262bd1..51c5b091 100644 --- a/cmd/templates/vuebasic/main.go.template +++ b/cmd/templates/vuebasic/main.go.template @@ -1,7 +1,6 @@ package main import ( - "github.com/leaanthony/mewn" "github.com/wailsapp/wails" ) @@ -9,10 +8,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, diff --git a/cmd/templates/vuetify-basic/main.go.template b/cmd/templates/vuetify-basic/main.go.template index e2262bd1..51c5b091 100644 --- a/cmd/templates/vuetify-basic/main.go.template +++ b/cmd/templates/vuetify-basic/main.go.template @@ -1,7 +1,6 @@ package main import ( - "github.com/leaanthony/mewn" "github.com/wailsapp/wails" ) @@ -9,10 +8,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, diff --git a/cmd/templates/vuetify2-basic/main.go.template b/cmd/templates/vuetify2-basic/main.go.template index e2262bd1..51c5b091 100644 --- a/cmd/templates/vuetify2-basic/main.go.template +++ b/cmd/templates/vuetify2-basic/main.go.template @@ -1,7 +1,6 @@ package main import ( - "github.com/leaanthony/mewn" "github.com/wailsapp/wails" ) @@ -9,10 +8,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, diff --git a/cmd/wails/0_setup.go b/cmd/wails/0_setup.go index bab0949d..394f565a 100644 --- a/cmd/wails/0_setup.go +++ b/cmd/wails/0_setup.go @@ -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 diff --git a/cmd/wails/6_serve.go b/cmd/wails/6_serve.go index 1ea93c36..6e289685 100644 --- a/cmd/wails/6_serve.go +++ b/cmd/wails/6_serve.go @@ -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 } diff --git a/go.mod b/go.mod index 73a20245..ff37b58d 100644 --- a/go.mod +++ b/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 diff --git a/go.sum b/go.sum index 0d97b0cf..2c697c81 100644 --- a/go.sum +++ b/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= diff --git a/lib/renderer/webview.go b/lib/renderer/webview.go index a74ce878..f0ed8934 100644 --- a/lib/renderer/webview.go +++ b/lib/renderer/webview.go @@ -30,7 +30,7 @@ type WebView struct { config interfaces.AppConfig eventManager interfaces.EventManager bindingCache []string - + maximumSizeSet bool } @@ -94,7 +94,6 @@ func (w *WebView) Initialise(config interfaces.AppConfig, ipc interfaces.IPCMana w.ipc.Dispatch(message, w.callback) }, }) - fmt.Println("Control") // Set minimum and maximum sizes if setMinSize { @@ -102,7 +101,6 @@ func (w *WebView) Initialise(config interfaces.AppConfig, ipc interfaces.IPCMana } if setMaxSize { w.SetMaxSize(maxWidth, maxHeight) - fmt.Println("Max") } // SignalManager.OnExit(w.Exit) @@ -224,6 +222,7 @@ func (w *WebView) Run() error { } // Runtime assets + 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 @@ -247,7 +246,8 @@ func (w *WebView) Run() error { w.injectCSS(w.config.GetCSS()) } else { // Use default wails css - w.log.Debug("Injecting Default Wails CSS: " + string(runtime.WailsCSS)) + + w.log.Debug("Injecting Default Wails CSS: " + runtime.WailsCSS) w.injectCSS(runtime.WailsCSS) } diff --git a/scripts/build.go b/scripts/build.go index 67f9409e..046bc97c 100644 --- a/scripts/build.go +++ b/scripts/build.go @@ -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() diff --git a/scripts/build.sh b/scripts/build.sh index 0e9d172a..e99ad26e 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -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 . diff --git a/scripts/updateversion.sh b/scripts/updateversion.sh index 6117b052..e0c4b6e8 100755 --- a/scripts/updateversion.sh +++ b/scripts/updateversion.sh @@ -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}"