update linking realted logic

- remove post-commit hook
 - remove .links.cjs enable/disable (instead just add/rm .pnpmfile.cjs)
 - rename pnpm links:enable -> pnpm links:on
 - rename pnpm links:disable -> pnpm links:off
 - unify doc filenames `-` -> `_`
 - add linking_concept_reasoning.md to provide background why the
   linking is how it is.
This commit is contained in:
Timo K
2026-04-21 16:06:51 +02:00
parent b58076f1b9
commit 741b82b026
13 changed files with 174 additions and 55 deletions

View File

@@ -1,11 +0,0 @@
#!/usr/bin/sh
FILE=.links.cjs
FILE_DIS=.links.temp-disabled.cjs
if test -f "$FILE_DIS"; then
# Only do the post-commit hook if the file was temp-disabled by the pre-commit hook.
# Otherwise linking was actively (`pnpm links:disable`) disabled and this hook should noop.
mv $FILE_DIS $FILE
echo "[pnpm-linker] The post-commit hook has re-enabled $FILE"
exit 1
fi

View File

@@ -1,11 +1,9 @@
#!/usr/bin/sh
#!/usr/bin/env bash
FILE=.links.cjs
FILE_DIS=.links.temp-disabled.cjs
if test -f "$FILE"; then
mv $FILE .links.temp-disabled.cjs
x=$(pnpm install)
y=$(git add pnpm-lock.yaml)
echo "[pnpm-linker] The pre-commit hook has disabled $FILE and MODIFIED the pnpm-lock.yaml file. Review the staged changes (the hook added pnpm-lock.yaml, was this desired?) and run \`git commit \` again if they look okay. The post-commit hook will re-enable your links."
# Checks if there currently is linking configured. Informs the user to disable linking before committing.
PNPMFILE=.pnpmfile.cjs
if test -f "$PNPMFILE"; then
echo "[pnpm-linker] The pre-commit hook detected $PNPMFILE which implies you have linked packages in your pnpm-lock.yaml. Run pnpm links:off and commit again. See also linking.md."
exit 1
fi