安装手册
August 14, 2026 · View on GitHub
English | 中文
DSH 插件通过 dsh plugin 命令安装进 profile(dsh web 对应 web profile)。本包发布为 @guanmu/dsh-web-skins。
方式一:从 npm 安装(推荐)
插件已发布到 npm,一条命令装进 web profile:
dsh plugin --profile web add @guanmu/dsh-web-skins
装完重启 dsh web,设置 → 通用设置 → 皮肤 即可看到主题选择下拉。
首次安装若提示 ERR_PNPM_IGNORED_BUILDS(pnpm 拒绝了某个依赖的构建脚本),按提示把对应包加入 profile 的 pnpm-workspace.yaml 的 onlyBuiltDependencies 后重新执行即可。
更新到新版本:
dsh plugin --profile web add @guanmu/dsh-web-skins
卸载:
dsh plugin --profile web remove @guanmu/dsh-web-skins
方式二:从 GitHub 源码安装(改代码调试)
需要 Node.js ≥ 22 与 pnpm。源码安装仅供开发调试:
# 1. Clone the repo
git clone https://github.com/ZeroZ-lab/dsh-web-skins.git
cd dsh-skins
# 2. Install deps and build
pnpm install
pnpm build
# 3. Link the local package into the web profile
dsh plugin --profile web add "file:$(pwd)" --ignore-scripts
# 4. Restart dsh web
dsh web
本地 file: 依赖会被 pnpm 缓存;重新 pnpm build 后,需先 dsh plugin --profile web remove @guanmu/dsh-web-skins 再 add 一次刷新。
开发者本地验证
源码类型检查需要一份可访问的官方 DSH 快照作为兄弟目录 fulltest-wt/,提供私有类型与真实冒烟环境(不进入插件包):
workspace/
├── fulltest-wt/ # official DSH snapshot
└── dsh-skins/ # this repository
pnpm verify # typecheck + build + test + artifact smoke + i18n gate
实际装入了什么
- 根
package.json声明官方dsh.bundle.patch与dsh.client;cordis.patch.yml只向配置树插入一个 Web Client Bundle,且没有preinstall/install/postinstall/prepare脚本。 packages/dsh-web-skins/lib/client.js是官方 Client Module Loader 消费的浏览器 bundle;ThemeService、Cordis 生命周期与 HMR 均复用官方实现。- 插件不启动独立服务、不写外部数据库,没有需要补偿的外部副作用。
验证
- 启动后打开 设置 → 通用设置,应看到「皮肤」行与一个下拉框(21 个主题家族)。
- 选择任意家族应立即换肤;切回浅色/深色/跟随系统后,插件维护的
body[data-ds-skin]与样式会被回收。 - 页面 boot manifest 应包含
@guanmu/dsh-web-skins,客户端地址为/plugins/@guanmu/dsh-web-skins/client.js。
运行时容错
官方 HMR 负责一次运行中的 client tree last-good:新 bundle 导入失败会展示错误并保留上一个可用树。