depot/third_party/nixpkgs/pkgs/applications/misc/ArchiSteamFarm/web-ui/update.sh
Default email 6d4aeb4377 Project import generated by Copybara.
GitOrigin-RevId: 0f213d0fee84280d8c3a97f7469b988d6fe5fcdf
2023-01-11 08:51:40 +01:00

29 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env nix-shell
#! nix-shell -I nixpkgs=../../../.. -i bash -p nodePackages.node2nix gnused jq curl
set -eou pipefail
cd "$(dirname "$0")"
pushd ../../../../..
version=$(nix-instantiate --strict --eval -A ArchiSteamFarm.version | jq -r)
popd
pushd "$(dirname "$0")"
ui=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/JustArchiNET/ArchiSteamFarm/contents/ASF-ui?ref=$version" | jq -r .sha)
curl "https://raw.githubusercontent.com/JustArchiNET/ASF-ui/$ui/package-lock.json" -o package-lock.json
curl "https://raw.githubusercontent.com/JustArchiNET/ASF-ui/$ui/package.json" -o package.json
# update-source-version doesn't work for some reason
sed -i "s/rev\\s*=\\s*.*/rev = \"$ui\";/" default.nix
sed -i "s/sha256\\s*=\\s*.*/sha256 = \"$(nix-prefetch-url --unpack "https://github.com/JustArchiNET/ASF-ui/archive/$ui.tar.gz")\";/" default.nix
node2nix \
--nodejs-14 \
--development \
--lock package-lock.json \
--node-env ../../../../development/node-packages/node-env.nix \
--output node-packages.nix \
--composition node-composition.nix \
rm package.json package-lock.json
popd