nixpkgs/pkgs/tools/package-management/yarn-lock-converter/default.nix
Florian Brandes 619d5776de
yarn-lock-converter: init at 0.0.2
Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
2023-05-16 11:52:53 +02:00

49 lines
1.1 KiB
Nix

{ lib
, buildNpmPackage
, fetchurl
, nodejs
, testers
, yarn-lock-converter
}:
let
source = lib.importJSON ./source.json;
in
buildNpmPackage rec {
pname = "yarn-lock-converter";
inherit (source) version;
src = fetchurl {
url = "https://registry.npmjs.org/@vht/yarn-lock-converter/-/yarn-lock-converter-${version}.tgz";
hash = "sha256-CP1wI33fgtp4GSjasktbfWuUjGzCuK3XR+p64aPAryQ=";
};
npmDepsHash = source.deps;
dontBuild = true;
nativeBuildInputs = [ nodejs ];
postPatch = ''
# Use generated package-lock.json as upstream does not provide one
ln -s ${./package-lock.json} package-lock.json
'';
postInstall = ''
mv $out/bin/@vht/yarn-lock-converter $out/bin/yarn-lock-converter
rmdir $out/bin/@vht
'';
passthru = {
tests.version = testers.testVersion {
package = yarn-lock-converter;
};
updateScript = ./update.sh;
};
meta = with lib; {
description = "Converts modern Yarn v2+ yarn.lock files into a Yarn v1 format";
homepage = "https://github.com/VHT/yarn-lock-converter";
license = licenses.mit;
maintainers = with maintainers; [ gador ];
};
}