stylelint-lsp: migrate from pnpm_9 to pnpm_11 (#530554)

This commit is contained in:
Martin Weinelt
2026-07-23 14:28:38 +00:00
committed by GitHub

View File

@@ -1,48 +1,44 @@
{
fetchFromGitHub,
lib,
nodejs,
pnpm_9,
nodejs-slim,
pnpm_11,
fetchPnpmDeps,
pnpmConfigHook,
pnpmBuildHook,
stdenvNoCC,
nix-update-script,
runCommand,
stylelint-lsp,
}:
let
pnpm = pnpm_11;
in
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "stylelint-lsp";
version = "2.0.1";
version = "2.0.1-unstable-2026-07-19";
src = fetchFromGitHub {
owner = "bmatcuk";
repo = "stylelint-lsp";
tag = "v${finalAttrs.version}";
hash = "sha256-LUX/H7yY8Dl44vgpf7vOgtMdY7h//m5BAfrK5RRH9DM=";
rev = "0362a26ffaf1879b9ec02e2a52a11792a2d4f8d4";
hash = "sha256-qRc67tvgncERh6FDJdydN6aL/a5bVSsQQir3KPp1cFk=";
};
buildInputs = [
nodejs
];
nativeBuildInputs = [
nodejs-slim
pnpmConfigHook
pnpm_9
pnpmBuildHook
pnpm
];
pnpmDeps = fetchPnpmDeps {
inherit (finalAttrs) pname version src;
pnpm = pnpm_9;
fetcherVersion = 3;
hash = "sha256-qzUvA00ujnIibQAONOPlp5BsXcwQb/gQvOPp83hMT5A=";
inherit pnpm;
fetcherVersion = 4;
hash = "sha256-EuCvuErydwe2LGG62VHcZtN/51Gv1uhhBN3/sEiqzME=";
};
buildPhase = ''
runHook preBuild
pnpm build
runHook postBuild
'';
preInstall = ''
# remove unnecessary files
CI=true pnpm --ignore-scripts prune --prod
@@ -57,13 +53,34 @@ stdenvNoCC.mkDerivation (finalAttrs: {
mkdir -p $out/{bin,lib/stylelint-lsp}
mv {dist,node_modules} $out/lib/stylelint-lsp
chmod a+x $out/lib/stylelint-lsp/dist/index.js
patchShebangs $out/lib/stylelint-lsp/dist/index.js
ln -s $out/lib/stylelint-lsp/dist/index.js $out/bin/stylelint-lsp
runHook postInstall
'';
passthru.updateScript = nix-update-script { };
passthru = {
updateScript = nix-update-script {
extraArgs = [ "--version=branch" ];
};
tests.smoke = runCommand "stylelint-lsp-smoke-test" { } ''
INIT_REQUEST='{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"processId":null,"rootUri":"file:///tmp","workspaceFolders":[{"uri":"file:///tmp","name":"test"}],"capabilities":{}}}'
CONTENT_LENGTH=''${#INIT_REQUEST}
RESPONSE=$(
{
printf "Content-Length: %d\r\n\r\n%s" "$CONTENT_LENGTH" "$INIT_REQUEST"
sleep 1
} | timeout 3 ${lib.getExe stylelint-lsp} --stdio 2>&1 | head -c 1000
) || true
echo "$RESPONSE" | grep -q '"capabilities"'
touch $out
'';
};
meta = {
description = "Stylelint Language Server";