templates: Handle package.json conversion in direnv
By splitting out the check for package.yaml into a separate check, we can avoid the constant massive shell reloads for the nix shell.
This commit is contained in:
parent
76f5246814
commit
9fb195819e
11
flake.nix
11
flake.nix
|
@ -34,17 +34,6 @@
|
||||||
yj
|
yj
|
||||||
]
|
]
|
||||||
++ old.buildInputs;
|
++ old.buildInputs;
|
||||||
|
|
||||||
shellHook =
|
|
||||||
''
|
|
||||||
# Update package.json
|
|
||||||
if [ -e ./package.json ]; then
|
|
||||||
unlink ./package.json
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat ./package.yaml | yj > ./package.json
|
|
||||||
''
|
|
||||||
+ old.shellHook;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
server = nixpkgs.legacyPackages.${system}.mkShell {
|
server = nixpkgs.legacyPackages.${system}.mkShell {
|
||||||
|
|
10
templates/.envrc
Normal file
10
templates/.envrc
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
nix_direnv_watch_file package-lock.json
|
||||||
|
use flake ..#templates
|
||||||
|
|
||||||
|
# Update package.json
|
||||||
|
if ! cmp --silent .checksum-package.yaml <(sha256sum package.yaml); then
|
||||||
|
echo "Updating package.json"
|
||||||
|
unlink ./package.json
|
||||||
|
yj < ./package.yaml > ./package.json
|
||||||
|
sha256sum package.yaml > .checksum-package.yaml
|
||||||
|
fi
|
1
templates/.gitignore
vendored
1
templates/.gitignore
vendored
|
@ -3,3 +3,4 @@ dist/
|
||||||
node_modules/
|
node_modules/
|
||||||
package.json
|
package.json
|
||||||
result
|
result
|
||||||
|
.checksum-package.yaml
|
||||||
|
|
Loading…
Reference in a new issue