depot/third_party/nixpkgs/pkgs/tools/package-management/yarn-lock-converter/default.nix
Default email 94427deb9d Project import generated by Copybara.
GitOrigin-RevId: f91ee3065de91a3531329a674a45ddcb3467a650
2023-05-24 16:37:59 +03: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 ];
};
}