textlint: 14.3.0 -> 15.2.1 (#434490)
This commit is contained in:
commit
966774277f
@ -1,12 +1,11 @@
|
|||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
stdenv,
|
stdenv,
|
||||||
buildNpmPackage,
|
|
||||||
fetchFromGitHub,
|
fetchFromGitHub,
|
||||||
autoconf,
|
|
||||||
automake,
|
|
||||||
makeWrapper,
|
makeWrapper,
|
||||||
python311,
|
nodejs-slim,
|
||||||
|
pnpm_9,
|
||||||
|
versionCheckHook,
|
||||||
runCommand,
|
runCommand,
|
||||||
textlint,
|
textlint,
|
||||||
textlint-plugin-latex2e,
|
textlint-plugin-latex2e,
|
||||||
@ -27,53 +26,83 @@
|
|||||||
textlint-rule-write-good,
|
textlint-rule-write-good,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
buildNpmPackage rec {
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
pname = "textlint";
|
pname = "textlint";
|
||||||
version = "14.3.0";
|
version = "15.2.1";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "textlint";
|
owner = "textlint";
|
||||||
repo = "textlint";
|
repo = "textlint";
|
||||||
tag = "v${version}";
|
tag = "v${finalAttrs.version}";
|
||||||
hash = "sha256-FbPJr7oTsU7WC5RTXyG7X5d0KPJJqRbjGwM/F023Cx8=";
|
hash = "sha256-xjtmYz+O+Sn697OrBkPddv1Ma5UsOkO5v4SGlhsaYWA=";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
# this package uses lerna and requires building many workspaces.
|
# The upstream lockfile contains "overrides" configuration that conflicts with Nix's build environment.
|
||||||
# this patch removes unnecessary workspaces,
|
# We remove these overrides to allow pnpm to install dependencies without modifying the lockfile,
|
||||||
# reducing package size and build time.
|
# which would break the reproducible build process.
|
||||||
./remove-workspaces.patch
|
#
|
||||||
|
# Without this patch, pnpm fails with:
|
||||||
|
# ERR_PNPM_LOCKFILE_CONFIG_MISMATCH Cannot proceed with the frozen installation. The current "overrides" configuration doesn't match the value found in the lockfile
|
||||||
|
# Update your lockfile using "pnpm install --no-frozen-lockfile"
|
||||||
|
# ERROR: pnpm failed to install dependencies
|
||||||
|
./remove-overrides.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
npmDepsHash = "sha256-l+1JntqIPttuYXKsVEdJOB1qQfsoheZk+7Z7OJ67z5E=";
|
pnpmDeps = pnpm_9.fetchDeps {
|
||||||
|
inherit (finalAttrs)
|
||||||
|
pname
|
||||||
|
version
|
||||||
|
src
|
||||||
|
patches
|
||||||
|
;
|
||||||
|
fetcherVersion = 1;
|
||||||
|
hash = "sha256-TyKtH4HjCDTydVd/poG05Yh5nRSfcrSPzFLEE3Oq2uo=";
|
||||||
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
autoconf
|
makeWrapper
|
||||||
automake
|
nodejs-slim
|
||||||
]
|
pnpm_9.configHook
|
||||||
++ lib.optionals (stdenv.hostPlatform.system == "aarch64-linux") [
|
|
||||||
# File "/build/source/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
|
|
||||||
# npm error ModuleNotFoundError: No module named 'distutils'
|
|
||||||
python311
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
|
||||||
|
pnpm --filter textlint... build
|
||||||
|
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
mkdir -p $out/{bin,lib}
|
mkdir -p $out/{bin,lib/node_modules}
|
||||||
|
|
||||||
npm prune --omit=dev --no-save
|
rm -r node_modules
|
||||||
rm -r node_modules/.cache
|
rm -r packages/textlint/node_modules
|
||||||
rm -r packages/textlint-{scripts,tester}
|
rm -r packages/@textlint/**/node_modules
|
||||||
rm -r packages/@textlint/*/test
|
pnpm install --offline --ignore-scripts --frozen-lockfile --prod --filter textlint...
|
||||||
|
|
||||||
cp -r node_modules $out/lib
|
cp -r packages/{textlint,@textlint} $out/lib/node_modules
|
||||||
cp -r packages $out/lib
|
cp -r node_modules/.pnpm $out/lib/node_modules
|
||||||
ln -s $out/lib/node_modules/textlint/bin/textlint.js $out/bin/textlint
|
|
||||||
|
makeWrapper "${lib.getExe nodejs-slim}" "$out/bin/textlint" \
|
||||||
|
--add-flags "$out/lib/node_modules/textlint/bin/textlint.js"
|
||||||
|
|
||||||
|
# Remove dangling symlinks to packages we didn't copy to $out
|
||||||
|
find $out/lib/node_modules/.pnpm -type l -exec test ! -e {} \; -delete
|
||||||
|
|
||||||
|
# Remove test directories recursively
|
||||||
|
find $out/lib/node_modules -type d -name "test" -exec rm -rf {} +
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
nativeInstallCheckInputs = [ versionCheckHook ];
|
||||||
|
|
||||||
|
doInstallCheck = true;
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
withPackages =
|
withPackages =
|
||||||
ps:
|
ps:
|
||||||
@ -139,9 +168,10 @@ buildNpmPackage rec {
|
|||||||
meta = {
|
meta = {
|
||||||
description = "Pluggable natural language linter for text and markdown";
|
description = "Pluggable natural language linter for text and markdown";
|
||||||
homepage = "https://github.com/textlint/textlint";
|
homepage = "https://github.com/textlint/textlint";
|
||||||
changelog = "https://github.com/textlint/textlint/blob/${src.rev}/CHANGELOG.md";
|
changelog = "https://github.com/textlint/textlint/blob/${finalAttrs.src.tag}/CHANGELOG.md";
|
||||||
license = lib.licenses.mit;
|
license = lib.licenses.mit;
|
||||||
maintainers = with lib.maintainers; [ natsukium ];
|
maintainers = with lib.maintainers; [ natsukium ];
|
||||||
mainProgram = "textlint";
|
mainProgram = "textlint";
|
||||||
|
platforms = nodejs-slim.meta.platforms;
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
|
|||||||
14
pkgs/by-name/te/textlint/remove-overrides.patch
Normal file
14
pkgs/by-name/te/textlint/remove-overrides.patch
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
|
||||||
|
index 1f0e8f8b..68a9c06a 100644
|
||||||
|
--- a/pnpm-lock.yaml
|
||||||
|
+++ b/pnpm-lock.yaml
|
||||||
|
@@ -4,9 +4,6 @@ settings:
|
||||||
|
autoInstallPeers: true
|
||||||
|
excludeLinksFromLockfile: false
|
||||||
|
|
||||||
|
-overrides:
|
||||||
|
- '@textlint/ast-node-types': workspace:*
|
||||||
|
-
|
||||||
|
importers:
|
||||||
|
|
||||||
|
.:
|
||||||
@ -1,19 +0,0 @@
|
|||||||
diff --git a/package.json b/package.json
|
|
||||||
index 9dd7fdc6..c5e74f88 100644
|
|
||||||
--- a/package.json
|
|
||||||
+++ b/package.json
|
|
||||||
@@ -56,12 +56,8 @@
|
|
||||||
"trailingComma": "none"
|
|
||||||
},
|
|
||||||
"workspaces": [
|
|
||||||
- "packages/*",
|
|
||||||
- "examples/*",
|
|
||||||
- "packages/@textlint/*",
|
|
||||||
- "packages/textlint-scripts/examples/*",
|
|
||||||
- "test/*",
|
|
||||||
- "website"
|
|
||||||
+ "packages/textlint",
|
|
||||||
+ "packages/@textlint/*"
|
|
||||||
],
|
|
||||||
"packageManager": "npm@9.9.2"
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user