feat: add pnpm run link:dev for local development #151
Reference in New Issue
Block a user
Delete Branch "feat/link-dev-script"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Add a one-command development setup script (
pnpm run link:dev) that switches~/.uncaged-nerveto use monorepo workspace packages instead of npm registry versions.Why
During local development, the globally installed nerve CLI and the daemon's
node_modulescan get out of sync with the monorepo workspace packages, causing version mismatches and confusing bugs (e.g. missing fields likelastSignalTimestamp, unrecognizedtriggersconfigs).Changes
scripts/link-dev.sh(new): Shell script that builds all packages, links the CLI globally viapnpm link --global, symlinks all@uncaged/*packages into~/.uncaged-nerve/node_modules/, and restarts the daemon.package.json: Addedlink:devscript entry pointing toscripts/link-dev.sh.Ref
N/A
脚本本身 LGTM 👍 逻辑清晰完整。
但
package.json的改动需要讨论:dependencies不应引用子包 — monorepo root 加@uncaged/nerve-cli/@uncaged/nerve-daemon作为 dependency 不合常规,会被pnpm install安装到 rootnode_modulespnpm.overrides是全局生效的 — 影响所有人的pnpm install,不只是 dev 场景。如果只是本地开发需要,不应该提交到仓库建议:去掉
package.json的改动,脚本本身的pnpm link已经够用了。如果需要 overrides,可以用.pnpmfile.cjs或文档说明。@@ -18,0 +21,4 @@"@uncaged/nerve-cli": "link:packages/cli","@uncaged/nerve-daemon": "link:packages/daemon"}},根目录不应该把子包加到
dependencies,pnpm.overrides也会影响所有pnpm install。建议去掉这段,脚本里的pnpm link已经处理了 linking。f5f785cb26toa834083a0b✅ package.json 改动已清理,只剩
link:devscript 入口,LGTM。