Merge pull request #263097 from NixOS/backport-262689-to-release-23.05

[Backport release-23.05] vencord: 1.5.7 -> 1.5.8
This commit is contained in:
Fabián Heredia Montiel
2023-10-24 15:02:40 -06:00
committed by GitHub
3 changed files with 863 additions and 132 deletions

View File

@@ -2,12 +2,11 @@
, fetchFromGitHub
, lib
, esbuild
, buildGoModule
, buildWebExtension ? false
}:
let
version = "1.5.7";
gitHash = "5d7ede3";
version = "1.5.8";
gitHash = "544edce";
in
buildNpmPackage rec {
pname = "vencord";
@@ -17,27 +16,25 @@ buildNpmPackage rec {
owner = "Vendicated";
repo = "Vencord";
rev = "v${version}";
hash = "sha256-/LrM9lBxuM5+KQJqRlP/lBV+krwZIV2GjMi33N/s+V0=";
hash = "sha256-cJ+8CKCET7Z2MebyrW5OQr50tvbDM3mkvEQQm3zSbdU=";
};
ESBUILD_BINARY_PATH = lib.getExe (esbuild.override {
buildGoModule = args: buildGoModule (args // rec {
version = "0.15.18";
src = fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${version}";
hash = "sha256-b9R1ML+pgRg9j2yrkQmBulPuLHYLUQvW+WTyR/Cq6zE=";
};
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
});
});
ESBUILD_BINARY_PATH = lib.getExe (esbuild.overrideAttrs (final: _: {
version = "0.15.18";
src = fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${final.version}";
hash = "sha256-b9R1ML+pgRg9j2yrkQmBulPuLHYLUQvW+WTyR/Cq6zE=";
};
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
}));
# Supresses an error about esbuild's version.
npmRebuildFlags = [ "|| true" ];
makeCacheWritable = true;
npmDepsHash = "sha256-Moy7VlAgl31H8QO+aOVano92C4L/wclHhj+JTnbRM6c=";
npmDepsHash = "sha256-JeJjjrCfJMuxP9sVVkKJQ7bRCGu0jbGfiw78jS0r2Sg=";
npmFlags = [ "--legacy-peer-deps" ];
npmBuildScript = if buildWebExtension then "buildWeb" else "build";
npmBuildFlags = [ "--" "--standalone" "--disable-updater" ];
@@ -57,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";

File diff suppressed because it is too large Load Diff

24
pkgs/misc/vencord/update.sh Executable file
View 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