Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

chore(scripts): switch TS script runner to tsx and migrate rebuild-macos-icon to TS

hairyf700f441fd4ac
diff --git a/package.json b/package.json
index 8c6f913e..aa5953d6 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
"description": "Desktop application for DeepSeek Harness (dsh) — one-click local install and launch, no Node.js setup required.",
"scripts": {
"dev": "vite",
- "prebuild": "node --experimental-strip-types scripts/prebuild.ts",
+ "prebuild": "tsx scripts/prebuild.ts",
"build": "tsc && vite build",
"preview": "vite preview",
"tauri": "tauri",
@@ -17,7 +17,7 @@
"knip": "knip",
"lint:fix": "eslint . --fix",
"typecheck": "tsc --noEmit",
- "icons": "tauri icon public/favicon.svg && node scripts/rebuild-macos-icon.cjs"
+ "icons": "tauri icon public/favicon.svg && tsx scripts/rebuild-macos-icon.ts"
},
"dependencies": {
"@gravity-ui/icons": "^2.21.0",
@@ -53,6 +53,7 @@
"eslint-plugin-react-refresh": "^0.5.4",
"knip": "^6.32.2",
"tailwindcss": "4.1.11",
+ "tsx": "^4.23.12",
"typescript": "~5.8.3",
"vite": "^7.0.4",
"vitest": "^4.1.11"
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 78ff74aa..4dbe19d6 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -64,7 +64,7 @@ importers:
devDependencies:
'@antfu/eslint-config':
specifier: ^9.3.0
'@eslint-react/eslint-plugin':
specifier: ^5.18.6
@@ -73,7 +73,7 @@ importers:
version: 4.1.11
'@tailwindcss/vite':
specifier: 4.1.11
'@tauri-apps/cli':
specifier: ^2.11.4
version: 2.11.4
@@ -88,7 +88,7 @@ importers:
version: 19.2.4(@types/[email protected])
'@vitejs/plugin-react':
specifier: ^4.6.0
babel-plugin-react-compiler:
specifier: ^1.0.0
version: 1.0.0
@@ -107,15 +107,18 @@ importers:
tailwindcss:
specifier: 4.1.11
version: 4.1.11
+ tsx:
+ specifier: ^4.23.12
+ version: 4.23.12
typescript:
specifier: ~5.8.3
version: 5.8.3
vite:
specifier: ^7.0.4
vitest:
specifier: ^4.1.11
packages:
@@ -3104,6 +3107,11 @@ packages:
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
+ resolution: {integrity: sha512-FDf4L4sYzKtzWYhU/Xm0AQFdTjdIxNo9ElTf2mxXM6k8YMHXzYUe4yODVaXP4V9uMFbVg8c0qyBccK2OOxb45Q==}
+ engines: {node: '>=18.0.0'}
+ hasBin: true
+
resolution: {integrity: sha512-7bziOlRqH0hJx80h/3mbicLW7o8qLsH5+RaLR2t+OHM3D0JlWGODQKQ4cxbK7WlvmUxpcj6Kgu6EKqjrGFe3QQ==}
@@ -3378,7 +3386,7 @@ snapshots:
'@jridgewell/gen-mapping': 0.3.13
'@jridgewell/trace-mapping': 0.3.31
dependencies:
'@antfu/install-pkg': 2.0.1
'@clack/prompts': 1.7.0
@@ -3388,7 +3396,7 @@ snapshots:
'@stylistic/eslint-plugin': 5.10.0([email protected]([email protected]))
'@typescript-eslint/parser': 8.67.0([email protected]([email protected]))([email protected])
ansis: 4.3.1
cac: 7.0.0
eslint: 10.8.1([email protected])
@@ -4439,12 +4447,12 @@ snapshots:
postcss: 8.5.26
tailwindcss: 4.1.11
dependencies:
'@tailwindcss/node': 4.1.11
'@tailwindcss/oxide': 4.1.11
tailwindcss: 4.1.11
'@tanstack/[email protected]': {}
@@ -4670,7 +4678,7 @@ snapshots:
'@typescript-eslint/types': 8.67.0
eslint-visitor-keys: 5.0.1
dependencies:
'@babel/core': 7.29.7
'@babel/plugin-transform-react-jsx-self': 7.29.7(@babel/[email protected])
@@ -4678,11 +4686,11 @@ snapshots:
'@rolldown/pluginutils': 1.0.0-beta.27
'@types/babel__core': 7.20.5
react-refresh: 0.17.0
transitivePeerDependencies:
- supports-color
dependencies:
'@typescript-eslint/scope-manager': 8.67.0
'@typescript-eslint/utils': 8.67.0([email protected]([email protected]))([email protected])
@@ -4690,7 +4698,7 @@ snapshots:
optionalDependencies:
typescript: 5.8.3
transitivePeerDependencies:
- supports-color
@@ -4703,13 +4711,13 @@ snapshots:
chai: 6.2.2
tinyrainbow: 3.1.1
dependencies:
'@vitest/spy': 4.1.11
estree-walker: 3.0.3
magic-string: 0.30.21
optionalDependencies:
'@vitest/[email protected]':
dependencies:
@@ -6492,6 +6500,12 @@ snapshots:
+ dependencies:
+ esbuild: 0.28.2
+ optionalDependencies:
+ fsevents: 2.3.3
+
@@ -6592,7 +6606,7 @@ snapshots:
dependencies:
esbuild: 0.28.2
fdir: 6.5.0([email protected])
@@ -6605,12 +6619,13 @@ snapshots:
fsevents: 2.3.3
jiti: 2.7.0
lightningcss: 1.30.1
+ tsx: 4.23.12
yaml: 2.9.0
dependencies:
'@vitest/expect': 4.1.11
'@vitest/pretty-format': 4.1.11
'@vitest/runner': 4.1.11
'@vitest/snapshot': 4.1.11
@@ -6627,7 +6642,7 @@ snapshots:
tinyexec: 1.3.0
tinyglobby: 0.2.17
tinyrainbow: 3.1.1
why-is-node-running: 2.3.0
optionalDependencies:
'@types/node': 22.20.1
diff --git a/scripts/rebuild-macos-icon.cjs b/scripts/rebuild-macos-icon.ts
similarity index 56%
rename from scripts/rebuild-macos-icon.cjs
rename to scripts/rebuild-macos-icon.ts
index 3c19264e..49b2d32a 100644
--- a/scripts/rebuild-macos-icon.cjs
+++ b/scripts/rebuild-macos-icon.ts
@@ -1,3 +1,4 @@
+import type { Buffer } from 'node:buffer'
// 重建 macOS 图标资产,与 favicon.svg 保持同步(修复 #88:Dock 图标比相邻应用大一圈;
// 并为 macOS 状态栏生成半透明玻璃模板图标)。
//
@@ -9,36 +10,37 @@
// 1) 把 favicon 图形缩放到 Apple 官方 1024 图标网格(内容 824px、四周 100px 透明边距),
// 仅重生成 macOS 使用的 icon.icns(Windows/Linux 图标保持全出血不变,见
// QwenLM/qwen-code PR #8987 的同类修复)。参考 Apple HIG.app-icons 网格。
-// 2) 从 scripts/macos-tray.svg 生成透明状态栏模板 PNG(src-tauri/icons/macos-tray.png),
+// 2) 从 assets/macos-tray.svg 生成透明状态栏模板 PNG(src-tauri/icons/macos-tray.png),
// 供 builder.rs 在 macOS 上用 `icon_as_template(true)` 按 NSImage template 渲染,
// 由系统按菜单栏深浅/半透明材质自动着色(半透明玻璃观感)。
//
-// 用法:node scripts/rebuild-macos-icon.cjs
-const { spawnSync } = require('node:child_process')
-const fs = require('node:fs')
-const path = require('node:path')
+// 用法:tsx scripts/rebuild-macos-icon.ts
+import { spawnSync } from 'node:child_process'
+import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
+import { join, relative, resolve } from 'node:path'
+import process from 'node:process'
-const root = path.resolve(__dirname, '..')
-const masterSvg = path.join(__dirname, 'macos.svg')
-const traySvg = path.join(__dirname, 'macos-tray.svg')
-const tmpOut = path.join(root, '.tmp', 'macos-icons')
-const targetIcns = path.join(root, 'src-tauri', 'icons', 'icon.icns')
-const targetTrayPng = path.join(root, 'src-tauri', 'icons', 'macos-tray.png')
+const root = resolve(import.meta.dirname, '..')
+const masterSvg = join(root, '.tmp', 'macos.svg')
+const traySvg = join(root, 'assets', 'macos-tray.svg')
+const tmpOut = join(root, '.tmp', 'macos-icons')
+const targetIcns = join(root, 'src-tauri', 'icons', 'icon.icns')
+const targetTrayPng = join(root, 'src-tauri', 'icons', 'macos-tray.png')
-function fail(step, result) {
- const detail = result && result.stderr ? result.stderr.toString() : ''
+function fail(step: string, result?: { stderr?: Buffer | string }): never {
+ const detail = result?.stderr ? result.stderr.toString() : ''
console.error(`[rebuild-macos-icon] ${step} failed:\n${detail}`)
process.exit(1)
}
// tauri CLI 的 JS 入口(避免 Windows 下 shell 展开 .cmd 的转义问题)
-const cliJs = path.join(root, 'node_modules', '@tauri-apps', 'cli', 'tauri.js')
+const cliJs = join(root, 'node_modules', '@tauri-apps', 'cli', 'tauri.js')
// 1. 由 favicon.svg 生成 Apple 网格母版(824px 内容 + 100px 透明边距)
-const favicon = path.join(root, 'public', 'favicon.svg')
-if (!fs.existsSync(favicon))
+const favicon = join(root, 'public', 'favicon.svg')
+if (!existsSync(favicon))
fail('read public/favicon.svg')
-const src = fs.readFileSync(favicon, 'utf8')
+const src = readFileSync(favicon, 'utf8')
const match = src.match(/<svg[^>]*>([\s\S]*)<\/svg>/)
if (!match)
fail('parse public/favicon.svg structure')
@@ -52,17 +54,16 @@ ${match[1]}
</g>
</svg>
`
-fs.writeFileSync(masterSvg, master)
+writeFileSync(masterSvg, master)
// 2. 用 tauri icon 生成整套图标到临时目录(.tmp 已在 .gitignore 中)
-function genIcons(svgFile, outDir) {
- fs.rmSync(outDir, { recursive: true, force: true })
- fs.mkdirSync(outDir, { recursive: true })
- const r = spawnSync(process.execPath, [cliJs, 'icon', svgFile, '--output', outDir], {
+function genIcons(svgFile: string, outDir: string) {
+ rmSync(outDir, { recursive: true, force: true })
+ mkdirSync(outDir, { recursive: true })
+ return spawnSync(process.execPath, [cliJs, 'icon', svgFile, '--output', outDir], {
cwd: root,
stdio: 'inherit',
})
- return r
}
const gen = genIcons(masterSvg, tmpOut)
@@ -70,19 +71,19 @@ if (gen.status !== 0)
fail('tauri icon (icns)', gen)
// 3. 只回写 macOS 的 icon.icns(其余平台图标保持不变)
-const generatedIcns = path.join(tmpOut, 'icon.icns')
-if (!fs.existsSync(generatedIcns))
+const generatedIcns = join(tmpOut, 'icon.icns')
+if (!existsSync(generatedIcns))
fail('find generated icon.icns')
-fs.copyFileSync(generatedIcns, targetIcns)
-console.log(`[rebuild-macos-icon] updated ${path.relative(root, targetIcns)}`)
+copyFileSync(generatedIcns, targetIcns)
+console.log(`[rebuild-macos-icon] updated ${relative(root, targetIcns)}`)
// 4. 生成透明状态栏模板 PNG(128x128@2x = 256px,用于 retina)
-const trayTmp = path.join(tmpOut, '..', 'tray-icons')
+const trayTmp = join(tmpOut, '..', 'tray-icons')
const tgen = genIcons(traySvg, trayTmp)
if (tgen.status !== 0)
fail('tauri icon (tray)', tgen)
-const traySrc = path.join(trayTmp, '[email protected]')
-if (!fs.existsSync(traySrc))
+const traySrc = join(trayTmp, '[email protected]')
+if (!existsSync(traySrc))
fail('find generated tray template png')
-fs.copyFileSync(traySrc, targetTrayPng)
-console.log(`[rebuild-macos-icon] updated ${path.relative(root, targetTrayPng)}`)
+copyFileSync(traySrc, targetTrayPng)
+console.log(`[rebuild-macos-icon] updated ${relative(root, targetTrayPng)}`)