Compare commits

..

147 Commits

Author SHA1 Message Date
Lea Anthony e99fffe340 Version bump 2019-02-23 10:25:31 +11:00
Lea Anthony 4cccb628c9 initial update command 2019-02-23 10:20:37 +11:00
Lea Anthony 5d487347d4 Merge pull request #57 from wailsapp/#55-default-directory
default directory option
2019-02-22 09:04:12 +11:00
Lea Anthony fe8b7ac5c9 default directory option 2019-02-22 09:03:41 +11:00
Lea Anthony 732c70777b Merge pull request #56 from wailsapp/minimise-console-spam
Big banner for Setup/Help. Small banner for commands.
2019-02-22 08:45:13 +11:00
Lea Anthony 753c5fd337 Big banner for Setup/Help. Small banner for commands. 2019-02-22 08:44:30 +11:00
Lea Anthony 2dad29673d Merge pull request #53 from wailsapp/adjust-windows-build-behaviour
package by default. -p  leaves resource artefacts
2019-02-22 05:17:54 +11:00
Lea Anthony 5e466893cf package by default. -p leaves resource artifacts 2019-02-22 05:17:23 +11:00
Lea Anthony c15fd822c1 Merge pull request #52 from wailsapp/minor-fixes
remove frontend build from serve
2019-02-21 21:22:54 +11:00
Lea Anthony 42b1c0befa remove frontend build from serve 2019-02-21 21:21:05 +11:00
Lea Anthony 6ef8744e02 Merge pull request #51 from wailsapp/minor-fixes
Minor fixes
2019-02-21 08:25:10 +11:00
Lea Anthony cf916c8e8b Updated sums 2019-02-21 08:24:30 +11:00
Lea Anthony cdc1d4be3e Remove debug line 2019-02-21 08:23:44 +11:00
Lea Anthony 1c5284db3e Set window colour 2019-02-21 08:23:35 +11:00
Lea Anthony 073cdc3a55 Merge pull request #50 from wailsapp/window-debugging
minor bugfix
2019-02-20 23:04:35 +11:00
Lea Anthony fd9363e842 minor bugfix 2019-02-20 23:04:11 +11:00
Lea Anthony 3051628fa2 Merge pull request #49 from wailsapp/window-debugging
Window debugging
2019-02-20 23:01:56 +11:00
Lea Anthony cac97e8652 small refactor 2019-02-20 23:01:33 +11:00
Lea Anthony 2ccabc772b try and simplify 2019-02-20 22:54:06 +11:00
Lea Anthony ff91241592 updated licenses + gomod 2019-02-20 22:48:59 +11:00
Lea Anthony 2257b1cab1 remove bad xml error 2019-02-20 22:41:33 +11:00
Lea Anthony bdcf98fc15 Significant support for Windows builds 2019-02-20 22:24:47 +11:00
Lea Anthony 3025a94a77 use wails.min.js 2019-02-19 23:37:02 +11:00
Lea Anthony d971495ad3 basics working 2019-02-19 21:06:24 +11:00
Lea Anthony a4b1f469e9 Merge pull request #48 from wailsapp/move-to-new-prompt-library
Move to new prompt library
2019-02-19 19:38:29 +11:00
Lea Anthony b18f04b30d removed survey 2019-02-19 19:37:45 +11:00
Lea Anthony 94e9447e1c Removed prompt library requirements 2019-02-19 19:25:33 +11:00
Lea Anthony 03c479c890 Fix vue template 2019-02-19 00:18:08 +11:00
Lea Anthony c95a3a795e Merge pull request #47 from wailsapp/move-to-mewn
Move to mewn
2019-02-18 21:07:47 +11:00
Lea Anthony 1d8e99d846 Move to mewn 2019-02-18 21:06:53 +11:00
Lea Anthony 8e909fc9f4 Move to mewn 2019-02-18 08:31:22 +11:00
Lea Anthony 3bc86a4f50 Move bridge runtimes out of bundled assets 2019-02-17 06:12:05 +11:00
Lea Anthony 2c7913c202 use latest webview 2019-02-16 15:15:27 +11:00
Lea Anthony d1c57ddb5f Merge pull request #46 from wailsapp/ignore-packr-findstring-errors-in-bridge-mode
Ignore packr findstring errors in bridge mode
2019-02-16 07:03:16 +11:00
Lea Anthony 9ffb517183 minor fixes 2019-02-16 07:02:16 +11:00
Lea Anthony 27f852ac6a ignoring findstring errors for bridge mode
refactored build mode strings
2019-02-16 06:58:30 +11:00
Lea Anthony 20c0b48634 version bump 2019-02-15 21:15:16 +11:00
Lea Anthony 6cf01b4239 Merge pull request #44 from wailsapp/get-vue-HMR-working
removed quote db for now. added vue basic
2019-02-15 21:12:24 +11:00
Lea Anthony 3ae88f8822 removed quote db for now. added vue basic 2019-02-15 21:11:42 +11:00
Lea Anthony 5994eb605f minor fixes to serve/build 2019-02-13 08:44:53 +11:00
Lea Anthony 9694dc57aa Merge pull request #43 from wailsapp/port-to-custom-webview
move webview out to seperate project
2019-02-11 08:30:33 +11:00
Lea Anthony b5b78fddee move webview out to seperate project 2019-02-11 08:28:07 +11:00
Lea Anthony c905185467 Merge pull request #42 from wailsapp/improve-build-output
Reduce output of prod build by ~30%
2019-02-06 06:27:38 +11:00
Lea Anthony 47ca7879cd Reduce output of prod build by ~30% 2019-02-06 06:26:54 +11:00
Lea Anthony 6202b3bf3e Merge pull request #41 from wailsapp/fix-linting-issues
simplified PromptForInputs
2019-02-05 18:53:32 +11:00
Lea Anthony ea94c2de1f simplified PromptForInputs 2019-02-05 18:51:08 +11:00
Lea Anthony eb0d4bc42f Merge pull request #40 from wailsapp/fix-linting-issues
Fix linting issues
2019-02-05 08:45:08 +11:00
Lea Anthony b323c3db20 refactor promptforinputs 2019-02-05 08:43:50 +11:00
Lea Anthony 1670ac6567 add comments 2019-02-05 08:11:02 +11:00
Lea Anthony c941176018 simplify Serve 2019-02-05 08:06:18 +11:00
Lea Anthony a060d9dcc0 fix bridge installation path 2019-02-05 08:03:07 +11:00
Lea Anthony ba208dce44 Merge pull request #39 from wailsapp/fix-linting-issues
Fix linting issues
2019-02-04 21:10:46 +11:00
Lea Anthony 9bbac46b3f Misc refactors 2019-02-04 21:09:56 +11:00
Lea Anthony d8c591e64c refactored processCall 2019-02-04 19:50:26 +11:00
Lea Anthony 2c28a8f550 Fix css 2019-02-04 19:31:37 +11:00
Lea Anthony d6c5586159 Merge pull request #38 from wailsapp/Improve-build/serve
Improve build/serve
2019-02-04 19:27:12 +11:00
Lea Anthony 08a7893b1d refactored build/serve 2019-02-04 18:49:56 +11:00
Lea Anthony fa6cf17079 Fixed wails serve. Improved code structure. 2019-02-04 08:45:12 +11:00
Lea Anthony fe2a20f92a Merge pull request #36 from wailsapp/Improve-build/serve
Improve build/serve
2019-02-02 14:07:14 +11:00
Lea Anthony b713d57168 Tidy up serve. 2019-02-02 13:58:55 +11:00
Lea Anthony 17ca06693e add debug mode to build 2019-02-02 09:29:14 +11:00
Lea Anthony 243d738d64 Merge pull request #35 from wailsapp/Make-Serve-command
Add helpful message after serving
2019-01-31 18:59:37 +11:00
Lea Anthony 3f50b95f26 Add helpful message after serving 2019-01-31 18:59:07 +11:00
Lea Anthony f0d8ce99a1 Merge pull request #34 from wailsapp/Make-Serve-command
Make serve command
2019-01-31 18:49:18 +11:00
Lea Anthony 259eec97d6 Added serve.
Serve only builds backend.
Build is always release build.
2019-01-31 18:48:12 +11:00
Lea Anthony 8b2168abe7 upgraded spinner to 0.5.0 2019-01-31 18:47:27 +11:00
Lea Anthony a51e127309 Merge pull request #32 from wailsapp/Massively-Simplify
add webview license
2019-01-30 20:28:49 +11:00
Lea Anthony c5cee79ff7 add webview license 2019-01-30 20:28:21 +11:00
Lea Anthony 9393b08c3f Merge pull request #31 from wailsapp/Massively-Simplify
Initial commit of simplification
2019-01-30 19:05:52 +11:00
Lea Anthony 0ca039e914 Initial commit of simplification 2019-01-30 09:00:46 +11:00
Lea Anthony cd8b4f088f Merge pull request #29 from wailsapp/Move-headless-capability-into-own-library
Move headless capability into own library
2019-01-29 08:37:33 +11:00
Lea Anthony 847842504b Merge branch 'master' into Move-headless-capability-into-own-library 2019-01-29 08:36:27 +11:00
Lea Anthony 8ab91d31fe reduce function complexity 2019-01-29 08:36:21 +11:00
Lea Anthony bb4d891549 Merge pull request #28 from wailsapp/Create-consistent-templates
Updated custom html
2019-01-29 08:31:21 +11:00
Lea Anthony 4a316a76fa Updated custom html 2019-01-29 08:30:38 +11:00
Lea Anthony 529e4cc07e Merge pull request #27 from wailsapp/Create-consistent-templates
update basic templates to use a frontend dir
2019-01-29 08:29:40 +11:00
Lea Anthony 579747d0f7 update basic templates to use a frontend dir 2019-01-29 08:28:59 +11:00
Lea Anthony 6880c53082 Merge pull request #26 from wailsapp/Move-headless-capability-into-own-library
Move headless capability into own library
2019-01-23 08:36:02 +11:00
Lea Anthony 6e011e75c3 updated vue template 2019-01-23 08:35:12 +11:00
Lea Anthony 683ba7dc59 support bridge mode
streamline some messaging
2019-01-23 06:01:45 +11:00
Lea Anthony 717e598330 Linter fix 2019-01-16 08:19:30 +11:00
Lea Anthony a6489a1044 Merge pull request #25 from wailsapp/create-wails-css
Update basic template to use default CSS
2019-01-15 18:53:12 +11:00
Lea Anthony df911adcae Update basic template to use default CSS 2019-01-15 18:52:18 +11:00
Lea Anthony d7c0b1ec58 Merge pull request #24 from wailsapp/create-wails-css
inject default css if none given
2019-01-15 18:51:08 +11:00
Lea Anthony 7135d4fa27 inject default css if none given 2019-01-15 18:50:26 +11:00
Lea Anthony 83e063bf2b Merge pull request #23 from wailsapp/Update-execution-order-in-Headless-mode
Update execution order in headless mode
2019-01-15 08:36:10 +11:00
Lea Anthony 6e0773b355 fix for rendering fragments via headless 2019-01-15 08:34:32 +11:00
Lea Anthony 60f34223b0 bugfix for force rebuild 2019-01-15 08:33:48 +11:00
Lea Anthony 539be2ce84 Updated comments 2019-01-14 22:46:45 +11:00
Lea Anthony 561198b81b Fix unicode escaping 2019-01-14 19:18:03 +11:00
Lea Anthony c823215eb6 Merge pull request #21 from wailsapp/Fix-npm-project-name
Fix npm package name
2019-01-13 18:04:39 +11:00
Lea Anthony 93f890f6d9 Fix npm package name 2019-01-13 18:02:51 +11:00
Lea Anthony 8a3aec6866 Merge pull request #20 from wailsapp/Update-execution-order-in-Headless-mode
Numerous fixes for headless mode.
2019-01-13 17:58:34 +11:00
Lea Anthony 1ef8ed73ab Remove debug statements 2019-01-13 17:57:21 +11:00
Lea Anthony 9004c3955e Numerous fixes for headless mode.
Remove script dom elements for internal calls.
2019-01-13 17:54:38 +11:00
Lea Anthony 4c98ce7da1 Merge pull request #19 from wailsapp/Update-execution-order-in-Headless-mode
fix for ipc binding
2019-01-12 16:00:44 +11:00
Lea Anthony 0ae5381203 fix for ipc binding
made reconnect modal a bit better
2019-01-12 15:56:49 +11:00
Lea Anthony 3f2f1b45f6 Merge pull request #18 from wailsapp/Support-Packaging
Add Licenses
2019-01-12 09:37:27 +11:00
Lea Anthony e6bec8f7cc Add Licenses 2019-01-12 09:26:51 +11:00
Lea Anthony f1f15fc1c5 Merge pull request #17 from wailsapp/Support-Packaging
Initial port of packager
2019-01-11 21:17:53 +11:00
Lea Anthony bcca09563c Initial port of packager 2019-01-11 21:16:52 +11:00
Lea Anthony ee355659ce Merge pull request #16 from wailsapp/change-code-mount-point
now binds go code to window.backend
2019-01-11 20:03:20 +11:00
Lea Anthony a660e4a9da now binds go code to window.backend 2019-01-11 20:02:43 +11:00
Lea Anthony a44fd57e98 Merge pull request #15 from wailsapp/Port-Build
Port build
2019-01-11 07:01:18 +11:00
Lea Anthony 85de0bbf8a remove console.log 2019-01-11 07:00:40 +11:00
Lea Anthony 7274b6d19c Args messages to debug 2019-01-11 06:53:34 +11:00
Lea Anthony c0371f141a Merge pull request #14 from wailsapp/Port-Build
Update vue template to use BoxString
2019-01-11 06:49:31 +11:00
Lea Anthony 5c96264234 Update vue template to use BoxString
Made arg marshalling messages Debug rather than Info
2019-01-11 06:39:42 +11:00
Lea Anthony a3c41d1740 Merge pull request #13 from wailsapp/Port-Build
Fix frameworkspinner
2019-01-11 06:32:41 +11:00
Lea Anthony 7c15b780e2 Fix frameworkspinner
Fix BoxString for frameworks
2019-01-11 06:32:13 +11:00
Lea Anthony fb081b4876 Merge pull request #12 from wailsapp/Port-Build
Port build
2019-01-11 06:16:30 +11:00
Lea Anthony a28315f38b Fix Packr deprecation errors
Improved comments
2019-01-11 06:15:49 +11:00
Lea Anthony 49e4f00b62 Added release mode flag
fixed logging
logging info level by default
2019-01-10 22:48:54 +11:00
Lea Anthony 9167063976 Merge pull request #11 from wailsapp/Port-Build
Made init less verbose
2019-01-09 08:26:56 +11:00
Lea Anthony aaa425724c Made init less verbose 2019-01-09 08:26:19 +11:00
Lea Anthony ffdbb0af64 Merge pull request #10 from wailsapp/Port-Build
updated runtime assets
2019-01-09 08:10:14 +11:00
Lea Anthony 12dec650de updated runtime assets 2019-01-09 06:36:34 +11:00
Lea Anthony d4b2563e9b Merge pull request #9 from wailsapp/Port-Build
mute logging of injected scripts
2019-01-09 06:35:52 +11:00
Lea Anthony 55817b65b5 mute logging of injected scripts 2019-01-09 06:35:22 +11:00
Lea Anthony ab6e7531b4 Merge pull request #8 from wailsapp/Port-Build
Add assets
2019-01-08 21:33:04 +11:00
Lea Anthony 1e4cf9b0ad Add assets 2019-01-08 21:31:50 +11:00
Lea Anthony 13efa58c9a Merge pull request #7 from wailsapp/Port-Build
fixes building on linux
2019-01-08 21:04:35 +11:00
Lea Anthony 88b9b40bfe fixes building on linux
install packr on setup
2019-01-08 21:03:40 +11:00
Lea Anthony 0011e39c55 Merge pull request #6 from wailsapp/Port-Build
Initial Port
2019-01-08 20:15:49 +11:00
Lea Anthony aa6b67734b Initial Port
Updated templates
2019-01-08 17:48:37 +11:00
Lea Anthony 733258cc83 Merge pull request #5 from wailsapp/Port-Build
Initial commit of wails build
2019-01-08 07:59:22 +11:00
Lea Anthony 4742fd7ed2 Initial commit of wails build 2019-01-08 07:58:46 +11:00
Lea Anthony 96996431b4 Merge pull request #4 from wailsapp/Port-Init
Port init
2019-01-07 22:59:27 +11:00
Lea Anthony f06ce760ba fix init 2019-01-07 22:58:25 +11:00
Lea Anthony 53cf2bb953 Only run default command if no args
Add custom template (Frameworks)
2018-12-26 19:09:18 +11:00
Lea Anthony 859b2dd638 Initial commit for Port-Init 2018-12-26 16:27:07 +11:00
Lea Anthony 0225b8588c refactor: change ubuntu npm installation help 2018-12-22 22:59:02 -08:00
Lea Anthony 0bb11079af Merge pull request #1 from wailsapp/Port-Setup
Port setup
2018-12-23 17:36:39 +11:00
Lea Anthony 35d4c4b99c feat: make setup the default command
docs: better help text
2018-12-23 17:33:44 +11:00
Lea Anthony 76a4c3c171 feat: add npm prerequisite for linux and osx 2018-12-23 17:10:32 +11:00
Lea Anthony 5493e1d4ac feat: add windows dependencies 2018-12-23 15:37:51 +11:00
Lea Anthony 807f772055 feat: support checking prerequisites 2018-12-22 18:40:36 -08:00
Lea Anthony 3e97a4cc4d feat: add exit code to run 2018-12-19 12:49:21 -08:00
Lea Anthony 5e42d67570 feat: add linux prereq checking 2018-12-19 12:49:04 -08:00
Lea Anthony 6ecdb43148 feature: show detected os 2018-12-20 07:10:49 +11:00
Lea Anthony ea5e06aabd feat: prerequisite checking (osx) 2018-12-20 06:58:55 +11:00
Lea Anthony 54a88ae3d9 feat: debug config 2018-12-20 06:58:06 +11:00
Lea Anthony 6edd941c1a Initial Linux distro detection 2018-12-16 20:16:40 +11:00
Lea Anthony 04c64c1bea docs: Updated code comments 2018-12-16 18:31:49 +11:00
Lea Anthony db550f81cd Initial commit of the Setup command 2018-12-16 18:28:18 +11:00
Lea Anthony 5de8efff32 Update README 2018-12-16 10:26:34 +11:00
Lea Anthony a591bcc59c Initial commit 2018-12-16 10:14:06 +11:00
234 changed files with 18746 additions and 95295 deletions
+18
View File
@@ -0,0 +1,18 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, build with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
examples/**/example*
!examples/**/*.*
cmd/wails/wails
.DS_Store
tmp
View File
+19
View File
@@ -0,0 +1,19 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/wails/main.go",
"env": {},
"args": [
"setup"
]
}
]
}
-865
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-1300
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-1
View File
@@ -1 +0,0 @@
v3alpha.wails.io
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 wailsapp
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
View File
@@ -0,0 +1 @@
# Coming Soon
+138
View File
@@ -0,0 +1,138 @@
package wails
import (
"github.com/wailsapp/wails/cmd"
)
// -------------------------------- Compile time Flags ------------------------------
// BuildMode indicates what mode we are in
var BuildMode = cmd.BuildModeProd
// ----------------------------------------------------------------------------------
// App defines the main application struct
type App struct {
config *AppConfig // The Application configuration object
cli *cmd.Cli // In debug mode, we have a cli
renderer Renderer // The renderer is what we will render the app to
logLevel string // The log level of the app
ipc *ipcManager // Handles the IPC calls
log *CustomLogger // Logger
bindingManager *bindingManager // Handles binding of Go code to renderer
eventManager *eventManager // Handles all the events
runtime *Runtime // The runtime object for registered structs
// This is a list of all the JS/CSS that needs injecting
// It will get injected in order
jsCache []string
cssCache []string
}
// CreateApp creates the application window with the given configuration
// If none given, the defaults are used
func CreateApp(optionalConfig ...*AppConfig) *App {
var userConfig *AppConfig
if len(optionalConfig) > 0 {
userConfig = optionalConfig[0]
}
result := &App{
logLevel: "info",
renderer: &webViewRenderer{},
ipc: newIPCManager(),
bindingManager: newBindingManager(),
eventManager: newEventManager(),
log: newCustomLogger("App"),
}
appconfig, err := newAppConfig(userConfig)
if err != nil {
result.log.Fatalf("Cannot use custom HTML: %s", err.Error())
}
result.config = appconfig
// Set up the CLI if not in release mode
if BuildMode != cmd.BuildModeProd {
result.cli = result.setupCli()
} else {
// Disable Inspector in release mode
result.config.DisableInspector = true
}
return result
}
// Run the app
func (a *App) Run() error {
if BuildMode != cmd.BuildModeProd {
return a.cli.Run()
}
a.logLevel = "error"
return a.start()
}
func (a *App) start() error {
// Set the log level
setLogLevel(a.logLevel)
// Log starup
a.log.Info("Starting")
// Check if we are to run in headless mode
if BuildMode == cmd.BuildModeBridge {
a.renderer = &Headless{}
}
// Initialise the renderer
err := a.renderer.Initialise(a.config, a.ipc, a.eventManager)
if err != nil {
return err
}
// Start event manager and give it our renderer
a.eventManager.start(a.renderer)
// Start the IPC Manager and give it the event manager and binding manager
a.ipc.start(a.eventManager, a.bindingManager)
// Create the runtime
a.runtime = newRuntime(a.eventManager, a.renderer)
// Start binding manager and give it our renderer
err = a.bindingManager.start(a.renderer, a.runtime)
if err != nil {
return err
}
// Inject CSS
a.renderer.AddCSSList(a.cssCache)
// Inject JS
a.renderer.AddJSList(a.jsCache)
// Run the renderer
a.renderer.Run()
return nil
}
// Bind allows the user to bind the given object
// with the application
func (a *App) Bind(object interface{}) {
a.bindingManager.bind(object)
}
// AddJS adds a piece of Javascript to a cache that
// gets injected at runtime
func (a *App) AddJS(js string) {
a.jsCache = append(a.jsCache, js)
}
// AddCSS adds a CSS string to a cache that
// gets injected at runtime
func (a *App) AddCSS(js string) {
a.cssCache = append(a.cssCache, js)
}
+31
View File
@@ -0,0 +1,31 @@
package wails
import (
"fmt"
"github.com/wailsapp/wails/cmd"
)
// setupCli creates a new cli handler for the application
func (app *App) setupCli() *cmd.Cli {
// Create a new cli
result := cmd.NewCli(app.config.Title, "Debug build")
// Setup cli to handle loglevel and headless flags
result.
StringFlag("loglevel", "Sets the log level [debug|info|error|panic|fatal]. Default debug", &app.logLevel).
// BoolFlag("headless", "Runs the app in headless mode", &app.headless).
Action(app.start)
// Banner
result.PreRun(func(cli *cmd.Cli) error {
log := cmd.NewLogger()
log.PrintSmallBanner()
fmt.Println()
log.YellowUnderline(app.config.Title + " - Debug Build")
return nil
})
return result
}
+97
View File
@@ -0,0 +1,97 @@
package wails
import (
"strings"
"github.com/dchest/htmlmin"
"github.com/leaanthony/mewn"
)
// AppConfig is the configuration structure used when creating a Wails App object
type AppConfig struct {
Width, Height int
Title string
defaultHTML string
HTML string
JS string
CSS string
Colour string
Resizable bool
DisableInspector bool
isHTMLFragment bool
}
func (a *AppConfig) merge(in *AppConfig) error {
if in.CSS != "" {
a.CSS = in.CSS
}
if in.Title != "" {
a.Title = in.Title
}
if in.HTML != "" {
minified, err := htmlmin.Minify([]byte(in.HTML), &htmlmin.Options{
MinifyScripts: true,
})
if err != nil {
return err
}
inlineHTML := string(minified)
inlineHTML = strings.Replace(inlineHTML, "'", "\\'", -1)
inlineHTML = strings.Replace(inlineHTML, "\n", " ", -1)
a.HTML = strings.TrimSpace(inlineHTML)
// Deduce whether this is a full html page or a fragment
// The document is determined to be a fragment if an HMTL
// tag exists and is located before the first div tag
HTMLTagIndex := strings.Index(a.HTML, "<html")
DivTagIndex := strings.Index(a.HTML, "<div")
if HTMLTagIndex == -1 {
a.isHTMLFragment = true
} else {
if DivTagIndex < HTMLTagIndex {
a.isHTMLFragment = true
}
}
}
if in.Colour != "" {
a.Colour = in.Colour
}
if in.JS != "" {
a.JS = in.JS
}
if in.Width != 0 {
a.Width = in.Width
}
if in.Height != 0 {
a.Height = in.Height
}
a.Resizable = in.Resizable
a.DisableInspector = in.DisableInspector
return nil
}
// Creates the default configuration
func newAppConfig(userConfig *AppConfig) (*AppConfig, error) {
result := &AppConfig{
Width: 800,
Height: 600,
Resizable: true,
Title: "My Wails App",
Colour: "#FFF", // White by default
HTML: mewn.String("./wailsruntimeassets/default/default.html"),
}
if userConfig != nil {
err := result.merge(userConfig)
if err != nil {
return nil, err
}
}
return result, nil
}

Some files were not shown because too many files have changed in this diff Show More