diff --git a/README.md b/README.md index 3676f73..7258fc3 100644 --- a/README.md +++ b/README.md @@ -62,31 +62,9 @@ 支持的 DSH 版本:0.1.0-rc.8 · 0.1.1-rc.1 · 0.1.1-rc.2 ```sh -# pnpm 11 默认拦截构建脚本(node-pty / protobufjs),会让首次 add 失败; -# 先把构建许可预写进 profile 的 pnpm-workspace.yaml(幂等,可反复执行) -node -e ' -const f = require("fs"), p = process.argv[1]; -let t = f.readFileSync(p, "utf8"); -t = t.replace(/^(\s*)(node-pty|protobufjs):.*$/gm, "$1$2: true"); -if (!/^\s*allowBuilds:\s*$/m.test(t)) { - t += "\nallowBuilds:\n node-pty: true\n protobufjs: true\n"; -} else { - for (const k of ["node-pty", "protobufjs"]) { - if (!new RegExp("^\\s*" + k + ":\\s*true\\s*$", "m").test(t)) { - t = t.replace(/^(\s*allowBuilds:\s*)$/m, "$1\n " + k + ": true"); - } - } -} -if (!/^\s*-\s+dsh-better-sidebar\s*$/m.test(t)) { - if (/^\s*minimumReleaseAgeExclude:\s*$/m.test(t)) { - t = t.replace(/^(\s*minimumReleaseAgeExclude:\s*)$/m, "$1\n - dsh-better-sidebar"); - } else { - t += "\nminimumReleaseAgeExclude:\n - dsh-better-sidebar\n"; - } -} -f.writeFileSync(p, t); -' ~/.dsh/profiles/web/pnpm-workspace.yaml -dsh plugin --profile web add dsh-better-sidebar@latest +dsh plugin --profile web add dsh-better-sidebar@latest # 首次会因 pnpm 11 拦截 node-pty 构建脚本而失败(依赖已写入) +cd ~/.dsh/profiles/web && pnpm approve-builds --all # 放行构建脚本(自动重跑安装) +dsh plugin --profile web add dsh-better-sidebar@latest # 重跑即成功 ``` 装完**硬刷新浏览器**(Cmd/Ctrl+Shift+R)即可看到侧边栏(DSH 对 client 改动热加载,无需重启;仅 host 半更新时需要重启)。 @@ -95,9 +73,10 @@ dsh plugin --profile web add dsh-better-sidebar@latest ```text 帮我安装 dsh-better-sidebar 插件(DSH 侧边栏工作台),步骤: -1. 先用 node 把 node-pty / protobufjs 的构建许可预写进 ~/.dsh/profiles/web/pnpm-workspace.yaml(allowBuilds),保证首次安装不被 pnpm 11 拦截(可参考仓库 scripts/install.sh 的 ensure_workspace_settings) -2. 再执行 dsh plugin --profile web add dsh-better-sidebar@latest -3. 完成后提醒我硬刷新浏览器(Cmd/Ctrl+Shift+R) +1. 执行 dsh plugin --profile web add dsh-better-sidebar@latest(首次会被 pnpm 11 拦截 node-pty 构建脚本而失败,属正常) +2. 在 ~/.dsh/profiles/web 下执行 pnpm approve-builds --all(放行构建脚本,会自动重跑安装) +3. 再次执行 dsh plugin --profile web add dsh-better-sidebar@latest +4. 完成后提醒我硬刷新浏览器(Cmd/Ctrl+Shift+R) 遇到报错先查 https://github.com/omdsh-dev/DSH-better-sidebar README 的常见问题表。 ``` diff --git a/README_EN.md b/README_EN.md index 1d38d99..2d600cb 100644 --- a/README_EN.md +++ b/README_EN.md @@ -62,32 +62,9 @@ Supported DSH versions: 0.1.0-rc.8 · 0.1.1-rc.1 · 0.1.1-rc.2 ```sh -# pnpm 11 blocks build scripts (node-pty / protobufjs) by default, which makes -# the first `dsh plugin add` fail; pre-write the build approvals into the -# profile's pnpm-workspace.yaml (idempotent, safe to re-run) -node -e ' -const f = require("fs"), p = process.argv[1]; -let t = f.readFileSync(p, "utf8"); -t = t.replace(/^(\s*)(node-pty|protobufjs):.*$/gm, "$1$2: true"); -if (!/^\s*allowBuilds:\s*$/m.test(t)) { - t += "\nallowBuilds:\n node-pty: true\n protobufjs: true\n"; -} else { - for (const k of ["node-pty", "protobufjs"]) { - if (!new RegExp("^\\s*" + k + ":\\s*true\\s*$", "m").test(t)) { - t = t.replace(/^(\s*allowBuilds:\s*)$/m, "$1\n " + k + ": true"); - } - } -} -if (!/^\s*-\s+dsh-better-sidebar\s*$/m.test(t)) { - if (/^\s*minimumReleaseAgeExclude:\s*$/m.test(t)) { - t = t.replace(/^(\s*minimumReleaseAgeExclude:\s*)$/m, "$1\n - dsh-better-sidebar"); - } else { - t += "\nminimumReleaseAgeExclude:\n - dsh-better-sidebar\n"; - } -} -f.writeFileSync(p, t); -' ~/.dsh/profiles/web/pnpm-workspace.yaml -dsh plugin --profile web add dsh-better-sidebar@latest +dsh plugin --profile web add dsh-better-sidebar@latest # first run fails: pnpm 11 blocks node-pty build scripts (the dependency is still written) +cd ~/.dsh/profiles/web && pnpm approve-builds --all # allow the build scripts (re-runs the install automatically) +dsh plugin --profile web add dsh-better-sidebar@latest # re-run succeeds ``` Then **hard-refresh the browser** (Cmd/Ctrl+Shift+R) to see the sidebar (DSH hot-reloads client changes; only host-half updates need a restart). @@ -96,9 +73,10 @@ Then **hard-refresh the browser** (Cmd/Ctrl+Shift+R) to see the sidebar (DSH hot ```text Install the dsh-better-sidebar plugin (a sidebar workbench for DSH): -1. First pre-write build approvals for node-pty / protobufjs into ~/.dsh/profiles/web/pnpm-workspace.yaml (allowBuilds) so the first install is not blocked by pnpm 11 (see ensure_workspace_settings in the repo's scripts/install.sh) -2. Then run: dsh plugin --profile web add dsh-better-sidebar@latest -3. When done, remind me to hard-refresh the browser (Cmd/Ctrl+Shift+R) +1. Run: dsh plugin --profile web add dsh-better-sidebar@latest (the first run fails because pnpm 11 blocks node-pty build scripts — that's expected) +2. In ~/.dsh/profiles/web run: pnpm approve-builds --all (allows the build scripts and re-runs the install) +3. Run the add command again: dsh plugin --profile web add dsh-better-sidebar@latest +4. When done, remind me to hard-refresh the browser (Cmd/Ctrl+Shift+R) If anything fails, check the troubleshooting table in the README at https://github.com/omdsh-dev/DSH-better-sidebar ```