gemercheung 3 سال پیش
والد
کامیت
65d002389b
5فایلهای تغییر یافته به همراه26 افزوده شده و 8 حذف شده
  1. 22 5
      .electron-builder.config.js
  2. 2 1
      package.json
  3. 0 0
      packages/main/command/test.mjs
  4. 1 1
      packages/main/src/mainWindow.ts
  5. 1 1
      packages/renderer/index.html

+ 22 - 5
.electron-builder.config.js

@@ -1,6 +1,8 @@
 if (process.env.VITE_APP_VERSION === undefined) {
-  const now = new Date;
-  process.env.VITE_APP_VERSION = `${now.getUTCFullYear() - 2000}.${now.getUTCMonth() + 1}.${now.getUTCDate()}-${now.getUTCHours() * 60 + now.getUTCMinutes()}`;
+  const now = new Date();
+  process.env.VITE_APP_VERSION = `${now.getUTCFullYear() - 2000}.${
+    now.getUTCMonth() + 1
+  }.${now.getUTCDate()}-${now.getUTCHours() * 60 + now.getUTCMinutes()}`;
 }
 
 /**
@@ -8,12 +10,27 @@ if (process.env.VITE_APP_VERSION === undefined) {
  * @see https://www.electron.build/configuration/configuration
  */
 const config = {
+  appId: "com.socket-benmark.app",
+  productName: "socket-benmark",
   directories: {
-    output: 'dist',
-    buildResources: 'buildResources',
+    output: "dist",
+    buildResources: "buildResources",
+  },
+  win: {
+    // "icon": "buildResources/icon.icns",
+    "target": [
+      "nsis"
+    ]
+  },
+  nsis: {
+    "oneClick": false,
+    "perMachine": true,
+    "allowToChangeInstallationDirectory": true
   },
   files: [
-    'packages/**/dist/**',
+    "packages/**/dist/**",
+    "packages/**/command/**",
+    "packages/main/command/**",
   ],
   extraMetadata: {
     version: process.env.VITE_APP_VERSION,

+ 2 - 1
package.json

@@ -12,12 +12,13 @@
     "url": "https://kozack.me"
   },
   "main": "packages/main/dist/index.cjs",
+
   "scripts": {
     "build": "npm run build:main && npm run build:preload && npm run build:renderer",
     "build:main": "cd ./packages/main && vite build",
     "build:preload": "cd ./packages/preload && vite build",
     "build:renderer": "cd ./packages/renderer && vite build",
-    "compile": "cross-env MODE=production npm run build && electron-builder build --config .electron-builder.config.js --dir --config.asar=true",
+    "compile": "cross-env MODE=production npm run build && electron-builder build --config .electron-builder.config.js --dir --config.asar=false",
     "test": "npm run test:main && npm run test:preload && npm run test:renderer && npm run test:e2e",
     "test:e2e": "vitest run",
     "test:main": "vitest run -r packages/main --passWithNoTests",

packages/main/src/test.mjs → packages/main/command/test.mjs


+ 1 - 1
packages/main/src/mainWindow.ts

@@ -55,7 +55,7 @@ async function createWindow() {
           }
         }
       } else {
-        const BenmarkFilePath = join(__dirname, '../../main/src/test.mjs');
+        const BenmarkFilePath = join(__dirname, '../../main/command/test.mjs');
         ptyProcess = pty.spawn(shell, [`node ${BenmarkFilePath}`, `${url}`, `${count}`], {
           name: 'xterm-color',
           cols: 80,

+ 1 - 1
packages/renderer/index.html

@@ -4,7 +4,7 @@
   <meta charset="UTF-8">
   <meta http-equiv="Content-Security-Policy" content="script-src 'self' blob:">
   <meta content="width=device-width, initial-scale=1.0" name="viewport">
-  <title>Vite App</title>
+  <title>Socket-benmark</title>
 </head>
 <body>
 <div id="app"></div>