diff --git a/flake.nix b/flake.nix index 31efafc..eb41e49 100644 --- a/flake.nix +++ b/flake.nix @@ -34,17 +34,6 @@ yj ] ++ 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 { diff --git a/templates/.envrc b/templates/.envrc new file mode 100644 index 0000000..6dc0224 --- /dev/null +++ b/templates/.envrc @@ -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 diff --git a/templates/.gitignore b/templates/.gitignore index e349813..d6989d1 100644 --- a/templates/.gitignore +++ b/templates/.gitignore @@ -3,3 +3,4 @@ dist/ node_modules/ package.json result +.checksum-package.yaml