From fcdcbfb21c2fd7b01f3d99a3a5f6cc6e3611d608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=A6=E4=B8=B6=E9=9A=8F=E5=BF=83=E9=A3=9E?= <420443292@qq.com> Date: Wed, 30 Aug 2023 07:46:33 +0800 Subject: [PATCH] update --- README.MD | 3 ++- package.json | 11 ++++++----- src/main.js | 12 ++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/README.MD b/README.MD index e5b4f8b..0a562ca 100644 --- a/README.MD +++ b/README.MD @@ -20,9 +20,10 @@ - 开发环境 ```sh - git clone https://git.unlock-music.dev/um/um-react.git && npm install --frozen-lockfile + git clone https://git.unlock-music.dev/um/um-react.git && npm install --frozen-lockfile cd ../ && npm install npm run start / npm run dev + npm run start / npm run dev ``` - 打包 ```sh diff --git a/package.json b/package.json index 6285815..6268d05 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,13 @@ "scripts": { "format": "prettier --write .", "lint": "eslint --ext .js .", - "dev": "cd um-react && npm run start & electron .", - "start": "cd um-react && npm run start & electron .", + "dev": "cd um-react && npm run build && cp -r ./dist ../src/renderer && cd ../ && electron .", + "start": "cd um-react && npm run build && cp -r ./dist ../src/renderer && cd ../ && electron .", "postinstall": "electron-builder install-app-deps", - "build:win": "cd um-react && npm run build && cd ../ && electron-builder --win --config", - "build:mac": "cd um-react && npm run build && cd ../ && electron-builder --mac --config", - "build:linux": "cd um-react && npm run build && cd ../ && electron-builder --linux --config" + "build": "cd um-react && npm run build && cp -r ./dist ../src/renderer && cd ../", + "build:win": "cd um-react && npm run build && cp -r ./dist ../src/renderer && cd ../ && electron-builder --win --config", + "build:mac": "cd um-react && npm run build && cp -r ./dist ../src/renderer && cd ../ && electron-builder --mac --config", + "build:linux": "cd um-react && npm run build && cp -r ./dist ../src/renderer && cd ../ && electron-builder --linux --config" }, "dependencies": { "@electron-toolkit/preload": "^2.0.0", diff --git a/src/main.js b/src/main.js index 0da14a2..19f3428 100644 --- a/src/main.js +++ b/src/main.js @@ -38,12 +38,12 @@ function createWindow() { }) // and load the index.html of the app. - console.log(app.isPackaged) - if (!app.isPackaged) { - mainWindow.loadURL('http://localhost:5173') - } else { - mainWindow.loadFile(path.join(__dirname, 'renderer/index.html')) - } + // console.log(app.isPackaged) + // if (!app.isPackaged) { + // mainWindow.loadURL('http://localhost:5173') + // } else { + mainWindow.loadFile(path.join(__dirname, 'renderer/index.html')) + // } mainWindow.on('closed', () => { // 在窗口关闭时触发before-quit事件以结束进程