depot/third_party/nixpkgs/pkgs/by-name/ug/uglify-js/package.nix
Default email f34ce41345 Project import generated by Copybara.
GitOrigin-RevId: b73c2221a46c13557b1b3be9c2070cc42cf01eb3
2024-07-27 08:49:29 +02:00

62 lines
1.4 KiB
Nix

{
lib,
buildNpmPackage,
fetchFromGitHub,
testers,
runCommand,
writeText,
uglify-js,
}:
buildNpmPackage rec {
pname = "uglify-js";
version = "3.18.0";
src = fetchFromGitHub {
owner = "mishoo";
repo = "UglifyJS";
rev = "v${version}";
hash = "sha256-m+OEcvWEk4RX0C4re9TFZpkcBvSwl7qfIM+56t100ws=";
};
npmDepsHash = "sha256-iLWmNifHpVvFSFXkfItVpGlh6za9T9wSr1Af4CQQSGM=";
postPatch = ''
cp ${./package-lock.json} package-lock.json
'';
dontNpmBuild = true;
passthru = {
updateScript = ./update.sh;
tests = {
version = testers.testVersion { package = uglify-js; };
simple = testers.testEqualContents {
assertion = "uglify-js minifies a basic js file";
expected = writeText "expected" ''
console.log(1);
'';
actual =
runCommand "actual"
{
nativeBuildInputs = [ uglify-js ];
base = writeText "base" ''
console . log ( ( 1 ) ) ;
'';
}
''
uglifyjs $base > $out
'';
};
};
};
meta = {
homepage = "https://github.com/mishoo/UglifyJS";
description = "JavaScript parser / mangler / compressor / beautifier toolkit";
mainProgram = "uglifyjs";
license = lib.licenses.bsd2;
maintainers = with lib.maintainers; [ lelgenio ];
};
}