From 950ff0df9280eaaf8fd6d2a7cb0f0b300a1ac42d Mon Sep 17 00:00:00 2001 From: natsukium Date: Fri, 17 May 2024 21:25:25 +0900 Subject: [PATCH] textlint-rule-no-start-duplicated-conjunction: repackage with fetchYarnDeps --- .../package.nix | 79 +++++++++++++++++++ .../test.md | 3 + 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 | 45 ----------- 6 files changed, 85 insertions(+), 46 deletions(-) create mode 100644 pkgs/by-name/te/textlint-rule-no-start-duplicated-conjunction/package.nix create mode 100644 pkgs/by-name/te/textlint-rule-no-start-duplicated-conjunction/test.md diff --git a/pkgs/by-name/te/textlint-rule-no-start-duplicated-conjunction/package.nix b/pkgs/by-name/te/textlint-rule-no-start-duplicated-conjunction/package.nix new file mode 100644 index 000000000000..1390e9ac54b1 --- /dev/null +++ b/pkgs/by-name/te/textlint-rule-no-start-duplicated-conjunction/package.nix @@ -0,0 +1,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; + }; +}) diff --git a/pkgs/by-name/te/textlint-rule-no-start-duplicated-conjunction/test.md b/pkgs/by-name/te/textlint-rule-no-start-duplicated-conjunction/test.md new file mode 100644 index 000000000000..41c8f499942e --- /dev/null +++ b/pkgs/by-name/te/textlint-rule-no-start-duplicated-conjunction/test.md @@ -0,0 +1,3 @@ +But, A is ~. +So, A is ~. +But, A is ~. diff --git a/pkgs/by-name/te/textlint/package.nix b/pkgs/by-name/te/textlint/package.nix index b894931fab88..2e683c5d0823 100644 --- a/pkgs/by-name/te/textlint/package.nix +++ b/pkgs/by-name/te/textlint/package.nix @@ -13,6 +13,7 @@ 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-preset-ja-technical-writing, textlint-rule-stop-words, @@ -111,6 +112,7 @@ buildNpmPackage rec { 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-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 2e6b79dbdbbb..e623708d1618 100644 --- a/pkgs/development/node-packages/aliases.nix +++ b/pkgs/development/node-packages/aliases.nix @@ -143,6 +143,7 @@ mapAliases { 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-no-start-duplicated-conjunction; # Added 2024-05-17 inherit (pkgs) textlint-rule-period-in-list-item; # Added 2024-05-17 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 f210967f0a64..d8563afa47bd 100644 --- a/pkgs/development/node-packages/node-packages.json +++ b/pkgs/development/node-packages/node-packages.json @@ -222,7 +222,6 @@ , "teck-programmer" , "tern" , "textlint-rule-common-misspellings" -, "textlint-rule-no-start-duplicated-conjunction" , "thelounge-plugin-closepms" , "thelounge-plugin-giphy" , "thelounge-plugin-shortcuts" diff --git a/pkgs/development/node-packages/node-packages.nix b/pkgs/development/node-packages/node-packages.nix index 36bea39739e2..bf9019a762d4 100644 --- a/pkgs/development/node-packages/node-packages.nix +++ b/pkgs/development/node-packages/node-packages.nix @@ -93185,51 +93185,6 @@ in 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"; - version = "2.0.2"; - src = fetchurl { - url = "https://registry.npmjs.org/textlint-rule-no-start-duplicated-conjunction/-/textlint-rule-no-start-duplicated-conjunction-2.0.2.tgz"; - sha512 = "HydBbkWjnMn4KrnlpnusY1BGjIG+64UySxRCvRphUAIiuJL2nbkdrIIiOjwfQhllKUa7Sf33bs6RAcbEWjZVfg=="; - }; - dependencies = [ - sources."@textlint/ast-node-types-4.4.3" - sources."@types/unist-2.0.10" - sources."boundary-1.0.1" - sources."buffer-from-1.1.2" - sources."concat-stream-2.0.0" - sources."inherits-2.0.4" - sources."object-assign-4.1.1" - sources."object_values-0.1.2" - sources."readable-stream-3.6.2" - sources."safe-buffer-5.2.1" - sources."sentence-splitter-3.2.3" - sources."string_decoder-1.3.0" - sources."structured-source-3.0.2" - (sources."textlint-rule-helper-2.3.1" // { - dependencies = [ - sources."@textlint/ast-node-types-13.4.1" - sources."boundary-2.0.0" - sources."structured-source-4.0.0" - ]; - }) - sources."typedarray-0.0.6" - sources."unist-util-is-4.1.0" - sources."unist-util-visit-2.0.3" - sources."unist-util-visit-parents-3.1.1" - sources."util-deprecate-1.0.2" - ]; - buildInputs = globalBuildInputs; - meta = { - description = "textlint rule that check no start with duplicated conjunction."; - homepage = "https://github.com/textlint-rule/textlint-rule-no-start-duplicated-conjunction"; - license = "MIT"; - }; - production = true; - bypassCache = true; - reconstructLock = true; - }; thelounge-plugin-closepms = nodeEnv.buildNodePackage { name = "thelounge-plugin-closepms"; packageName = "thelounge-plugin-closepms";