build: fix pre-commit hook for symlinked self-dep and staged deletions (#621)
- link-self.mjs: skip when node_modules/@modelcontextprotocol/ext-apps is
a symlink (e.g. to the repo root). cpSync("dist", target/dist) was
failing with ERR_FS_CP_EINVAL because src and dest resolved to the
same path.
- .husky/pre-commit: capture staged files with --diff-filter=d so the
re-stage step doesn't fail with "pathspec did not match" on commits
(typically merges) that include deletions.
This commit is contained in:
parent
01d826aea0
commit
739c0e049d
1 changed files with 6 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue