From 8fc1968cb284d6d824a468a617de3ff5946f811d Mon Sep 17 00:00:00 2001 From: natsukium Date: Fri, 17 May 2024 10:12:42 +0900 Subject: [PATCH] textlint-rule-en-max-word-count: repackage with fetchYarnDeps --- .../package.nix | 79 +++++++++++++++++++ .../textlint-rule-en-max-word-count/test.md | 1 + pkgs/by-name/te/textlint/package.nix | 2 + pkgs/development/node-packages/aliases.nix | 1 + .../node-packages/node-packages.json | 1 - .../node-packages/node-packages.nix | 46 ----------- 6 files changed, 83 insertions(+), 47 deletions(-) create mode 100644 pkgs/by-name/te/textlint-rule-en-max-word-count/package.nix create mode 100644 pkgs/by-name/te/textlint-rule-en-max-word-count/test.md diff --git a/pkgs/by-name/te/textlint-rule-en-max-word-count/package.nix b/pkgs/by-name/te/textlint-rule-en-max-word-count/package.nix new file mode 100644 index 000000000000..893ed385dabb --- /dev/null +++ b/pkgs/by-name/te/textlint-rule-en-max-word-count/package.nix @@ -0,0 +1,79 @@ +{ + 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; + }; +}) diff --git a/pkgs/by-name/te/textlint-rule-en-max-word-count/test.md b/pkgs/by-name/te/textlint-rule-en-max-word-count/test.md new file mode 100644 index 000000000000..717096b6f333 --- /dev/null +++ b/pkgs/by-name/te/textlint-rule-en-max-word-count/test.md @@ -0,0 +1 @@ +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. diff --git a/pkgs/by-name/te/textlint/package.nix b/pkgs/by-name/te/textlint/package.nix index 892976116f65..a389b5fd4e3f 100644 --- a/pkgs/by-name/te/textlint/package.nix +++ b/pkgs/by-name/te/textlint/package.nix @@ -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 diff --git a/pkgs/development/node-packages/aliases.nix b/pkgs/development/node-packages/aliases.nix index 4a753a886ff3..75e663186225 100644 --- a/pkgs/development/node-packages/aliases.nix +++ b/pkgs/development/node-packages/aliases.nix @@ -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 diff --git a/pkgs/development/node-packages/node-packages.json b/pkgs/development/node-packages/node-packages.json index 31d217c81cdf..b06e7b2ad950 100644 --- a/pkgs/development/node-packages/node-packages.json +++ b/pkgs/development/node-packages/node-packages.json @@ -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" diff --git a/pkgs/development/node-packages/node-packages.nix b/pkgs/development/node-packages/node-packages.nix index 1b17797ebf4e..aa54227896e9 100644 --- a/pkgs/development/node-packages/node-packages.nix +++ b/pkgs/development/node-packages/node-packages.nix @@ -93223,52 +93223,6 @@ in bypassCache = true; reconstructLock = true; }; - textlint-rule-en-max-word-count = nodeEnv.buildNodePackage { - name = "textlint-rule-en-max-word-count"; - packageName = "textlint-rule-en-max-word-count"; - version = "2.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/textlint-rule-en-max-word-count/-/textlint-rule-en-max-word-count-2.0.1.tgz"; - sha512 = "gZMxUU+/O8QIchBQoo50QryknmMKahb2vBj89wVvk+Dhvp70nAJKSkpt2vjZVYBWCxpIKysQlwheBjrFZWpkfg=="; - }; - dependencies = [ - sources."@textlint/ast-node-types-13.4.1" - sources."@types/unist-2.0.10" - sources."bail-1.0.5" - sources."boundary-2.0.0" - sources."ccount-1.1.0" - sources."comma-separated-tokens-1.0.8" - sources."extend-3.0.2" - sources."hast-util-from-parse5-5.0.3" - sources."hast-util-parse-selector-2.2.5" - sources."hastscript-5.1.2" - sources."is-buffer-2.0.5" - sources."is-plain-obj-2.1.0" - sources."parse5-5.1.1" - sources."property-information-5.6.0" - sources."rehype-parse-6.0.2" - sources."sentence-splitter-4.4.1" - sources."space-separated-tokens-1.1.5" - sources."structured-source-4.0.0" - sources."textlint-util-to-string-3.3.4" - sources."trough-1.0.5" - sources."unified-8.4.2" - sources."unist-util-stringify-position-2.0.3" - sources."vfile-4.2.1" - sources."vfile-message-2.0.4" - sources."web-namespaces-1.1.4" - sources."xtend-4.0.2" - ]; - buildInputs = globalBuildInputs; - 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"; - license = "MIT"; - }; - production = true; - bypassCache = true; - reconstructLock = true; - }; textlint-rule-no-start-duplicated-conjunction = nodeEnv.buildNodePackage { name = "textlint-rule-no-start-duplicated-conjunction"; packageName = "textlint-rule-no-start-duplicated-conjunction";