2024-04-29 18:13:55 -04:00
|
|
|
#!/usr/bin/env nix-shell
|
2024-06-28 23:33:57 -04:00
|
|
|
#! nix-shell -i bash -p curl jq nix-prefetch-github common-updater-scripts prefetch-npm-deps nodejs perl
|
2024-04-29 18:13:55 -04:00
|
|
|
set -eou pipefail
|
|
|
|
|
|
|
|
pkgDir="$(dirname "$(readlink -f "$0")")"
|
|
|
|
|
|
|
|
tempDir=$(mktemp -d)
|
|
|
|
|
|
|
|
ghTags=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/Vendicated/Vencord/tags")
|
|
|
|
latestTag=$(echo "$ghTags" | jq -r .[0].name)
|
|
|
|
gitHash=$(echo "$ghTags" | jq -r .[0].commit.sha)
|
|
|
|
|
|
|
|
pushd "$tempDir"
|
|
|
|
curl "https://raw.githubusercontent.com/Vendicated/Vencord/$latestTag/package.json" -o package.json
|
|
|
|
npm install --legacy-peer-deps -f
|
|
|
|
|
|
|
|
npmDepsHash=$(prefetch-npm-deps ./package-lock.json)
|
|
|
|
popd
|
|
|
|
|
2024-06-23 23:25:45 -04:00
|
|
|
# FIXME: why doesnt this work
|
2024-04-29 18:13:55 -04:00
|
|
|
# update-source-version vencord "${latestTag#v}"
|
2024-06-23 23:25:45 -04:00
|
|
|
set -x
|
2024-06-28 23:33:57 -04:00
|
|
|
Hash=$(nix-prefetch-github Vendicated Vencord | jq -r .hash)
|
2024-04-29 18:13:55 -04:00
|
|
|
|
2024-06-28 23:33:57 -04:00
|
|
|
perl -i -pe "s#(?<=sourceHash = \").*(?=\")#${Hash}#" ./package.nix
|
2024-06-23 23:25:45 -04:00
|
|
|
perl -i -pe "s/(?<=gitHash = \")\w{7}(?=\";)/${gitHash:0:7}/" ./package.nix
|
|
|
|
perl -i -pe "s#(?<=npmDepsHash = \")sha256-.*(?=\";)#${npmDepsHash}#" ./package.nix
|
2024-07-02 00:22:29 -04:00
|
|
|
perl -i -pe "s/(?<=vencordVersion = \")(\d.?){0,4}(?=\")/${latestTag:1}/" ./package.nix
|
2024-04-29 18:13:55 -04:00
|
|
|
cp "$tempDir/package-lock.json" "$pkgDir/package-lock.json"
|