Unverified Commit 8fc1968c authored by natsukium's avatar natsukium
Browse files

textlint-rule-en-max-word-count: repackage with fetchYarnDeps

parent 3109179f
Loading
Loading
Loading
Loading
+79 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  fetchYarnDeps,
  fixup-yarn-lock,
  nodejs,
  yarn,
  textlint,
  textlint-rule-en-max-word-count,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "textlint-rule-en-max-word-count";
  version = "2.0.1";

  src = fetchFromGitHub {
    owner = "textlint-rule";
    repo = "textlint-rule-en-max-word-count";
    rev = "refs/tags/v${finalAttrs.version}";
    hash = "sha256-ZZWN0PVHQBHcvJ53jDtD/6wLxBYmSHO7OXb5UQQAmyc=";
  };

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

  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-en-max-word-count
    cp -r . $out/lib/node_modules/textlint-rule-en-max-word-count/

    runHook postInstall
  '';

  passthru.tests = textlint.testPackages {
    rule = textlint-rule-en-max-word-count;
    testFile = ./test.md;
  };

  meta = {
    description = "Textlint rule that specify the maximum word count of a sentence";
    homepage = "https://github.com/textlint-rule/textlint-rule-en-max-word-count";
    changelog = "https://github.com/textlint-rule/textlint-rule-en-max-word-count/releases/tag/${finalAttrs.src.rev}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ natsukium ];
    platforms = textlint.meta.platforms;
  };
})
+1 −0
Original line number Diff line number Diff line
Nix is a tool that takes a unique approach to package management and system configuration, learn how to make reproducible declarative and reliable systems, Nix builds packages in isolation from each other, this ensures that they are reproducible and don’t have undeclared dependencies, so if a package works on one machine, it will also work on another.
+2 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
  textlint-plugin-latex2e,
  textlint-rule-alex,
  textlint-rule-diacritics,
  textlint-rule-en-max-word-count,
  textlint-rule-max-comma,
  textlint-rule-preset-ja-technical-writing,
  textlint-rule-stop-words,
@@ -104,6 +105,7 @@ buildNpmPackage rec {
        textlint-plugin-latex2e
        textlint-rule-alex
        textlint-rule-diacritics
        textlint-rule-en-max-word-count
        textlint-rule-max-comma
        textlint-rule-preset-ja-technical-writing
        textlint-rule-stop-words
+1 −0
Original line number Diff line number Diff line
@@ -140,6 +140,7 @@ mapAliases {
  textlint-plugin-latex = throw "textlint-plugin-latex was removed because it is unmaintained for years. Please use textlint-plugin-latex2e instead."; # Added 2024-05-17
  inherit (pkgs) textlint-rule-alex; # Added 2024-05-16
  inherit (pkgs) textlint-rule-diacritics; # Added 2024-05-16
  inherit (pkgs) textlint-rule-en-max-word-count; # Added 2024-05-17
  inherit (pkgs) textlint-rule-max-comma; # Added 2024-05-15
  inherit (pkgs) textlint-rule-stop-words; # Added 2024-05-17
  inherit (pkgs) textlint-rule-terminology; # Added 2024-05-17
+0 −1
Original line number Diff line number Diff line
@@ -223,7 +223,6 @@
, "tern"
, "textlint-rule-abbr-within-parentheses"
, "textlint-rule-common-misspellings"
, "textlint-rule-en-max-word-count"
, "textlint-rule-no-start-duplicated-conjunction"
, "textlint-rule-period-in-list-item"
, "textlint-rule-unexpanded-acronym"
Loading