From 95507da635c22e0c33b85ddfedb0e124d292588a Mon Sep 17 00:00:00 2001 From: natsukium Date: Wed, 15 May 2024 01:30:05 +0900 Subject: [PATCH] textlint-rule-max-comma: repackage with fetchYarnDeps --- .../te/textlint-rule-max-comma/package.nix | 79 +++++++++++++++++++ .../te/textlint-rule-max-comma/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-max-comma/package.nix create mode 100644 pkgs/by-name/te/textlint-rule-max-comma/test.md diff --git a/pkgs/by-name/te/textlint-rule-max-comma/package.nix b/pkgs/by-name/te/textlint-rule-max-comma/package.nix new file mode 100644 index 000000000000..5afea41bd8c7 --- /dev/null +++ b/pkgs/by-name/te/textlint-rule-max-comma/package.nix @@ -0,0 +1,79 @@ +{ + lib, + stdenv, + fetchFromGitHub, + fetchYarnDeps, + fixup-yarn-lock, + nodejs, + yarn, + textlint, + textlint-rule-max-comma, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "textlint-rule-max-comma"; + version = "4.0.0"; + + src = fetchFromGitHub { + owner = "textlint-rule"; + repo = "textlint-rule-max-comma"; + rev = "refs/tags/v${finalAttrs.version}"; + hash = "sha256-Sf7ehhEOcy1HdgnIra8darkucF6RebQQV/NfJtft/DA="; + }; + + offlineCache = fetchYarnDeps { + yarnLock = "${finalAttrs.src}/yarn.lock"; + hash = "sha256-jSsVQhvmc5mJ1gh6I5UaLvdz+HpaXI0fXFX0KCh01/c="; + }; + + 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-max-comma + cp -r . $out/lib/node_modules/textlint-rule-max-comma/ + + runHook postInstall + ''; + + passthru.tests = textlint.testPackages { + rule = textlint-rule-max-comma; + testFile = ./test.md; + }; + + meta = { + description = "Textlint rule is that limit maximum comma(,) count of sentence"; + homepage = "https://github.com/textlint-rule/textlint-rule-max-comma"; + changelog = "https://github.com/textlint-rule/textlint-rule-max-comma/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-max-comma/test.md b/pkgs/by-name/te/textlint-rule-max-comma/test.md new file mode 100644 index 000000000000..9223245ad977 --- /dev/null +++ b/pkgs/by-name/te/textlint-rule-max-comma/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. diff --git a/pkgs/by-name/te/textlint/package.nix b/pkgs/by-name/te/textlint/package.nix index 66802e8a84fc..833a525f679c 100644 --- a/pkgs/by-name/te/textlint/package.nix +++ b/pkgs/by-name/te/textlint/package.nix @@ -7,6 +7,7 @@ makeWrapper, runCommand, textlint, + textlint-rule-max-comma, textlint-rule-preset-ja-technical-writing, }: @@ -94,6 +95,7 @@ buildNpmPackage rec { tests = lib.mergeAttrsList ( map (package: package.tests) [ + textlint-rule-max-comma textlint-rule-preset-ja-technical-writing ] ); diff --git a/pkgs/development/node-packages/aliases.nix b/pkgs/development/node-packages/aliases.nix index 26a0e604791d..21743b72f1ce 100644 --- a/pkgs/development/node-packages/aliases.nix +++ b/pkgs/development/node-packages/aliases.nix @@ -137,6 +137,7 @@ mapAliases { tedicross = throw "tedicross was removed because it was broken"; # added 2023-09-09 inherit (pkgs) terser; # Added 2023-08-31 inherit (pkgs) textlint; # Added 2024-05-13 + inherit (pkgs) textlint-rule-max-comma; # Added 2024-05-15 thelounge = pkgs.thelounge; # Added 2023-05-22 three = throw "three was removed because it was no longer needed"; # Added 2023-09-08 inherit (pkgs) titanium; # added 2023-08-17 diff --git a/pkgs/development/node-packages/node-packages.json b/pkgs/development/node-packages/node-packages.json index c3054acbb98a..0b0e5f17dfcb 100644 --- a/pkgs/development/node-packages/node-packages.json +++ b/pkgs/development/node-packages/node-packages.json @@ -227,7 +227,6 @@ , "textlint-rule-common-misspellings" , "textlint-rule-diacritics" , "textlint-rule-en-max-word-count" -, "textlint-rule-max-comma" , "textlint-rule-no-start-duplicated-conjunction" , "textlint-rule-period-in-list-item" , "textlint-rule-stop-words" diff --git a/pkgs/development/node-packages/node-packages.nix b/pkgs/development/node-packages/node-packages.nix index 16a93d37b27c..58f2fe319502 100644 --- a/pkgs/development/node-packages/node-packages.nix +++ b/pkgs/development/node-packages/node-packages.nix @@ -93867,52 +93867,6 @@ in bypassCache = true; reconstructLock = true; }; - textlint-rule-max-comma = nodeEnv.buildNodePackage { - name = "textlint-rule-max-comma"; - packageName = "textlint-rule-max-comma"; - version = "4.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/textlint-rule-max-comma/-/textlint-rule-max-comma-4.0.0.tgz"; - sha512 = "2vKKXNg1YuTqr9/FrHvOGEHFe+6lNSDtzuEv+KRB+tuaj++UNa/YPvyY34UdDYuHUSKNcYdto8GlIUhAJDW9WQ=="; - }; - 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-5.0.0" - 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 limit maxinum comma(,) count of sentence."; - homepage = "https://github.com/azu/textlint-rule-max-comma#readme"; - 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";