treewide: use `addBinToPathHook`, minor cleanups (#379187)
[NixPkgs.git] / pkgs / by-name / te / textlint-rule-max-comma / package.nix
blob7c6ca92edcbbfc0e549caa8218137f6900bf3fbc
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   fetchYarnDeps,
6   fixup-yarn-lock,
7   nodejs,
8   yarn,
9   textlint,
10   textlint-rule-max-comma,
13 stdenv.mkDerivation (finalAttrs: {
14   pname = "textlint-rule-max-comma";
15   version = "4.0.0";
17   src = fetchFromGitHub {
18     owner = "textlint-rule";
19     repo = "textlint-rule-max-comma";
20     tag = "v${finalAttrs.version}";
21     hash = "sha256-Sf7ehhEOcy1HdgnIra8darkucF6RebQQV/NfJtft/DA=";
22   };
24   offlineCache = fetchYarnDeps {
25     yarnLock = "${finalAttrs.src}/yarn.lock";
26     hash = "sha256-jSsVQhvmc5mJ1gh6I5UaLvdz+HpaXI0fXFX0KCh01/c=";
27   };
29   nativeBuildInputs = [
30     fixup-yarn-lock
31     nodejs
32     yarn
33   ];
35   configurePhase = ''
36     runHook preConfigure
38     export HOME=$(mktemp -d)
39     yarn config --offline set yarn-offline-mirror "$offlineCache"
40     fixup-yarn-lock yarn.lock
41     yarn --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive install
42     patchShebangs node_modules
44     runHook postConfigure
45   '';
47   buildPhase = ''
48     runHook preBuild
50     yarn --offline build
52     runHook postBuild
53   '';
55   installPhase = ''
56     runHook preInstall
58     yarn --offline --production install
59     rm -r test
60     mkdir -p $out/lib/node_modules/textlint-rule-max-comma
61     cp -r . $out/lib/node_modules/textlint-rule-max-comma/
63     runHook postInstall
64   '';
66   passthru.tests = textlint.testPackages {
67     rule = textlint-rule-max-comma;
68     testFile = ./test.md;
69   };
71   meta = {
72     description = "Textlint rule is that limit maximum comma(,) count of sentence";
73     homepage = "https://github.com/textlint-rule/textlint-rule-max-comma";
74     changelog = "https://github.com/textlint-rule/textlint-rule-max-comma/releases/tag/v${finalAttrs.version}";
75     license = lib.licenses.mit;
76     maintainers = with lib.maintainers; [ natsukium ];
77     platforms = textlint.meta.platforms;
78   };