1 #! /usr/bin/env -S nix shell nixpkgs#gnugrep nixpkgs#gnused nixpkgs#coreutils nixpkgs#curl nixpkgs#wget nixpkgs#jq nixpkgs#nix-update nixpkgs#prefetch-npm-deps nixpkgs#npm-lockfile-fix nixpkgs#nodejs --command bash
6 curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} -s "https
://api.github.com
/repos
/connectrpc
/connect-es
/releases
" |
7 jq -r 'map(select(.prerelease == false)) | .[0].tag_name' |
10 url
="https://raw.githubusercontent.com/connectrpc/connect-es/v$version/"
12 if [[ "$UPDATE_NIX_OLD_VERSION" == "$version" ]]; then
13 echo "Already up to date!"
18 trap 'rm -rf -- "$tmp"' EXIT
21 wget
"$url/package-lock.json"
22 npm-lockfile-fix package-lock.json
23 npm_hash
=$
(prefetch-npm-deps package-lock.json
)
26 pushd "$(dirname "${BASH_SOURCE[0]}")"
27 sed -i 's#npmDepsHash = "[^"]*"#npmDepsHash = "'"$npm_hash"'"#' package.nix
30 nix-update protoc-gen-connect-es
--version "$version"