Extract npm deps hash calculation to a separate command
All checks were successful
continuous-integration/drone/tag Build is passing
All checks were successful
continuous-integration/drone/tag Build is passing
This commit is contained in:
parent
4b48f20371
commit
2a2ace9c18
23
default.nix
23
default.nix
@ -117,6 +117,20 @@ in
|
||||
npm --prefix app/frontend run fix
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "update-npm-deps-hash";
|
||||
help = "Calculates and updates the npmDepsHash in default.nix";
|
||||
command = ''
|
||||
echo "Calculating npm deps"
|
||||
# STDERR is poluted by the installed nodules, silencing
|
||||
HASH=''$(prefetch-npm-deps ''$PRJ_ROOT/app/frontend/package-lock.json 2> /dev/null)
|
||||
[[ ''$HASH = sha256* ]] && echo "Hash is ''$HASH"
|
||||
[[ ''$HASH != sha256* ]] && echo "Failed" && exit 137
|
||||
|
||||
# Replace the first occurence of npmDepsHash with the new calculated hash in this file
|
||||
sed -i "0,/npmDepsHash =/{s@npmDepsHash = .*@npmDepsHash = \"''$HASH\";@}" ''$PRJ_ROOT/default.nix
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "pre-commit";
|
||||
help = "Format and fix found issues";
|
||||
@ -125,14 +139,7 @@ in
|
||||
golangci-lint run --sort-results --out-format tab --fix
|
||||
npm --prefix ''$PRJ_ROOT/app/frontend run fix
|
||||
|
||||
echo "Calculating npm deps"
|
||||
HASH=''$(prefetch-npm-deps ''$PRJ_ROOT/app/frontend/package-lock.json 2> /dev/null)
|
||||
[[ ''$HASH = sha256* ]] && echo "Hash is ''$HASH"
|
||||
[[ ''$HASH != sha256* ]] && echo "Failed" && exit 137
|
||||
|
||||
# Replace the first occurence of npmDepsHash with the new calculated hash in this file
|
||||
sed -i "0,/npmDepsHash =/{s@npmDepsHash = .*@npmDepsHash = \"''$HASH\";@}" ''$PRJ_ROOT/default.nix
|
||||
|
||||
update-npm-deps-hash
|
||||
'';
|
||||
}
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user