about summary refs log tree commit diff
path: root/pkgs/by-name/te
diff options
context:
space:
mode:
authornatsukium <tomoya.otabi@gmail.com>2024-05-17 21:17:14 +0900
committernatsukium <tomoya.otabi@gmail.com>2024-05-18 01:04:52 +0900
commit1e8132663768e0381499469251e2eadc5b1d3a20 (patch)
treed4556d69abab1df57ebdf63b28785e6568f2adf4 /pkgs/by-name/te
parente242a02edc425581d9b898914573a28c2b6c2543 (diff)
textlint-rule-abbr-within-parentheses: repackage with fetchYarnDeps
Diffstat (limited to 'pkgs/by-name/te')
-rw-r--r--pkgs/by-name/te/textlint-rule-abbr-within-parentheses/package.nix79
-rw-r--r--pkgs/by-name/te/textlint-rule-abbr-within-parentheses/test.md1
-rw-r--r--pkgs/by-name/te/textlint/package.nix2
3 files changed, 82 insertions, 0 deletions
diff --git a/pkgs/by-name/te/textlint-rule-abbr-within-parentheses/package.nix b/pkgs/by-name/te/textlint-rule-abbr-within-parentheses/package.nix
new file mode 100644
index 0000000000000..96e3906930e26
--- /dev/null
+++ b/pkgs/by-name/te/textlint-rule-abbr-within-parentheses/package.nix
@@ -0,0 +1,79 @@
+{
+  lib,
+  stdenv,
+  fetchFromGitHub,
+  fetchYarnDeps,
+  fixup-yarn-lock,
+  nodejs,
+  yarn,
+  textlint,
+  textlint-rule-abbr-within-parentheses,
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "textlint-rule-abbr-within-parentheses";
+  version = "1.0.2";
+
+  src = fetchFromGitHub {
+    owner = "azu";
+    repo = "textlint-rule-abbr-within-parentheses";
+    rev = "refs/tags/${finalAttrs.version}";
+    hash = "sha256-CBrf7WtvywDmtuSyxkDtAyjmrj7KS3TQLSsNfMxeWXw=";
+  };
+
+  offlineCache = fetchYarnDeps {
+    yarnLock = "${finalAttrs.src}/yarn.lock";
+    hash = "sha256-N4tnja6qTo7jtn7Dh4TwBUCUKfbIbHvdZ7aeJcE+NlU=";
+  };
+
+  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-abbr-within-parentheses
+    cp -r . $out/lib/node_modules/textlint-rule-abbr-within-parentheses/
+
+    runHook postInstall
+  '';
+
+  passthru.tests = textlint.testPackages {
+    rule = textlint-rule-abbr-within-parentheses;
+    testFile = ./test.md;
+  };
+
+  meta = {
+    description = "Textlint rule check if write abbreviations within parentheses";
+    homepage = "https://github.com/azu/textlint-rule-abbr-within-parentheses";
+    changelog = "https://github.com/azu/textlint-rule-abbr-within-parentheses/releases/tag/${finalAttrs.src.rev}";
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ natsukium ];
+    platforms = textlint.meta.platforms;
+  };
+})
diff --git a/pkgs/by-name/te/textlint-rule-abbr-within-parentheses/test.md b/pkgs/by-name/te/textlint-rule-abbr-within-parentheses/test.md
new file mode 100644
index 0000000000000..224b1703098b7
--- /dev/null
+++ b/pkgs/by-name/te/textlint-rule-abbr-within-parentheses/test.md
@@ -0,0 +1 @@
+Passing an expression `expr` that evaluates to a store path to any built-in function which reads from the filesystem constitutes IFD(Import From Derivation).
diff --git a/pkgs/by-name/te/textlint/package.nix b/pkgs/by-name/te/textlint/package.nix
index d6355410b9c22..b894931fab884 100644
--- a/pkgs/by-name/te/textlint/package.nix
+++ b/pkgs/by-name/te/textlint/package.nix
@@ -8,6 +8,7 @@
   runCommand,
   textlint,
   textlint-plugin-latex2e,
+  textlint-rule-abbr-within-parentheses,
   textlint-rule-alex,
   textlint-rule-diacritics,
   textlint-rule-en-max-word-count,
@@ -105,6 +106,7 @@ buildNpmPackage rec {
     tests = lib.mergeAttrsList (
       map (package: package.tests) [
         textlint-plugin-latex2e
+        textlint-rule-abbr-within-parentheses
         textlint-rule-alex
         textlint-rule-diacritics
         textlint-rule-en-max-word-count