textlint-rule-common-misspellings: repackage

There is no lock file in this package, but it is old and stable enough
so that we handle dependencies manually.
This commit is contained in:
natsukium 2024-05-25 17:02:56 +09:00
parent 950ff0df92
commit 5f58c6a87d
No known key found for this signature in database
GPG Key ID: 9EA45A31DB994C53
6 changed files with 139 additions and 26 deletions

View File

@ -0,0 +1,135 @@
{
lib,
stdenvNoCC,
fetchurl,
fetchFromGitHub,
fetchYarnDeps,
fixup-yarn-lock,
nodejs,
yarn,
textlint,
textlint-rule-common-misspellings,
}:
# there is no lock file in this package, but it is old and stable enough
# so that we handle dependencies manually
let
misspellings = stdenvNoCC.mkDerivation (finalAttrs: {
pname = "misspellings";
version = "1.1.0";
src = fetchurl {
url = "https://registry.npmjs.org/misspellings/-/misspellings-${finalAttrs.version}.tgz";
hash = "sha256-+4QxmGjoF0mBldN4XQMvoK8YDS4PBV9/c+/BPf4FbkM=";
};
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out/lib/node_modules/misspellings
cp -r . $out/lib/node_modules/misspellings/
runHook postInstall
'';
});
textlint-rule-helper = stdenvNoCC.mkDerivation (finalAttrs: {
pname = "textlint-rule-helper";
version = "2.3.1";
src = fetchFromGitHub {
owner = "textlint";
repo = "textlint-rule-helper";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-SVeL/3KC/yazSGsmn5We8fJAuVqfcspzN7i2a4+EOlI=";
};
offlineCache = fetchYarnDeps {
yarnLock = "${finalAttrs.src}/yarn.lock";
hash = "sha256-UN56VuUHl7aS+QLON8ZROTSCGKKCn/8xuIkR46LyY+U=";
};
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-helper
cp -r . $out/lib/node_modules/textlint-rule-helper/
runHook postInstall
'';
});
in
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "textlint-rule-common-misspellings";
version = "1.0.1";
src = fetchurl {
url = "https://registry.npmjs.org/textlint-rule-common-misspellings/-/textlint-rule-common-misspellings-${finalAttrs.version}.tgz";
hash = "sha256-5QVb5T2yGuunNhRQG5brJQyicRRbO8XewzjO2RzN0bI=";
};
dontBuild = true;
buildInputs = [
misspellings
textlint-rule-helper
];
installPhase = ''
runHook preInstall
mkdir -p $out/lib/node_modules/textlint-rule-common-misspellings/node_modules/textlint-rule-helper
cp -r ${misspellings}/lib/node_modules/misspellings $out/lib/node_modules/textlint-rule-common-misspellings/node_modules/misspellings
cp -r ${textlint-rule-helper}/lib/node_modules/textlint-rule-helper/node_modules/* $out/lib/node_modules/textlint-rule-common-misspellings/node_modules
cp -r ${textlint-rule-helper}/lib/node_modules/textlint-rule-helper/lib $out/lib/node_modules/textlint-rule-common-misspellings/node_modules/textlint-rule-helper/lib
cp -r ${textlint-rule-helper}/lib/node_modules/textlint-rule-helper/package.json $out/lib/node_modules/textlint-rule-common-misspellings/node_modules/textlint-rule-helper/package.json
cp -r . $out/lib/node_modules/textlint-rule-common-misspellings/
runHook postInstall
'';
passthru.tests = textlint.testPackages {
rule = textlint-rule-common-misspellings;
testFile = ./test.md;
};
meta = {
description = "Textlint rule to check common misspellings";
homepage = "https://github.com/io-monad/textlint-rule-common-misspellings";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ natsukium ];
mainProgram = "textlint-rule-common-misspellings";
platforms = textlint.meta.platforms;
};
})

View File

@ -0,0 +1 @@
`textlint-rule-common-misspellings` is an old and mature libary.

View File

@ -10,6 +10,7 @@
textlint-plugin-latex2e,
textlint-rule-abbr-within-parentheses,
textlint-rule-alex,
textlint-rule-common-misspellings,
textlint-rule-diacritics,
textlint-rule-en-max-word-count,
textlint-rule-max-comma,
@ -109,6 +110,7 @@ buildNpmPackage rec {
textlint-plugin-latex2e
textlint-rule-abbr-within-parentheses
textlint-rule-alex
textlint-rule-common-misspellings
textlint-rule-diacritics
textlint-rule-en-max-word-count
textlint-rule-max-comma

View File

@ -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-abbr-within-parentheses; # Added 2024-05-17
inherit (pkgs) textlint-rule-alex; # Added 2024-05-16
inherit (pkgs) textlint-rule-common-misspellings; # Added 2024-05-25
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

View File

@ -221,7 +221,6 @@
, "tailwindcss"
, "teck-programmer"
, "tern"
, "textlint-rule-common-misspellings"
, "thelounge-plugin-closepms"
, "thelounge-plugin-giphy"
, "thelounge-plugin-shortcuts"

View File

@ -93160,31 +93160,6 @@ in
bypassCache = true;
reconstructLock = true;
};
textlint-rule-common-misspellings = nodeEnv.buildNodePackage {
name = "textlint-rule-common-misspellings";
packageName = "textlint-rule-common-misspellings";
version = "1.0.1";
src = fetchurl {
url = "https://registry.npmjs.org/textlint-rule-common-misspellings/-/textlint-rule-common-misspellings-1.0.1.tgz";
sha512 = "f5KWhQFJzJBUX3RirAS25aSkAaaOHeSHtBeb7d49O+vxnAX3dZBS5DB/e5M1kR4tifW4qae64oqWZygoGYWkjQ==";
};
dependencies = [
sources."misspellings-1.1.0"
sources."textlint-rule-helper-1.2.0"
sources."unist-util-is-3.0.0"
sources."unist-util-visit-1.4.1"
sources."unist-util-visit-parents-2.1.2"
];
buildInputs = globalBuildInputs;
meta = {
description = "textlint rule to check common misspellings";
homepage = "https://github.com/io-monad/textlint-rule-common-misspellings";
license = "GPL-3.0";
};
production = true;
bypassCache = true;
reconstructLock = true;
};
thelounge-plugin-closepms = nodeEnv.buildNodePackage {
name = "thelounge-plugin-closepms";
packageName = "thelounge-plugin-closepms";