From 5460bfcbb6eda559878620a46279aaa02d405d4b Mon Sep 17 00:00:00 2001 From: Pierre Ferran Date: Tue, 4 Jun 2024 19:11:29 -0400 Subject: [PATCH] Fix windows build issue, add vsconfig, add prettier --- .editorconfig | 9 +++++++++ .npmrc | 3 +++ .prettierignore | 6 ++++++ .prettierrc.yaml | 4 ++++ .vscode/extensions.json | 3 +++ .vscode/launch.json | 39 +++++++++++++++++++++++++++++++++++++++ .vscode/settings.json | 11 +++++++++++ backend/src/main.cpp | 7 +++++-- 8 files changed, 80 insertions(+), 2 deletions(-) create mode 100755 .editorconfig create mode 100755 .npmrc create mode 100755 .prettierignore create mode 100755 .prettierrc.yaml create mode 100755 .vscode/extensions.json create mode 100755 .vscode/launch.json create mode 100755 .vscode/settings.json diff --git a/.editorconfig b/.editorconfig new file mode 100755 index 0000000..cf640d5 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100755 index 0000000..2ced952 --- /dev/null +++ b/.npmrc @@ -0,0 +1,3 @@ +electron_mirror=https://npmmirror.com/mirrors/electron/ +electron_builder_binaries_mirror=https://npmmirror.com/mirrors/electron-builder-binaries/ +shamefully-hoist=true diff --git a/.prettierignore b/.prettierignore new file mode 100755 index 0000000..9c6b791 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,6 @@ +out +dist +pnpm-lock.yaml +LICENSE.md +tsconfig.json +tsconfig.*.json diff --git a/.prettierrc.yaml b/.prettierrc.yaml new file mode 100755 index 0000000..35893b3 --- /dev/null +++ b/.prettierrc.yaml @@ -0,0 +1,4 @@ +singleQuote: true +semi: false +printWidth: 100 +trailingComma: none diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100755 index 0000000..940260d --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["dbaeumer.vscode-eslint"] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100755 index 0000000..0b6b9a6 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,39 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug Main Process", + "type": "node", + "request": "launch", + "cwd": "${workspaceRoot}", + "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron-vite", + "windows": { + "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron-vite.cmd" + }, + "runtimeArgs": ["--sourcemap"], + "env": { + "REMOTE_DEBUGGING_PORT": "9222" + } + }, + { + "name": "Debug Renderer Process", + "port": 9222, + "request": "attach", + "type": "chrome", + "webRoot": "${workspaceFolder}/src/renderer", + "timeout": 60000, + "presentation": { + "hidden": true + } + } + ], + "compounds": [ + { + "name": "Debug All", + "configurations": ["Debug Main Process", "Debug Renderer Process"], + "presentation": { + "order": 1 + } + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100755 index 0000000..4c05394 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + } +} diff --git a/backend/src/main.cpp b/backend/src/main.cpp index 4bee359..6794413 100644 --- a/backend/src/main.cpp +++ b/backend/src/main.cpp @@ -1,6 +1,7 @@ #include "afv-native/atcClientWrapper.h" #include "afv-native/event.h" #include "afv-native/hardwareType.h" +#include "spdlog/spdlog.h" #include "spdlog/sinks/rotating_file_sink.h" #include #include @@ -639,12 +640,13 @@ void CreateLoggers() { auto max_size = 1048576 * 5; auto max_files = 3; + std::string fileName = std::string(FileSystem::GetStateFolderPath().string() + "trackaudio.log"); auto trackaudio_logger = spdlog::rotating_logger_mt("trackaudio_logger", - FileSystem::GetStateFolderPath() / "trackaudio.log", max_size, max_files); + fileName, max_size, max_files); spdlog::set_default_logger(trackaudio_logger); auto afv_logger = spdlog::rotating_logger_mt( - "afv_logger", FileSystem::GetStateFolderPath() / "trackaudio.log", max_size, max_files); + "afv_logger", fileName, max_size, max_files); // NOLINTNEXTLINE this cannot be solved here but in afv afv_native::api::setLogger( @@ -739,6 +741,7 @@ Napi::Boolean Exit(const Napi::CallbackInfo& info) MainThreadShared::inputHandler.reset(); mClient.reset(); + spdlog::shutdown(); return Napi::Boolean::New(info.Env(), true); }