Add docs and git hooks

This commit is contained in:
Timo
2025-03-25 20:12:36 +01:00
parent 6fa218dd91
commit f868eca938
4 changed files with 54 additions and 0 deletions

11
.githooks/post-commit Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/sh
FILE=.links.disabled.yaml
if test -f "$FILE"; then
# echo "$FILE exists. -> moving to .links.disabled.yaml"
mv .links.disabled.yaml .links.yaml
# echo "running yarn"
yarnLog=$(yarn)
echo "The post-commit hook enabled the links again: moved .links.disabled.yaml to .links.yaml and ran yarn."
exit 1
fi

12
.githooks/pre-commit Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/sh
FILE=".links.yaml"
if test -f "$FILE"; then
# echo "$FILE exists. -> moving to .links.disabled.yaml"
mv .links.yaml .links.disabled.yaml
# echo "running yarn"
x=$(yarn)
y=$(git add yarn.lock)
echo "YARN-LINKER-HOOK: We do not allow to commit with local links in the yarn.lock file. The pre-commit hook MODIFIED the yarn.lock file with disabled .links.yaml. Check the new git status (the hook added yarn.lock, was this desired?). The post-commit hook enables the links again. It moves .links.disabled.yaml to .links.yaml and runs yarn. Run \`git commit\` again!"
exit 1
fi