Unverified Commit 0bea6470 authored by Tom Hunze's avatar Tom Hunze
Browse files

conventional-changelog-cli: wrap with nodejs

parent 0e8b0c4b
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
  fetchFromGitHub,
  nodejs,
  pnpm,
  makeBinaryWrapper,
  nix-update-script,
}:

@@ -27,6 +28,7 @@ stdenv.mkDerivation (finalAttrs: {
  nativeBuildInputs = [
    nodejs
    pnpm.configHook
    makeBinaryWrapper
  ];

  buildPhase = ''
@@ -43,9 +45,10 @@ stdenv.mkDerivation (finalAttrs: {
    mkdir -p $out/lib/node_modules/conventional-changelog/
    mkdir $out/bin
    mv * $out/lib/node_modules/conventional-changelog/
    chmod +x $out/lib/node_modules/conventional-changelog/packages/conventional-changelog/dist/cli/index.js
    ln -s $out/lib/node_modules/conventional-changelog/packages/conventional-changelog/dist/cli/index.js $out/bin/conventional-changelog
    patchShebangs $out/bin/conventional-changelog

    makeBinaryWrapper ${lib.getExe nodejs} $out/bin/conventional-changelog \
      --add-flags "$out/lib/node_modules/conventional-changelog/packages/conventional-changelog/dist/cli/index.js" \
      --set NODE_PATH "$out/lib/node_modules/conventional-changelog/node_modules"

    runHook postInstall
  '';