feature/IO-3066-1-scaffolding: Minor cleanup

This commit is contained in:
Dave Richer
2025-04-16 14:55:11 -04:00
parent 8b7280f66c
commit b683d054ed
10 changed files with 69 additions and 46 deletions

View File

@@ -26,6 +26,14 @@ export default tseslint.config(
...eslintPluginReactHooks.configs.recommended.rules,
...eslintPluginReactRefresh.configs.vite.rules,
},
},
{
files: ["**/*.{js,mjs,ts,tsx,jsx,tsx}"],
rules: {
"prettier/prettier": ["error", {"endOfLine": "off"}]
}
},
eslintConfigPrettier,
);
)

23
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "bodyshop-desktop",
"version": "0.0.1-alpha.2",
"version": "0.0.1-alpha.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "bodyshop-desktop",
"version": "0.0.1-alpha.2",
"version": "0.0.1-alpha.5",
"hasInstallScript": true,
"dependencies": {
"@apollo/client": "^3.13.6",
@@ -27,6 +27,7 @@
"@electron-toolkit/tsconfig": "^1.0.1",
"@playwright/test": "^1.51.1",
"@reduxjs/toolkit": "^2.6.1",
"@types/cors": "^2.8.17",
"@types/express": "^5.0.1",
"@types/lodash": "^4.17.16",
"@types/node": "^22.14.0",
@@ -61,7 +62,7 @@
"react-router": "^7.5.0",
"redux-logger": "^3.0.6",
"typescript": "^5.8.3",
"vite": "^6.2.5"
"vite": "6.2.6"
}
},
"node_modules/@ampproject/remapping": {
@@ -4328,6 +4329,16 @@
"dev": true,
"license": "MIT"
},
"node_modules/@types/cors": {
"version": "2.8.17",
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.17.tgz",
"integrity": "sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/debug": {
"version": "4.1.12",
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz",
@@ -14789,9 +14800,9 @@
}
},
"node_modules/vite": {
"version": "6.2.5",
"resolved": "https://registry.npmjs.org/vite/-/vite-6.2.5.tgz",
"integrity": "sha512-j023J/hCAa4pRIUH6J9HemwYfjB5llR2Ps0CWeikOtdR8+pAURAk0DoJC5/mm9kd+UgdnIy7d6HE4EAvlYhPhA==",
"version": "6.2.6",
"resolved": "https://registry.npmjs.org/vite/-/vite-6.2.6.tgz",
"integrity": "sha512-9xpjNl3kR4rVDZgPNdTL0/c6ao4km69a/2ihNQbcANz8RuCOK3hQBmLSJf3bRKVQjVMda+YvizNE8AwvogcPbw==",
"dev": true,
"license": "MIT",
"dependencies": {

View File

@@ -42,6 +42,7 @@
"@electron-toolkit/tsconfig": "^1.0.1",
"@playwright/test": "^1.51.1",
"@reduxjs/toolkit": "^2.6.1",
"@types/cors": "^2.8.17",
"@types/express": "^5.0.1",
"@types/lodash": "^4.17.16",
"@types/node": "^22.14.0",
@@ -76,6 +77,6 @@
"react-router": "^7.5.0",
"redux-logger": "^3.0.6",
"typescript": "^5.8.3",
"vite": "^6.2.5"
"vite": "6.2.6"
}
}

View File

@@ -12,7 +12,7 @@ import { handlePartsPriceChangeRequest } from "../ppc/ppc-handler";
import { handleQuickBookRequest } from "../quickbooks-desktop/quickbooks-desktop";
export default class LocalServer {
private app: express.Application;
private readonly app: express.Application;
private server: http.Server | null;
private PORT = 1337;
@@ -149,7 +149,7 @@ export default class LocalServer {
);
this.app.post(
"/refresh",
async (req: express.Request, res: express.Response) => {
async (_req: express.Request, res: express.Response) => {
log.debug("[HTTP Server] Refresh request received");
try {
await handleShopMetaDataFetch(true);

View File

@@ -67,6 +67,7 @@ function createWindow(): void {
const template: Electron.MenuItemConstructorOptions[] = [
// { role: 'appMenu' }
// @ts-ignore
...(isMac
? [
{
@@ -89,7 +90,9 @@ function createWindow(): void {
{
label: "File",
submenu: [
// @ts-ignore
...(!isMac ? [{ role: "about" }] : []),
// @ts-ignore
isMac ? { role: "close" } : { role: "quit" },
],
},
@@ -103,6 +106,7 @@ function createWindow(): void {
{ role: "cut" },
{ role: "copy" },
{ role: "paste" },
// @ts-ignore
...(isMac
? [
{ role: "pasteAndMatchStyle" },
@@ -120,6 +124,7 @@ function createWindow(): void {
// { role: 'viewMenu' }
{
label: "View",
// @ts-ignore
submenu: [
{ role: "reload" },
{ role: "forceReload" },
@@ -134,6 +139,7 @@ function createWindow(): void {
},
{
label: "Application",
// @ts-ignore
submenu: [
{
label: "Open on Startup",
@@ -235,6 +241,7 @@ function createWindow(): void {
submenu: [
{ role: "minimize" },
{ role: "zoom" },
// @ts-ignore
...(isMac
? [
{ type: "separator" },
@@ -257,6 +264,7 @@ function createWindow(): void {
// Update the menu to make the hidden item visible
// Find the menu item dynamically by its id
const fileMenu = template.find((item) => item.label === "Application");
// @ts-ignore
const hiddenItem = fileMenu?.submenu?.find(
(item) => item.id === "development",
);
@@ -375,7 +383,7 @@ app.whenReady().then(async () => {
// module.someFunction()
log.debug("Successfully loaded ipcMainConfig", module);
} catch (error) {
log.error("Failed to load ipcMainconfig", {
log.error("Failed to load ipcMainConfig", {
...ErrorTypeCheck(error),
});
}
@@ -409,7 +417,7 @@ app.whenReady().then(async () => {
// if (import.meta.env.DEV) {
// // Useful for some dev/debugging tasks, but download can
// // not be validated becuase dev app is not signed
// // not be validated because dev app is not signed
// autoUpdater.channel = "alpha";
// autoUpdater.updateConfigPath = path.join(
// __dirname,

View File

@@ -38,8 +38,7 @@ const SettingsWatchedFilePathsRemove = async (
};
const SettingsWatchedFilePathsGet = async (): Promise<string[]> => {
const filepaths: string[] = Store.get("settings.filepaths") || [];
return filepaths;
return Store.get("settings.filepaths") || [];
};
const SettingsWatcherPollingGet = async (): Promise<{
@@ -66,7 +65,7 @@ const SettingsWatcherPollingSet = async (
//Restart the watcher with these new settings.
await StopWatcher();
StartWatcher();
await StartWatcher();
return { enabled, interval };
};

View File

@@ -48,7 +48,7 @@ const ipcMainHandleAuthStateChanged = async (
};
const handleShopMetaDataFetch = async (
reloadWindow: boolean,
reloadWindow?: boolean,
): Promise<void> => {
try {
log.debug("Requery shop information & master data.");

View File

@@ -3,9 +3,9 @@ import fs from "fs";
import path from "path";
import errorTypeCheck from "../../util/errorTypeCheck";
const createdDirectoryIfNotExist = async (dirpath: string) => {
const createdDirectoryIfNotExist = async (dirPath: string) => {
try {
const directoryPath = path.dirname(dirpath);
const directoryPath = path.dirname(dirPath);
if (!fs.existsSync(directoryPath)) {
log.info(`Directory does not exist. Creating: ${directoryPath}`);
fs.mkdirSync(directoryPath, { recursive: true });

View File

@@ -2,8 +2,7 @@ import { BrowserWindow } from "electron";
import log from "electron-log/main";
const getMainWindow = (): Electron.BrowserWindow => {
const mainWindow = BrowserWindow.getAllWindows()[0];
return mainWindow;
return BrowserWindow.getAllWindows()[0];
};
const sendIpcToRenderer = (ipcMessage: string, ...args: any[]): void => {

View File

@@ -13,12 +13,9 @@ function uppercaseObjectKeys<T extends Record<string, any>>(
return Object.entries(obj).reduce(
(result, [key, value]) => {
const uppercaseKey = key.toUpperCase();
const newValue =
typeof value === "object" && value !== null
result[uppercaseKey] = typeof value === "object" && value !== null
? uppercaseObjectKeys(value)
: value;
result[uppercaseKey] = newValue;
return result;
},
{} as Record<string, any>,