vencord: allow building Discord scripts

Vencord can be built in two different ways. Either as a web-extension,
or as a set of scripts to be injected into Discord Desktop.

Allow to select between these two modes using a parameter and expose
both variants as top-level packages.

This also renames vencord-web-extension to vencord.

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2023-05-08 08:49:28 +02:00
parent 14a00b2d20
commit 0180896459
No known key found for this signature in database
GPG Key ID: E13DFD4B47127951
4 changed files with 10 additions and 5 deletions

View File

@ -4,9 +4,10 @@
, substituteAll
, esbuild
, buildGoModule
, buildWebExtension ? false
}:
buildNpmPackage rec {
pname = "vencord-web-extension";
pname = "vencord";
version = "1.1.6";
src = fetchFromGitHub {
@ -34,7 +35,7 @@ buildNpmPackage rec {
npmDepsHash = "sha256-jKSdeyQ8oHw7ZGby0XzDg4O8mtH276ykVuBcw7dU/Ls=";
npmFlags = [ "--legacy-peer-deps" ];
npmBuildScript = "buildWeb";
npmBuildScript = if buildWebExtension then "buildWeb" else "build";
prePatch = ''
cp ${./package-lock.json} ./package-lock.json
@ -47,8 +48,10 @@ buildNpmPackage rec {
})
];
installPhase = ''
cp -r dist/extension-unpacked $out
installPhase = if buildWebExtension then ''
cp -r dist/extension-unpacked/ $out
'' else ''
cp -r dist/ $out
'';
meta = with lib; {

View File

@ -24329,7 +24329,9 @@ with pkgs;
vcg = callPackage ../development/libraries/vcg { };
vencord-web-extension = callPackage ../misc/vencord-web-extension { };
vencord = callPackage ../misc/vencord { };
vencord-web-extension = callPackage ../misc/vencord { buildWebExtension = true; };
vid-stab = callPackage ../development/libraries/vid-stab {
inherit (llvmPackages) openmp;