mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 21:29:17 -07:00
Compare commits
2 Commits
angular-fi
...
windows-fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68f7c4c7bd | ||
|
|
c07900e555 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -16,4 +16,5 @@ examples/**/example*
|
||||
cmd/wails/wails
|
||||
.DS_Store
|
||||
tmp
|
||||
node_modules/
|
||||
node_modules/
|
||||
/runtime/js/runtime/dist
|
||||
@@ -20,4 +20,4 @@ Wails is what it is because of the time and effort given by these great people.
|
||||
* [Toyam Cox](https://github.com/Vaelatern)
|
||||
* [Robin Eklind](https://github.com/mewmew)
|
||||
* [Kris Raney](https://github.com/kraney)
|
||||
* [Jack Mordaunt](https://github.com/JackMordaunt)
|
||||
* [soon cheol shin](https://github.com/scshin0572)
|
||||
|
||||
27
app.go
27
app.go
@@ -1,7 +1,6 @@
|
||||
package wails
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"syscall"
|
||||
@@ -45,7 +44,7 @@ func CreateApp(optionalConfig ...*AppConfig) *App {
|
||||
}
|
||||
|
||||
result := &App{
|
||||
logLevel: "info",
|
||||
logLevel: "debug",
|
||||
renderer: renderer.NewWebView(),
|
||||
ipc: ipc.NewManager(),
|
||||
bindingManager: binding.NewManager(),
|
||||
@@ -67,28 +66,9 @@ func CreateApp(optionalConfig ...*AppConfig) *App {
|
||||
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
|
||||
}
|
||||
|
||||
// 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
|
||||
func (a *App) Run() error {
|
||||
|
||||
@@ -123,6 +103,11 @@ func (a *App) start() error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Set debug mode
|
||||
if runtime.GOOS == "windows" && BuildMode == cmd.BuildModeDebug {
|
||||
a.renderer.EnableDebug()
|
||||
}
|
||||
|
||||
// Start signal handler
|
||||
t := tebata.New(os.Interrupt, os.Kill, syscall.SIGTERM, syscall.SIGINT, syscall.SIGKILL)
|
||||
t.Reserve(func() {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -22,7 +22,6 @@
|
||||
"@angular/platform-browser-dynamic": "~8.0.1",
|
||||
"@angular/router": "~8.0.1",
|
||||
"@wailsapp/runtime": "^1.0.0",
|
||||
"core-js": "^3.4.4",
|
||||
"ngx-build-plus": "^8.0.3",
|
||||
"rxjs": "~6.4.0",
|
||||
"tslib": "^1.9.0",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'core-js/stable';
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"target": "es5",
|
||||
"target": "es2015",
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
],
|
||||
@@ -20,4 +20,4 @@
|
||||
"dom"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ func basic() string {
|
||||
|
||||
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")
|
||||
|
||||
app := wails.CreateApp(&wails.AppConfig{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package cmd
|
||||
|
||||
// Version - Wails version
|
||||
const Version = "v0.19.0"
|
||||
const Version = "v0.18.14-pre"
|
||||
|
||||
12
config.go
12
config.go
@@ -94,12 +94,12 @@ func (a *AppConfig) merge(in *AppConfig) error {
|
||||
// Creates the default configuration
|
||||
func newConfig(userConfig *AppConfig) (*AppConfig, error) {
|
||||
result := &AppConfig{
|
||||
Width: 800,
|
||||
Height: 600,
|
||||
Resizable: true,
|
||||
Title: "My Wails App",
|
||||
Colour: "#FFF", // White by default
|
||||
HTML: mewn.String("./runtime/assets/default.html"),
|
||||
Width: 800,
|
||||
Height: 600,
|
||||
Resizable: true,
|
||||
Title: "My Wails App",
|
||||
Colour: "#FFF", // White by default
|
||||
defaultHTML: mewn.String("./runtime/assets/default.html"),
|
||||
}
|
||||
|
||||
if userConfig != nil {
|
||||
|
||||
@@ -3,10 +3,12 @@ package interfaces
|
||||
import (
|
||||
"github.com/wailsapp/wails/lib/messages"
|
||||
)
|
||||
|
||||
// Renderer is an interface describing a Wails target to render the app to
|
||||
type Renderer interface {
|
||||
Initialise(AppConfig, IPCManager, EventManager) error
|
||||
Run() error
|
||||
EnableDebug()
|
||||
|
||||
// Binding
|
||||
NewBinding(bindingName string) error
|
||||
|
||||
@@ -48,6 +48,9 @@ type Bridge struct {
|
||||
|
||||
// Mutex for writing to the socket
|
||||
lock sync.Mutex
|
||||
|
||||
// debug
|
||||
debug bool
|
||||
}
|
||||
|
||||
// Initialise the Bridge Renderer
|
||||
@@ -74,6 +77,11 @@ func (h *Bridge) evalJS(js string, mtype messageType) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// EnableDebug enables debug!
|
||||
func (h *Bridge) EnableDebug() {
|
||||
h.debug = true
|
||||
}
|
||||
|
||||
func (h *Bridge) injectCSS(css string) {
|
||||
// Minify css to overcome issues in the browser with carriage returns
|
||||
minified, err := htmlmin.Minify([]byte(css), &htmlmin.Options{
|
||||
@@ -117,7 +125,6 @@ func (h *Bridge) sendMessage(conn *websocket.Conn, msg string) {
|
||||
|
||||
func (h *Bridge) start(conn *websocket.Conn) {
|
||||
|
||||
// set external.invoke
|
||||
h.log.Infof("Connected to frontend.")
|
||||
|
||||
wailsRuntime := mewn.String("../../runtime/assets/wails.js")
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -25,6 +25,7 @@ type WebView struct {
|
||||
config interfaces.AppConfig
|
||||
eventManager interfaces.EventManager
|
||||
bindingCache []string
|
||||
debug bool
|
||||
}
|
||||
|
||||
// NewWebView returns a new WebView struct
|
||||
@@ -48,13 +49,22 @@ func (w *WebView) Initialise(config interfaces.AppConfig, ipc interfaces.IPCMana
|
||||
// Save the config
|
||||
w.config = config
|
||||
|
||||
// defaulthtml
|
||||
HTML := config.GetDefaultHTML()
|
||||
if len(HTML) == 0 {
|
||||
HTML = mewn.String("../../runtime/assets/default.html")
|
||||
}
|
||||
|
||||
HTML = fmt.Sprintf("data:text/html,%s", HTML)
|
||||
fmt.Printf("*** %s ***", HTML)
|
||||
w.log.Infof("URL: %s", HTML)
|
||||
// Create the WebView instance
|
||||
w.window = wv.NewWebview(wv.Settings{
|
||||
Width: config.GetWidth(),
|
||||
Height: config.GetHeight(),
|
||||
Title: config.GetTitle(),
|
||||
Resizable: config.GetResizable(),
|
||||
URL: config.GetDefaultHTML(),
|
||||
URL: HTML,
|
||||
Debug: !config.GetDisableInspector(),
|
||||
ExternalInvokeCallback: func(_ wv.WebView, message string) {
|
||||
w.ipc.Dispatch(message)
|
||||
@@ -95,6 +105,7 @@ func (w *WebView) evalJS(js string) error {
|
||||
if len(js) > 45 {
|
||||
outputJS += "..."
|
||||
}
|
||||
// var outputJS = js
|
||||
w.log.DebugFields("Eval", logger.Fields{"js": outputJS})
|
||||
//
|
||||
w.window.Dispatch(func() {
|
||||
@@ -103,6 +114,11 @@ func (w *WebView) evalJS(js string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// EnableDebug enables debug!
|
||||
func (w *WebView) EnableDebug() {
|
||||
w.debug = true
|
||||
}
|
||||
|
||||
// Escape the Javascripts!
|
||||
func escapeJS(js string) (string, error) {
|
||||
result := strings.Replace(js, "\\", "\\\\", -1)
|
||||
@@ -172,51 +188,58 @@ func (w *WebView) Run() error {
|
||||
|
||||
w.log.Info("Running...")
|
||||
|
||||
// Runtime assets
|
||||
wailsRuntime := mewn.String("../../runtime/assets/wails.js")
|
||||
w.evalJS(wailsRuntime)
|
||||
// Inject firebug in debug mode on Windows
|
||||
if w.debug {
|
||||
w.log.Debug("Injecting firebug")
|
||||
// firebugLite := mewn.String("../../runtime/assets/injectFirebug.js")
|
||||
// w.evalJS(firebugLite)
|
||||
}
|
||||
|
||||
// Ping the wait channel when the wails runtime is loaded
|
||||
w.eventManager.On("wails:loaded", func(...interface{}) {
|
||||
// // Runtime assets
|
||||
// wailsRuntime := mewn.String("../../runtime/assets/wails.js")
|
||||
// w.evalJS(wailsRuntime)
|
||||
|
||||
// Run this in a different go routine to free up the main process
|
||||
go func() {
|
||||
// // Ping the wait channel when the wails runtime is loaded
|
||||
// w.eventManager.On("wails:loaded", func(...interface{}) {
|
||||
|
||||
// Inject Bindings
|
||||
for _, binding := range w.bindingCache {
|
||||
w.evalJSSync(binding)
|
||||
}
|
||||
// // Run this in a different go routine to free up the main process
|
||||
// go func() {
|
||||
|
||||
// Inject user CSS
|
||||
if w.config.GetCSS() != "" {
|
||||
outputCSS := fmt.Sprintf("%.45s", w.config.GetCSS())
|
||||
if len(outputCSS) > 45 {
|
||||
outputCSS += "..."
|
||||
}
|
||||
w.log.DebugFields("Inject User CSS", logger.Fields{"css": outputCSS})
|
||||
w.injectCSS(w.config.GetCSS())
|
||||
} else {
|
||||
// Use default wails css
|
||||
w.log.Debug("Injecting Default Wails CSS")
|
||||
defaultCSS := mewn.String("../../runtime/assets/wails.css")
|
||||
// // Inject Bindings
|
||||
// for _, binding := range w.bindingCache {
|
||||
// w.evalJSSync(binding)
|
||||
// }
|
||||
|
||||
w.injectCSS(defaultCSS)
|
||||
}
|
||||
// // Inject user CSS
|
||||
// if w.config.GetCSS() != "" {
|
||||
// outputCSS := fmt.Sprintf("%.45s", w.config.GetCSS())
|
||||
// if len(outputCSS) > 45 {
|
||||
// outputCSS += "..."
|
||||
// }
|
||||
// w.log.DebugFields("Inject User CSS", logger.Fields{"css": outputCSS})
|
||||
// w.injectCSS(w.config.GetCSS())
|
||||
// } else {
|
||||
// // Use default wails css
|
||||
// w.log.Debug("Injecting Default Wails CSS")
|
||||
// defaultCSS := mewn.String("../../runtime/assets/wails.css")
|
||||
|
||||
// Inject user JS
|
||||
if w.config.GetJS() != "" {
|
||||
outputJS := fmt.Sprintf("%.45s", w.config.GetJS())
|
||||
if len(outputJS) > 45 {
|
||||
outputJS += "..."
|
||||
}
|
||||
w.log.DebugFields("Inject User JS", logger.Fields{"js": outputJS})
|
||||
w.evalJSSync(w.config.GetJS())
|
||||
}
|
||||
// w.injectCSS(defaultCSS)
|
||||
// }
|
||||
|
||||
// Emit that everything is loaded and ready
|
||||
w.eventManager.Emit("wails:ready")
|
||||
}()
|
||||
})
|
||||
// // Inject user JS
|
||||
// if w.config.GetJS() != "" {
|
||||
// outputJS := fmt.Sprintf("%.45s", w.config.GetJS())
|
||||
// if len(outputJS) > 45 {
|
||||
// outputJS += "..."
|
||||
// }
|
||||
// w.log.DebugFields("Inject User JS", logger.Fields{"js": outputJS})
|
||||
// w.evalJSSync(w.config.GetJS())
|
||||
// }
|
||||
|
||||
// // Emit that everything is loaded and ready
|
||||
// w.eventManager.Emit("wails:ready")
|
||||
// }()
|
||||
// })
|
||||
|
||||
// Kick off main window loop
|
||||
w.window.Run()
|
||||
|
||||
@@ -13,7 +13,7 @@ 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 CFLAGS: -DWEBVIEW_WINAPI=1 -std=c99 -DUNICODE=1 -D_UNICODE=1
|
||||
#cgo windows LDFLAGS: -lole32 -lcomctl32 -loleaut32 -luuid -lgdi32
|
||||
|
||||
#cgo darwin CFLAGS: -DWEBVIEW_COCOA=1 -x objective-c
|
||||
|
||||
@@ -58,6 +58,7 @@ extern "C"
|
||||
#elif defined(WEBVIEW_WINAPI)
|
||||
#define CINTERFACE
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#include <commctrl.h>
|
||||
#include <exdisp.h>
|
||||
@@ -1350,8 +1351,8 @@ struct webview_priv
|
||||
}
|
||||
|
||||
#define WEBVIEW_KEY_FEATURE_BROWSER_EMULATION \
|
||||
"Software\\Microsoft\\Internet " \
|
||||
"Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION"
|
||||
_T("Software\\Microsoft\\Internet " \
|
||||
"Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION")
|
||||
|
||||
static int webview_fix_ie_compat_mode()
|
||||
{
|
||||
@@ -1363,7 +1364,7 @@ struct webview_priv
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
for (p = &appname[strlen(appname) - 1]; p != appname && *p != '\\'; p--)
|
||||
for (p = &appname[_tcslen(appname) - 1]; p != appname && *p != _T('\\'); p--)
|
||||
{
|
||||
}
|
||||
p++;
|
||||
@@ -1872,14 +1873,30 @@ struct webview_priv
|
||||
type |= MB_ICONERROR;
|
||||
break;
|
||||
}
|
||||
#ifdef UNICODE
|
||||
WCHAR *wtitle = webview_to_utf16(title);
|
||||
WCHAR *warg = webview_to_utf16(arg);
|
||||
MessageBox(w->priv.hwnd, warg, wtitle, type);
|
||||
GlobalFree(warg);
|
||||
GlobalFree(wtitle);
|
||||
#else
|
||||
MessageBox(w->priv.hwnd, arg, title, type);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
WEBVIEW_API void webview_terminate(struct webview *w) { PostQuitMessage(0); }
|
||||
WEBVIEW_API void webview_exit(struct webview *w) { OleUninitialize(); }
|
||||
WEBVIEW_API void webview_print_log(const char *s) { OutputDebugString(s); }
|
||||
WEBVIEW_API void webview_print_log(const char *s) {
|
||||
#ifdef UNICODE
|
||||
WCHAR *ws = webview_to_utf16(s);
|
||||
OutputDebugString(ws);
|
||||
GlobalFree(ws);
|
||||
#else
|
||||
OutputDebugString(s);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* WEBVIEW_WINAPI */
|
||||
|
||||
|
||||
@@ -204,7 +204,12 @@ function start(callback) {
|
||||
}
|
||||
|
||||
function Init(callback) {
|
||||
// Bridge window.invoke
|
||||
window.invoke = function (message) {
|
||||
window.wailsbridge.websocket.send(message);
|
||||
}
|
||||
|
||||
start(callback);
|
||||
}
|
||||
|
||||
module.exports = Init;
|
||||
module.exports = Init;
|
||||
@@ -1,18 +1 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="text/javascript">function AddScript(js, callbackID) {
|
||||
var script = document.createElement('script');
|
||||
script.text = js;
|
||||
document.body.appendChild(script);
|
||||
}</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><script src="https://raw.githubusercontent.com/firebug/firebug-lite/master/build/firebug-lite-debug.js#startOpened=true"></script></head><body><div id="app"></div><script type="text/javascript">function AddScript(js, callbackID){var script = document.createElement('script');script.text=js;document.body.appendChild(script);}</script></body></html>
|
||||
10945
runtime/assets/firebug-lite.js
Normal file
10945
runtime/assets/firebug-lite.js
Normal file
File diff suppressed because one or more lines are too long
1
runtime/assets/injectFirebug.js
Normal file
1
runtime/assets/injectFirebug.js
Normal file
@@ -0,0 +1 @@
|
||||
(function(){console.log=function(message){document.body.innerHTML=document.body.innerHTML+'<p>'+message+'</p>';};var script=document.createElement('script');script.src="https://raw.githubusercontent.com/firebug/firebug-lite/master/build/firebug-lite-debug.js#startOpened=true";document.body.appendChild(script);})();
|
||||
File diff suppressed because one or more lines are too long
@@ -25,4 +25,4 @@
|
||||
"always"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ module.exports = function (api) {
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"useBuiltIns": "entry",
|
||||
"useBuiltIns": "usage",
|
||||
"corejs": {
|
||||
"version": 3,
|
||||
"proposals": true
|
||||
@@ -16,7 +16,10 @@ module.exports = function (api) {
|
||||
]
|
||||
];
|
||||
|
||||
const plugins = ["@babel/plugin-transform-object-assign", "transform-es2015-shorthand-properties"]
|
||||
|
||||
return {
|
||||
presets,
|
||||
plugins
|
||||
};
|
||||
}
|
||||
37
runtime/js/bridge/webpack.config.js
Normal file
37
runtime/js/bridge/webpack.config.js
Normal file
@@ -0,0 +1,37 @@
|
||||
/* eslint-disable */
|
||||
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: './bridge.js',
|
||||
mode: 'production',
|
||||
output: {
|
||||
path: path.resolve(__dirname, '..', 'assets'),
|
||||
filename: 'bridge.js',
|
||||
libraryTarget: 'this'
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.m?js$/,
|
||||
exclude: /(node_modules|bower_components)/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
plugins: [],
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
'useBuiltIns': 'usage',
|
||||
'corejs': 3,
|
||||
'targets': { "browsers": ["last 2 versions", "ie >= 9"] }
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
@@ -46,16 +46,6 @@ var runtime = {
|
||||
// Augment global
|
||||
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('wails:loaded');
|
||||
|
||||
|
||||
1838
runtime/js/package-lock.json
generated
1838
runtime/js/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -33,11 +33,15 @@
|
||||
"@babel/core": "^7.5.4",
|
||||
"@babel/plugin-transform-object-assign": "^7.2.0",
|
||||
"@babel/preset-env": "^7.5.4",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-loader": "^8.0.6",
|
||||
"babel-plugin-transform-es2015-shorthand-properties": "^6.24.1",
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"babel-preset-minify": "^0.5.0",
|
||||
"core-js": "^3.1.4",
|
||||
"eslint": "^6.5.1",
|
||||
"webpack": "^4.35.3",
|
||||
"webpack": "^4.41.2",
|
||||
"webpack-cli": "^3.3.5"
|
||||
}
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
|
||||
4322
runtime/js/runtime/package-lock.json
generated
Normal file
4322
runtime/js/runtime/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,12 @@
|
||||
{
|
||||
"name": "@wailsapp/runtime",
|
||||
"version": "1.0.9",
|
||||
"version": "1.0.8",
|
||||
"description": "Wails Javascript runtime library",
|
||||
"main": "main.js",
|
||||
"types": "runtime.d.ts",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"build": "webpack"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -21,8 +22,18 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/wailsapp/wails/issues"
|
||||
},
|
||||
"files": [
|
||||
"*.js",
|
||||
"!webpack.config.js",
|
||||
"runtime.d.ts",
|
||||
"README.md"
|
||||
],
|
||||
"homepage": "https://github.com/wailsapp/wails#readme",
|
||||
"devDependencies": {
|
||||
"dts-gen": "^0.5.8"
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-loader": "^8.0.6",
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"dts-gen": "^0.5.8",
|
||||
"webpack": "^4.41.2"
|
||||
}
|
||||
}
|
||||
|
||||
37
runtime/js/runtime/webpack.config.js
Normal file
37
runtime/js/runtime/webpack.config.js
Normal file
@@ -0,0 +1,37 @@
|
||||
/* eslint-disable */
|
||||
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: './main.js',
|
||||
mode: 'production',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'main.js',
|
||||
libraryTarget: 'this'
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.m?js$/,
|
||||
exclude: /(node_modules|bower_components)/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
plugins: [],
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
'useBuiltIns': 'usage',
|
||||
'corejs': 3,
|
||||
'targets': { "browsers": ["last 2 versions", "ie >= 9"] }
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
@@ -17,16 +17,14 @@ module.exports = {
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
plugins: ['@babel/plugin-transform-object-assign'],
|
||||
plugins: [],
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
'useBuiltIns': 'entry',
|
||||
'corejs': {
|
||||
'version': 3,
|
||||
'proposals': true
|
||||
}
|
||||
'useBuiltIns': 'usage',
|
||||
'corejs': 3,
|
||||
'targets': { "browsers": ["last 2 versions", "ie >= 9"] }
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
@@ -44,7 +44,6 @@ 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()
|
||||
@@ -60,7 +59,6 @@ func main() {
|
||||
fmt.Println("**** Building Runtime ****")
|
||||
runtimeDir, _ := filepath.Abs(filepath.Join(dir, "..", "runtime", "js"))
|
||||
os.Chdir(runtimeDir)
|
||||
runCommand("npm", "install")
|
||||
runCommand("npm", "run", "build")
|
||||
|
||||
// Pack assets
|
||||
|
||||
Reference in New Issue
Block a user