1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p ripgrep common-updater-scripts nodejs prefetch-npm-deps jq
6 PACKAGE_DIR
="$(realpath "$
(dirname "$0")")"
8 while ! test -f flake.nix
; do cd ..
; done
12 list-git-tags --url=https://github.com/mishoo/UglifyJS \
13 | rg '^v([\d.]+)$' -r '$1' \
14 | sort --version-sort \
17 update-source-version uglify-js
"$version"
20 trap "rm -rf '$TMPDIR'" EXIT
23 src
="$(nix-build --no-link "$NIXPKGS_DIR" -A uglify-js.src)"
24 cp $src/package
*.json .
26 # Maybe one day upstream may ship a package-lock.json,
27 # until then we must generate a fresh one
28 test -f package-lock.json || npm
install --package-lock-only
29 cp -v package-lock.json
"$PACKAGE_DIR/package-lock.json"
32 nix-instantiate
"$NIXPKGS_DIR" \
33 --eval --json -A uglify-js.npmDepsHash \
36 new_npm_hash
=$
(prefetch-npm-deps .
/package-lock.json
)
37 sd
--fixed-strings "$prev_npm_hash" "$new_npm_hash" "$PACKAGE_DIR/package.nix"