summaryrefslogtreecommitdiffstats
path: root/flake/pkgs/by-name/prettier-plugin-svelte/package.nix
blob: 29d85fb2bc7729634df7f2b528ae8fc55d4b41ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{
  buildNpmPackage,
  fetchFromGitHub,
  pins,
}: let
  pin = pins.prettier-plugin-svelte;
in
  buildNpmPackage (finalAttrs: {
    pname = "prettier-plugin-svelte";
    version = pin.version or pin.revision;

    src = fetchFromGitHub {
      inherit (pin.repository) owner repo;
      rev = finalAttrs.version;
      sha256 = pin.hash;
    };

    npmDepsHash = "sha256-zejYnwkj6CBWOqA6LBYBEXMg0jT2vJqinBwzKdWIqpY=";

    dontNpmPrune = true;

    # Fixes error: Cannot find module 'prettier'
    postInstall = ''
      pushd "$nodeModulesPath"
      find -mindepth 1 -maxdepth 1 -type d -print0 | grep --null-data -Exv "\./(ulid|prettier)" | xargs -0 rm -rfv
      popd
    '';
  })