Moved asset designs and fixed electron launching.

This commit is contained in:
Tom Butcher 2025-08-23 12:15:48 +01:00
parent 3a9c3b5c1f
commit ae494039f7
85 changed files with 12 additions and 8 deletions

View File

@ -5,6 +5,7 @@
"email": "tom@tombutcher.work"
},
"version": "0.1.0",
"type": "module",
"private": true,
"homepage": "./",
"dependencies": {
@ -69,10 +70,10 @@
"description": "3D Printer ERP and Control Software.",
"scripts": {
"dev": "vite",
"electron": "ELECTRON_START_URL=http://192.168.68.53:3000 electron .",
"electron": "ELECTRON_START_URL=http://0.0.0.0:3000 electron .",
"start": "serve -s build",
"build": "vite build",
"dev:electron": "concurrently \"react-scripts start\" \"ELECTRON_START_URL=http://192.168.68.53:3000 electron public/electron.js\"",
"dev:electron": "concurrently \"vite\" \"ELECTRON_START_URL=http://0.0.0.0:3000 electron public/electron.js\"",
"build:electron": "npm run build && electron-builder"
},
"eslintConfig": {
@ -117,9 +118,8 @@
},
"build": {
"appId": "com.tombutcher.farmcontrol",
"icon": "src/assets/logos/farmcontrolicon.png",
"icon": "assets/logos/farmcontrolicon.png",
"directories": {
"buildResources": "assets",
"output": "app_dist"
},
"files": [

View File

@ -1,5 +1,9 @@
const { app, BrowserWindow, ipcMain, shell } = require('electron')
const path = require('path')
import { app, BrowserWindow, ipcMain, shell } from 'electron'
import path, { dirname } from 'path'
import { fileURLToPath } from 'url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
let win
@ -17,8 +21,8 @@ function createWindow() {
})
// For development, load from localhost; for production, load the built index.html
if (import.meta.env.ELECTRON_START_URL) {
win.loadURL(import.meta.env.ELECTRON_START_URL)
if (process.env.ELECTRON_START_URL) {
win.loadURL(process.env.ELECTRON_START_URL)
} else {
win.loadFile(path.join(__dirname, '../build/index.html'))
}