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" "email": "tom@tombutcher.work"
}, },
"version": "0.1.0", "version": "0.1.0",
"type": "module",
"private": true, "private": true,
"homepage": "./", "homepage": "./",
"dependencies": { "dependencies": {
@ -69,10 +70,10 @@
"description": "3D Printer ERP and Control Software.", "description": "3D Printer ERP and Control Software.",
"scripts": { "scripts": {
"dev": "vite", "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", "start": "serve -s build",
"build": "vite 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" "build:electron": "npm run build && electron-builder"
}, },
"eslintConfig": { "eslintConfig": {
@ -117,9 +118,8 @@
}, },
"build": { "build": {
"appId": "com.tombutcher.farmcontrol", "appId": "com.tombutcher.farmcontrol",
"icon": "src/assets/logos/farmcontrolicon.png", "icon": "assets/logos/farmcontrolicon.png",
"directories": { "directories": {
"buildResources": "assets",
"output": "app_dist" "output": "app_dist"
}, },
"files": [ "files": [

View File

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