@sunshine-star/dsh-access-pc 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/main.js CHANGED
@@ -300,7 +300,6 @@ if (args.version) {
300
300
  minWidth: 960,
301
301
  minHeight: 640,
302
302
  title: 'DSH Access',
303
- icon: path.join(__dirname, 'assets', process.platform === 'win32' ? 'icon.ico' : 'icon.png'),
304
303
  backgroundColor: '#0b1220',
305
304
  autoHideMenuBar: true,
306
305
  webPreferences: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunshine-star/dsh-access-pc",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "DSH Access PC client (Electron shell around the hub console)",
5
5
  "main": "main.js",
6
6
  "bin": {
@@ -15,7 +15,6 @@
15
15
  "scripts/doctor.js",
16
16
  "scripts/shortcut.js",
17
17
  "scripts/postinstall.js",
18
- "assets",
19
18
  "README.md"
20
19
  ],
21
20
  "scripts": {
@@ -15,15 +15,29 @@ const path = require('node:path')
15
15
 
16
16
  const APP_NAME = 'DSH Access'
17
17
  const appDir = path.join(__dirname, '..')
18
- const iconIco = path.join(appDir, 'assets', 'icon.ico')
19
- const iconPng = path.join(appDir, 'assets', 'icon.png')
20
18
 
21
19
  function electronBinary() {
20
+ // npm 先跑本包 postinstall、再跑 electron 的下载脚本,此时 require('electron')
21
+ // 可能还没有 path.txt,返回 undefined;直接按标准布局给出预期路径。
22
+ const expected = path.join(
23
+ appDir,
24
+ 'node_modules',
25
+ 'electron',
26
+ 'dist',
27
+ process.platform === 'win32'
28
+ ? 'electron.exe'
29
+ : process.platform === 'darwin'
30
+ ? path.join('Electron.app', 'Contents', 'MacOS', 'Electron')
31
+ : 'electron',
32
+ )
33
+ if (fs.existsSync(expected)) return expected
22
34
  try {
23
- return require('electron')
24
- } catch (error) {
25
- throw new Error(`找不到 Electron:${error.message}`)
35
+ const resolved = require('electron')
36
+ if (typeof resolved === 'string' && resolved) return resolved
37
+ } catch {
38
+ // 忽略:用预期路径
26
39
  }
40
+ return expected
27
41
  }
28
42
 
29
43
  function desktopDir() {
@@ -44,7 +58,6 @@ $sc = $ws.CreateShortcut($env:SHORTCUT_LNK)
44
58
  $sc.TargetPath = $env:SHORTCUT_TARGET
45
59
  $sc.Arguments = $env:SHORTCUT_ARGS
46
60
  $sc.WorkingDirectory = $env:SHORTCUT_WD
47
- $sc.IconLocation = $env:SHORTCUT_ICON
48
61
  $sc.Description = 'DSH Access - remote DSH client'
49
62
  $sc.Save()
50
63
  `
@@ -54,7 +67,6 @@ $sc.Save()
54
67
  SHORTCUT_TARGET: electronBinary(),
55
68
  SHORTCUT_ARGS: `"${appDir}"`,
56
69
  SHORTCUT_WD: appDir,
57
- SHORTCUT_ICON: iconIco,
58
70
  }
59
71
  const result = spawnSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', script], {
60
72
  env,
@@ -71,7 +83,6 @@ Type=Application
71
83
  Name=${APP_NAME}
72
84
  Comment=Remote DSH client
73
85
  Exec="${electron}" "${appDir}"
74
- Icon=${iconPng}
75
86
  Terminal=false
76
87
  Categories=Network;RemoteAccess;
77
88
  StartupWMClass=dsh-access-pc
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/assets/icon.ico DELETED
Binary file
package/assets/icon.png DELETED
Binary file