Merge pull request #258517 from dotlambda/mermaid-cli-fetchYarnDeps

mermaid-cli: use fetchYarnDeps
This commit is contained in:
Robert Schütz 2023-10-03 02:30:46 +00:00 committed by GitHub
commit 4c3e787f47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1858 additions and 3104 deletions

View File

@ -0,0 +1,80 @@
{ 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;
};
}

View File

@ -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

View File

@ -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";

View File

@ -5,7 +5,6 @@
, "@babel/cli"
, "@commitlint/cli"
, "@commitlint/config-conventional"
, "@mermaid-js/mermaid-cli"
, "@microsoft/rush"
, "@shopify/cli"
, "@tailwindcss/aspect-ratio"

File diff suppressed because it is too large Load Diff

View File

@ -169,21 +169,6 @@ final: prev: {
'';
};
mermaid-cli = prev."@mermaid-js/mermaid-cli".override (
if stdenv.isDarwin
then {}
else {
nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ];
prePatch = ''
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
'';
postInstall = ''
wrapProgram $out/bin/mmdc \
--set PUPPETEER_EXECUTABLE_PATH ${pkgs.chromium.outPath}/bin/chromium
'';
});
node-gyp = prev.node-gyp.override {
nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ];
# Teach node-gyp to use nodejs headers locally rather that download them form https://nodejs.org.