Unverified Commit bea21e5f authored by Mario Rodas's avatar Mario Rodas Committed by GitHub
Browse files

Merge pull request #302696 from marsam/yarn-without-node

yarn: allow install without node
parents a76c4553 8c29b8d7
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
{ lib, fetchFromGitHub, fetchzip, nodejs, stdenvNoCC, testers }:
{ lib
, fetchFromGitHub
, fetchzip
, nodejs
, stdenvNoCC
, testers
, gitUpdater
, withNode ? true
}:

let
  completion = fetchFromGitHub {
@@ -17,7 +25,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
    sha256 = "sha256-kFa+kmnBerTB7fY/IvfAFy/4LWvrl9lrRHMOUdOZ+Wg=";
  };

  buildInputs = [ nodejs ];
  buildInputs = lib.optionals withNode [ nodejs ];

  installPhase = ''
    mkdir -p $out/{bin,libexec/yarn/,share/bash-completion/completions/}
@@ -27,7 +35,16 @@ stdenvNoCC.mkDerivation (finalAttrs: {
    ln -s ${completion}/yarn-completion.bash $out/share/bash-completion/completions/yarn.bash
  '';

  passthru.tests = testers.testVersion { package = finalAttrs.finalPackage; };
  passthru = {
    tests.version = lib.optionalAttrs withNode (testers.testVersion {
      package = finalAttrs.finalPackage;
    });

    updateScript = gitUpdater {
      url = "https://github.com/yarnpkg/yarn.git";
      rev-prefix = "v";
    };
  };

  meta = with lib; {
    description = "Fast, reliable, and secure dependency management for javascript";
@@ -35,7 +52,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
    changelog = "https://github.com/yarnpkg/yarn/blob/v${finalAttrs.version}/CHANGELOG.md";
    license = licenses.bsd2;
    maintainers = with maintainers; [ offline screendriver marsam ];
    platforms = nodejs.meta.platforms;
    platforms = platforms.all;
    mainProgram = "yarn";
  };
})