Chore/tidy up (#1713)

* Tidy up dev mode output

* Rename `appng` package to `app`

* Remove `crypto`,`parse`,`messagedispatcher`,`servicebus`,`runtime`,`subsystem`,`ffenestri` packages and `.vscode` dir

* Remove misc `fs` functions

* Remove `str` package

* Fix redundant alias
This commit is contained in:
Lea Anthony
2022-08-09 07:42:11 +10:00
committed by GitHub
parent c13c4a29f5
commit 57c9158551
103 changed files with 19 additions and 26894 deletions
-3
View File
@@ -27,8 +27,5 @@ v2/pkg/parser/testproject/frontend/wails
v2/test/kitchensink/frontend/public
v2/test/kitchensink/build/darwin/desktop/kitchensink
v2/test/kitchensink/frontend/package.json.md5
/v2/internal/ffenestri/windows/test/cmake-build-debug/
!v2/internal/ffenestri/windows/x64/webview2.dll
!v2/internal/ffenestri/windows/x64/WebView2Loader.dll
.idea/
v2/cmd/wails/internal/commands/initialise/templates/testtemplates/
-48
View File
@@ -1,48 +0,0 @@
{
// 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": "Test cmd package",
"type": "go",
"request": "launch",
"mode": "test",
"program": "${workspaceFolder}/cmd/"
},
{
"name": "Wails Init",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/wails/main.go",
"env": {},
"cwd": "/tmp",
"args": [
"init",
"-name",
"runtime",
"-dir",
"runtime",
"-output",
"runtime",
"-template",
"vuebasic"
]
},
{
"name": "Wails Update Pre",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/wails/main.go",
"env": {},
"cwd": "/tmp",
"args": [
"update",
"-pre"
]
}
]
}
-8
View File
@@ -1,8 +0,0 @@
{
"go.formatTool": "goimports",
"eslint.alwaysShowStatus": true,
"files.associations": {
"__locale": "c",
"ios": "c"
}
}
@@ -485,13 +485,11 @@ func runFrontendDevWatcherCommand(cwd string, devCommand string, discoverViteSer
}
}
atomic.StoreInt32(&state, stateStopped)
LogGreen("DevWatcher command exited!")
wg.Done()
}()
return func() {
if atomic.CompareAndSwapInt32(&state, stateRunning, stateCanceling) {
LogGreen("Killing DevWatcher command...")
killProc(cmd, devCommand)
}
cancel()
@@ -4,7 +4,7 @@
package dev
import (
"os"
"bytes"
"os/exec"
"strconv"
)
@@ -16,11 +16,15 @@ func killProc(cmd *exec.Cmd, devCommand string) {
// For whatever reason, killing an npm script on windows just doesn't exit properly with cancel
if cmd != nil && cmd.Process != nil {
kill := exec.Command("TASKKILL", "/T", "/F", "/PID", strconv.Itoa(cmd.Process.Pid))
kill.Stderr = os.Stderr
kill.Stdout = os.Stdout
var errorBuffer bytes.Buffer
var stdoutBuffer bytes.Buffer
kill.Stderr = &errorBuffer
kill.Stdout = &stdoutBuffer
err := kill.Run()
if err != nil {
if err.Error() != "exit status 1" {
println(stdoutBuffer.String())
println(errorBuffer.String())
LogRed("Error from '%s': %s", devCommand, err.Error())
}
}
@@ -1,7 +1,7 @@
//go:build bindings
// +build bindings
package appng
package app
import (
"os"
@@ -1,7 +1,7 @@
//go:build darwin && !bindings
// +build darwin,!bindings
package appng
package app
import (
"github.com/wailsapp/wails/v2/internal/logger"
@@ -1,7 +1,7 @@
//go:build debug
// +build debug
package appng
package app
func IsDebug() bool {
return true
@@ -1,7 +1,7 @@
//go:build !dev && !production && !bindings && darwin
// +build !dev,!production,!bindings,darwin
package appng
package app
import (
"fmt"
@@ -1,7 +1,7 @@
//go:build !dev && !production && !bindings && linux
// +build !dev,!production,!bindings,linux
package appng
package app
import (
"fmt"
@@ -1,7 +1,7 @@
//go:build !dev && !production && !bindings && windows
// +build !dev,!production,!bindings,windows
package appng
package app
import (
"os/exec"
@@ -1,7 +1,7 @@
//go:build dev
// +build dev
package appng
package app
import (
"context"
@@ -1,7 +1,7 @@
//go:build linux && !bindings
// +build linux,!bindings
package appng
package app
import (
"github.com/wailsapp/wails/v2/internal/logger"
@@ -1,7 +1,7 @@
//go:build !debug
// +build !debug
package appng
package app
func IsDebug() bool {
return false
@@ -1,7 +1,7 @@
//go:build production
// +build production
package appng
package app
import (
"context"
@@ -1,7 +1,7 @@
//go:build windows && !bindings
// +build windows,!bindings
package appng
package app
import (
"github.com/wailsapp/wails/v2/internal/logger"
-17
View File
@@ -1,17 +0,0 @@
package crypto
import (
"crypto/rand"
"fmt"
"log"
)
// RandomID returns a random ID as a string
func RandomID() string {
b := make([]byte, 16)
_, err := rand.Read(b)
if err != nil {
log.Fatal(err)
}
return fmt.Sprintf("%x", b)
}
-19
View File
@@ -1,19 +0,0 @@
# 3rd Party Licenses
## Webview
Whilst not using the library directly, there is certainly some code that is inspired by or used from the webview library.
Homepage: https://github.com/webview/webview
License: https://github.com/webview/webview/blob/master/LICENSE
## vec
Homepage: https://github.com/rxi/vec
License: https://github.com/rxi/vec/blob/master/LICENSE
## json
Homepage: http://git.ozlabs.org/?p=ccan;a=tree;f=ccan/json;hb=HEAD
License: http://git.ozlabs.org/?p=ccan;a=blob;f=licenses/BSD-MIT;h=89de354795ec7a7cdab07c091029653d3618540d;hb=HEAD
## hashmap
Homepage: https://github.com/sheredom/hashmap.h
License: https://github.com/sheredom/hashmap.h/blob/master/LICENSE
-7
View File
@@ -1,7 +0,0 @@
## Windows
- Left and Right Win keys act the same
- Accelerators will automatically add appropriate text into the menu items. This can be prevented by adding a tab
character to the menu label
- Tooltips + styling with font currently unsupported
-
-98
View File
@@ -1,98 +0,0 @@
// +build !windows
//
// Created by Lea Anthony on 6/1/21.
//
#include "common.h"
// Credit: https://stackoverflow.com/a/8465083
char* concat(const char *string1, const char *string2)
{
const size_t len1 = strlen(string1);
const size_t len2 = strlen(string2);
char *result = malloc(len1 + len2 + 1);
strcpy(result, string1);
memcpy(result + len1, string2, len2 + 1);
return result;
}
// 10k is more than enough for a log message
#define MAXMESSAGE 1024*10
char abortbuffer[MAXMESSAGE];
void ABORT(const char *message, ...) {
const char *temp = concat("FATAL: ", message);
va_list args;
va_start(args, message);
vsnprintf(abortbuffer, MAXMESSAGE, temp, args);
printf("%s\n", &abortbuffer[0]);
MEMFREE(temp);
va_end(args);
exit(1);
}
int freeHashmapItem(void *const context, struct hashmap_element_s *const e) {
free(e->data);
return -1;
}
const char* getJSONString(JsonNode *item, const char* key) {
// Get key
JsonNode *node = json_find_member(item, key);
const char *result = "";
if ( node != NULL && node->tag == JSON_STRING) {
result = node->string_;
}
return result;
}
void ABORT_JSON(JsonNode *node, const char* key) {
ABORT("Unable to read required key '%s' from JSON: %s\n", key, json_encode(node));
}
const char* mustJSONString(JsonNode *node, const char* key) {
const char* result = getJSONString(node, key);
if ( result == NULL ) {
ABORT_JSON(node, key);
}
return result;
}
JsonNode* mustJSONObject(JsonNode *node, const char* key) {
struct JsonNode* result = getJSONObject(node, key);
if ( result == NULL ) {
ABORT_JSON(node, key);
}
return result;
}
JsonNode* getJSONObject(JsonNode* node, const char* key) {
return json_find_member(node, key);
}
bool getJSONBool(JsonNode *item, const char* key, bool *result) {
JsonNode *node = json_find_member(item, key);
if ( node != NULL && node->tag == JSON_BOOL) {
*result = node->bool_;
return true;
}
return false;
}
bool getJSONInt(JsonNode *item, const char* key, int *result) {
JsonNode *node = json_find_member(item, key);
if ( node != NULL && node->tag == JSON_NUMBER) {
*result = (int) node->number_;
return true;
}
return false;
}
JsonNode* mustParseJSON(const char* JSON) {
JsonNode* parsedUpdate = json_decode(JSON);
if ( parsedUpdate == NULL ) {
ABORT("Unable to decode JSON: %s\n", JSON);
}
return parsedUpdate;
}

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