mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 23:03:40 +01:00
vencord: add update script
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
587aeb8b1e
commit
afda2015dc
2 changed files with 26 additions and 0 deletions
|
@ -54,6 +54,8 @@ buildNpmPackage rec {
|
|||
cp -r dist/ $out
|
||||
'';
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
|
||||
meta = with lib; {
|
||||
description = "Vencord web extension";
|
||||
homepage = "https://github.com/Vendicated/Vencord";
|
||||
|
|
24
pkgs/misc/vencord/update.sh
Executable file
24
pkgs/misc/vencord/update.sh
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -I nixpkgs=../../.. -i bash -p curl jq common-updater-scripts prefetch-npm-deps nodejs
|
||||
set -eou pipefail
|
||||
|
||||
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
|
||||
|
||||
pushd ../../..
|
||||
update-source-version vencord "${latestTag#v}"
|
||||
popd
|
||||
|
||||
sed -E 's#\bgitHash = ".*?"#gitHash = "'"${gitHash:0:7}"'"#' -i default.nix
|
||||
sed -E 's#\bnpmDepsHash = ".*?"#npmDepsHash = "'"$npmDepsHash"'"#' -i default.nix
|
||||
cp "$tempDir/package-lock.json" package-lock.json
|
Loading…
Reference in a new issue