Commit 254230e2 authored by Robert Schütz's avatar Robert Schütz
Browse files

mermaid-cli: use fetchYarnDeps

parent 0c7ffbc6
Loading
Loading
Loading
Loading
+80 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, fetchYarnDeps
, makeWrapper
, nodejs
, prefetch-yarn-deps
, yarn
, chromium
}:

stdenv.mkDerivation rec {
  pname = "mermaid-cli";
  version = "10.4.0";

  src = fetchFromGitHub {
    owner = "mermaid-js";
    repo = "mermaid-cli";
    rev = version;
    hash = "sha256-mzBN/Hg/03+jYyoAHvjx33HC46ZA6dtHmiSnaExCRR0=";
  };

  offlineCache = fetchYarnDeps {
    yarnLock = "${src}/yarn.lock";
    hash = "sha256-RQsRGzkuPgGVuEpF5lzv26XKMPLX2NrsjVkGMMkCbO4=";
  };

  nativeBuildInputs  = [
    makeWrapper
    nodejs
    prefetch-yarn-deps
    yarn
  ];

  configurePhase = ''
    runHook preConfigure

    export HOME=$(mktemp -d)
    yarn config --offline set yarn-offline-mirror "$offlineCache"
    fixup-yarn-lock yarn.lock
    yarn --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive install
    patchShebangs node_modules

    runHook postConfigure
  '';

  buildPhase = ''
    runHook preBuild

    yarn --offline prepare

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    yarn --offline --production install

    mkdir -p "$out/lib/node_modules/@mermaid-js/mermaid-cli"
    cp -r . "$out/lib/node_modules/@mermaid-js/mermaid-cli"

    makeWrapper "${nodejs}/bin/node" "$out/bin/mmdc" \
  '' + lib.optionalString (lib.meta.availableOn stdenv.targetPlatform chromium) ''
      --set PUPPETEER_EXECUTABLE_PATH '${lib.getExe chromium}' \
  '' + ''
      --add-flags "$out/lib/node_modules/@mermaid-js/mermaid-cli/src/cli.js"

    runHook postInstall
  '';

  meta = {
    description = "Generation of diagrams from text in a similar manner as markdown";
    homepage = "https://github.com/mermaid-js/mermaid-cli";
    license = lib.licenses.mit;
    mainProgram = "mmdc";
    maintainers = with lib.maintainers; [ ysndr ];
    platforms = lib.platforms.all;
  };
}
+2 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ mapAliases {
  "@google/clasp" = pkgs.google-clasp; # Added 2023-05-07
  "@maizzle/cli" = pkgs.maizzle; # added 2023-08-17
  "@medable/mdctl-cli" = throw "@medable/mdctl-cli was removed because it was broken"; # added 2023-08-21
  "@mermaid-js/mermaid-cli" = pkgs.mermaid-cli; # added 2023-10-01
  "@nerdwallet/shepherd" = pkgs.shepherd; # added 2023-09-30
  "@nestjs/cli" = pkgs.nest-cli; # Added 2023-05-06
  alloy = pkgs.titanium-alloy; # added 2023-08-17
@@ -98,6 +99,7 @@ mapAliases {
  markdownlint-cli = pkgs.markdownlint-cli; # added 2023-07-29
  inherit (pkgs) markdownlint-cli2; # added 2023-08-22
  mdctl-cli = self."@medable/mdctl-cli"; # added 2023-08-21
  inherit (pkgs) mermaid-cli; # added 2023-10-01
  musescore-downloader = pkgs.dl-librescore; # added 2023-08-19
  inherit (pkgs) near-cli; # added 2023-09-09
  node-inspector = throw "node-inspector was removed because it was broken"; # added 2023-08-21
+0 −1
Original line number Diff line number Diff line
@@ -14,7 +14,6 @@
  "@babel/cli" = "babel";
  "@commitlint/cli" = "commitlint";
  "@gitbeaker/cli" = "gitbeaker";
  "@mermaid-js/mermaid-cli" = "mmdc";
  "@prisma/language-server" = "prisma-language-server";
  "@tailwindcss/language-server" = "tailwindcss-language-server";
  "@uppy/companion" = "companion";
+0 −1
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@
, "@babel/cli"
, "@commitlint/cli"
, "@commitlint/config-conventional"
, "@mermaid-js/mermaid-cli"
, "@microsoft/rush"
, "@shopify/cli"
, "@tailwindcss/aspect-ratio"
+0 −125
Original line number Diff line number Diff line
@@ -62738,131 +62738,6 @@ in
    bypassCache = true;
    reconstructLock = true;
  };
  "@mermaid-js/mermaid-cli" = nodeEnv.buildNodePackage {
    name = "_at_mermaid-js_slash_mermaid-cli";
    packageName = "@mermaid-js/mermaid-cli";
    version = "10.4.0";
    src = fetchurl {
      url = "https://registry.npmjs.org/@mermaid-js/mermaid-cli/-/mermaid-cli-10.4.0.tgz";
      sha512 = "sXohfGD6xgR8VEKvLdvSCndFaFNVTlyXjgZlJ3x8U3/J0V2VTfLIZO94Gt8KUPUccFWci8dRYDGG0fQerB+aIA==";
    };
    dependencies = [
      (sources."@babel/code-frame-7.22.13" // {
        dependencies = [
          sources."chalk-2.4.2"
        ];
      })
      sources."@babel/helper-validator-identifier-7.22.20"
      (sources."@babel/highlight-7.22.20" // {
        dependencies = [
          sources."chalk-2.4.2"
        ];
      })
      sources."@puppeteer/browsers-0.5.0"
      sources."@types/node-20.6.5"
      sources."@types/yauzl-2.10.1"
      sources."agent-base-6.0.2"
      sources."ansi-regex-5.0.1"
      sources."ansi-styles-3.2.1"
      sources."argparse-2.0.1"
      sources."base64-js-1.5.1"
      sources."bl-4.1.0"
      sources."buffer-5.7.1"
      sources."buffer-crc32-0.2.13"
      sources."bufferutil-4.0.7"
      sources."callsites-3.1.0"
      sources."chalk-5.3.0"
      sources."chownr-1.1.4"
      sources."chromium-bidi-0.4.7"
      sources."cliui-8.0.1"
      sources."color-convert-1.9.3"
      sources."color-name-1.1.3"
      sources."commander-10.0.1"
      sources."cosmiconfig-8.1.3"
      sources."cross-fetch-3.1.5"
      sources."debug-4.3.4"
      sources."devtools-protocol-0.0.1107588"
      sources."emoji-regex-8.0.0"
      sources."encoding-0.1.13"
      sources."end-of-stream-1.4.4"
      sources."error-ex-1.3.2"
      sources."escalade-3.1.1"
      sources."escape-string-regexp-1.0.5"
      sources."extract-zip-2.0.1"
      sources."fd-slicer-1.1.0"
      sources."fs-constants-1.0.0"
      sources."get-caller-file-2.0.5"
      sources."get-stream-5.2.0"
      sources."has-flag-3.0.0"
      sources."https-proxy-agent-5.0.1"
      sources."iconv-lite-0.6.3"
      sources."ieee754-1.2.1"
      sources."import-fresh-3.3.0"
      sources."inherits-2.0.4"
      sources."is-arrayish-0.2.1"
      sources."is-fullwidth-code-point-3.0.0"
      sources."js-tokens-4.0.0"
      sources."js-yaml-4.1.0"
      sources."json-parse-even-better-errors-2.3.1"
      sources."lines-and-columns-1.2.4"
      sources."mitt-3.0.0"
      sources."mkdirp-classic-0.5.3"
      sources."ms-2.1.2"
      sources."node-fetch-2.6.7"
      sources."node-gyp-build-4.6.1"
      sources."once-1.4.0"
      sources."parent-module-1.0.1"
      sources."parse-json-5.2.0"
      sources."path-type-4.0.0"
      sources."pend-1.2.0"
      sources."progress-2.0.3"
      sources."proxy-from-env-1.1.0"
      sources."pump-3.0.0"
      sources."puppeteer-19.11.1"
      sources."puppeteer-core-19.11.1"
      sources."readable-stream-3.6.2"
      sources."require-directory-2.1.1"
      sources."resolve-from-4.0.0"
      sources."safe-buffer-5.2.1"
      sources."safer-buffer-2.1.2"
      sources."string-width-4.2.3"
      sources."string_decoder-1.3.0"
      sources."strip-ansi-6.0.1"
      sources."supports-color-5.5.0"
      sources."tar-fs-2.1.1"
      sources."tar-stream-2.2.0"
      sources."through-2.3.8"
      sources."tr46-0.0.3"
      sources."typescript-5.2.2"
      sources."unbzip2-stream-1.4.3"
      sources."utf-8-validate-6.0.3"
      sources."util-deprecate-1.0.2"
      sources."webidl-conversions-3.0.1"
      sources."whatwg-url-5.0.0"
      (sources."wrap-ansi-7.0.0" // {
        dependencies = [
          sources."ansi-styles-4.3.0"
          sources."color-convert-2.0.1"
          sources."color-name-1.1.4"
        ];
      })
      sources."wrappy-1.0.2"
      sources."ws-8.13.0"
      sources."y18n-5.0.8"
      sources."yargs-17.7.1"
      sources."yargs-parser-21.1.1"
      sources."yauzl-2.10.0"
    ];
    buildInputs = globalBuildInputs;
    meta = {
      description = "Command-line interface for mermaid";
      homepage = "https://github.com/mermaid-js/mermaid-cli#readme";
      license = "MIT";
    };
    production = true;
    bypassCache = true;
    reconstructLock = true;
  };
  "@microsoft/rush" = nodeEnv.buildNodePackage {
    name = "_at_microsoft_slash_rush";
    packageName = "@microsoft/rush";
Loading