diff --git a/.husky/pre-commit b/.husky/pre-commit index b0d5ff537..ae5b3c73c 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -15,8 +15,9 @@ if grep -E '"resolved": "https?://' package-lock.json | grep -v registry.npmjs.o fi # Capture staged files so we only re-stage what the user intended to commit -# (avoids sweeping unrelated WIP into the commit) -STAGED=$(git diff --name-only --cached) +# (avoids sweeping unrelated WIP into the commit). --diff-filter=d skips +# deletions so the xargs git add below doesn't fail on removed paths. +STAGED=$(git diff --name-only --cached --diff-filter=d) npm run build:all npm run prettier:fix diff --git a/scripts/link-self.mjs b/scripts/link-self.mjs index 41051bf0b..c1f79cc76 100644 --- a/scripts/link-self.mjs +++ b/scripts/link-self.mjs @@ -5,10 +5,12 @@ * so examples always type-check against the latest local types. * See: https://github.com/npm/feedback/discussions/774 */ -import { cpSync, existsSync } from "fs"; +import { cpSync, existsSync, lstatSync } from "fs"; const target = "node_modules/@modelcontextprotocol/ext-apps"; if (!existsSync(target)) process.exit(0); +// If target is a symlink (e.g. to the repo root), dist is already current. +if (lstatSync(target).isSymbolicLink()) process.exit(0); cpSync("dist", `${target}/dist`, { recursive: true }); cpSync("package.json", `${target}/package.json`);