-
-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09dacac
commit f952ab7
Showing
2 changed files
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,24 @@ | ||
#!/usr/bin/env sh | ||
#!nix-shell -i "bash" -p bash prefetch-npm-deps jq nodejs nix-output-monitor | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx -y lint-staged | ||
if [ -x "$(/usr/bin/env which nix-shell 2>/dev/null)" ]; then | ||
if [ ! "$HOOK_NIX_SHELL" ]; then | ||
echo "Nix is available, updating nix flake..." | ||
export HOOK_NIX_SHELL=1 | ||
nix-shell $0 | ||
exit $? | ||
else | ||
# run ./nix-update.sh if package lock has changed and has no unstaged changes | ||
if [ -n "$(git status --porcelain=v1 2>/dev/null | grep -E '^(M| M) package-lock.json')" ]; then | ||
echo "package-lock.json has unstaged changes. Skipping update of nix dependencies." | ||
else | ||
./nix-update.sh || exit $? | ||
fi | ||
fi | ||
else | ||
echo "You do not appear to have nix installed. Skipping update of nix dependencies." | ||
fi | ||
|
||
npx -y lint-staged | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
#!/usr/bin/env nix-shell | ||
#!nix-shell -i "bash -x" -p bash prefetch-npm-deps jq | ||
#!nix-shell -i "bash -x" -p bash prefetch-npm-deps jq git nix-output-monitor | ||
nix flake update | ||
DEPS_HASH=`prefetch-npm-deps package-lock.json` | ||
TMPFILE=$(mktemp) | ||
jq '.npm_deps_hash = "'$DEPS_HASH'"' hashes.json > $TMPFILE | ||
mv -- "$TMPFILE" hashes.json | ||
mv -- "$TMPFILE" hashes.json | ||
|
||
nom build .# || exit $? | ||
git add hashes.json flake.lock flake.nix |