about summary refs log tree commit diff
path: root/pkgs/by-name/te/textlint-rule-no-start-duplicated-conjunction/package.nix
blob: 1390e9ac54b12d738cd405cd6153b2dd5cb80d1b (plain) (blame)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{
  lib,
  stdenv,
  fetchFromGitHub,
  fetchYarnDeps,
  fixup-yarn-lock,
  nodejs,
  yarn,
  textlint,
  textlint-rule-no-start-duplicated-conjunction,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "textlint-rule-no-start-duplicated-conjunction";
  version = "2.0.2";

  src = fetchFromGitHub {
    owner = "textlint-rule";
    repo = "textlint-rule-no-start-duplicated-conjunction";
    rev = "refs/tags/${finalAttrs.version}";
    hash = "sha256-DtuCkHy440j2VI/JDJGrW2M8alQ8pxllfIZfB4+9z3U=";
  };

  offlineCache = fetchYarnDeps {
    yarnLock = "${finalAttrs.src}/yarn.lock";
    hash = "sha256-+3SJQgOG5bYSmNWbxsFNEEtKtCg8V04MIk6FhHwOZMo=";
  };

  nativeBuildInputs = [
    fixup-yarn-lock
    nodejs
    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 build

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    yarn --offline --production install
    rm -r test
    mkdir -p $out/lib/node_modules/textlint-rule-no-start-duplicated-conjunction
    cp -r . $out/lib/node_modules/textlint-rule-no-start-duplicated-conjunction/

    runHook postInstall
  '';

  passthru.tests = textlint.testPackages {
    rule = textlint-rule-no-start-duplicated-conjunction;
    testFile = ./test.md;
  };

  meta = {
    description = "Textlint rule that check no start with duplicated conjunction";
    homepage = "https://github.com/textlint-rule/textlint-rule-no-start-duplicated-conjunction";
    changelog = "https://github.com/textlint-rule/textlint-rule-no-start-duplicated-conjunction/releases/tag/${finalAttrs.src.rev}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ natsukium ];
    platforms = textlint.meta.platforms;
  };
})