From 607125a0c2a0eee6d88ac7f24382f3b5956f84c1 Mon Sep 17 00:00:00 2001 From: "P. R. d. O" Date: Tue, 5 Sep 2023 10:45:20 -0600 Subject: [PATCH] yaml-language-server: use mkYarnPackage --- pkgs/development/node-packages/aliases.nix | 1 + .../node-packages/node-packages.json | 1 - .../node-packages/node-packages.nix | 41 ------- pkgs/development/node-packages/overrides.nix | 8 -- .../yaml-language-server/default.nix | 41 +++++++ .../yaml-language-server/package.json | 108 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 +- 7 files changed, 151 insertions(+), 51 deletions(-) create mode 100644 pkgs/development/tools/language-servers/yaml-language-server/default.nix create mode 100644 pkgs/development/tools/language-servers/yaml-language-server/package.json diff --git a/pkgs/development/node-packages/aliases.nix b/pkgs/development/node-packages/aliases.nix index cfe6b90420e9..a4cd109fc1d4 100644 --- a/pkgs/development/node-packages/aliases.nix +++ b/pkgs/development/node-packages/aliases.nix @@ -113,6 +113,7 @@ mapAliases { vue-language-server = self.vls; # added 2023-08-20 inherit (pkgs) web-ext; # added 2023-08-20 inherit (pkgs) write-good; # added 2023-08-20 + inherit (pkgs) yaml-language-server; # added 2023-09-05 inherit (pkgs) yo; # added 2023-08-20 zx = pkgs.zx; # added 2023-08-01 } diff --git a/pkgs/development/node-packages/node-packages.json b/pkgs/development/node-packages/node-packages.json index cac48a7730b3..2a9130699204 100644 --- a/pkgs/development/node-packages/node-packages.json +++ b/pkgs/development/node-packages/node-packages.json @@ -332,7 +332,6 @@ , "wrangler" , "wring" , "@yaegassy/coc-nginx" -, "yaml-language-server" , "yalc" , "yarn" , "@zwave-js/server" diff --git a/pkgs/development/node-packages/node-packages.nix b/pkgs/development/node-packages/node-packages.nix index 45bc2fdc9fa0..eadfbf067d43 100644 --- a/pkgs/development/node-packages/node-packages.nix +++ b/pkgs/development/node-packages/node-packages.nix @@ -116773,47 +116773,6 @@ in bypassCache = true; reconstructLock = true; }; - yaml-language-server = nodeEnv.buildNodePackage { - name = "yaml-language-server"; - packageName = "yaml-language-server"; - version = "1.14.0"; - src = fetchurl { - url = "https://registry.npmjs.org/yaml-language-server/-/yaml-language-server-1.14.0.tgz"; - sha512 = "HnNiHM5AOTXuM8ZpubzqgTy+7V5kFiMXVedOT2yjhvnxCw6pbMXcD/ymHaaT5v2ue0H8GGH4NFkvCEzcIcTJDg=="; - }; - dependencies = [ - sources."ajv-8.12.0" - sources."fast-deep-equal-3.1.3" - sources."json-schema-traverse-1.0.0" - sources."jsonc-parser-3.2.0" - sources."lodash-4.17.21" - sources."punycode-2.3.0" - sources."request-light-0.5.8" - sources."require-from-string-2.0.2" - sources."uri-js-4.4.1" - sources."vscode-json-languageservice-4.1.8" - sources."vscode-jsonrpc-6.0.0" - sources."vscode-languageserver-7.0.0" - (sources."vscode-languageserver-protocol-3.16.0" // { - dependencies = [ - sources."vscode-languageserver-types-3.16.0" - ]; - }) - sources."vscode-languageserver-textdocument-1.0.10" - sources."vscode-languageserver-types-3.17.3" - sources."vscode-nls-5.2.0" - sources."vscode-uri-3.0.7" - sources."yaml-2.2.2" - ]; - buildInputs = globalBuildInputs; - meta = { - description = "YAML language server"; - license = "MIT"; - }; - production = true; - bypassCache = true; - reconstructLock = true; - }; yalc = nodeEnv.buildNodePackage { name = "yalc"; packageName = "yalc"; diff --git a/pkgs/development/node-packages/overrides.nix b/pkgs/development/node-packages/overrides.nix index b6d6aa9e6e38..6bdabe316284 100644 --- a/pkgs/development/node-packages/overrides.nix +++ b/pkgs/development/node-packages/overrides.nix @@ -486,12 +486,4 @@ final: prev: { rm -r $out/lib/node_modules/wrangler/node_modules/@esbuild/sunos-x64 ''; }); - - yaml-language-server = prev.yaml-language-server.override { - nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ]; - postInstall = '' - wrapProgram "$out/bin/yaml-language-server" \ - --prefix NODE_PATH : ${final.prettier}/lib/node_modules - ''; - }; } diff --git a/pkgs/development/tools/language-servers/yaml-language-server/default.nix b/pkgs/development/tools/language-servers/yaml-language-server/default.nix new file mode 100644 index 000000000000..080b39dcf46e --- /dev/null +++ b/pkgs/development/tools/language-servers/yaml-language-server/default.nix @@ -0,0 +1,41 @@ +{ lib +, mkYarnPackage +, fetchYarnDeps +, fetchFromGitHub +}: + +mkYarnPackage rec { + pname = "yaml-language-server"; + version = "1.14.0"; + + src = fetchFromGitHub { + owner = "redhat-developer"; + repo = "yaml-language-server"; + rev = version; + hash = "sha256-DS5kMw/x8hP2MzxHdHXnBqqBGLq21NiZBb5ApjEe/ts="; + }; + + packageJSON = ./package.json; + offlineCache = fetchYarnDeps { + yarnLock = "${src}/yarn.lock"; + hash = "sha256-zHcxZ4VU6CGux72Nsy0foU4gFshK1wO/LTfnwOoirmg="; + }; + + buildPhase = '' + runHook preBuild + + export HOME=$(mktemp -d) + yarn --offline build + + runHook postBuild + ''; + + meta = { + changelog = "https://github.com/redhat-developer/yaml-language-server/blob/${src.rev}/CHANGELOG.md"; + description = "Language Server for YAML Files"; + homepage = "https://github.com/redhat-developer/yaml-language-server"; + license = lib.licenses.mit; + mainProgram = "yaml-language-server"; + maintainers = with lib.maintainers; [ wolfangaukang ]; + }; +} diff --git a/pkgs/development/tools/language-servers/yaml-language-server/package.json b/pkgs/development/tools/language-servers/yaml-language-server/package.json new file mode 100644 index 000000000000..c270da41f4df --- /dev/null +++ b/pkgs/development/tools/language-servers/yaml-language-server/package.json @@ -0,0 +1,108 @@ +{ + "name": "yaml-language-server", + "description": "YAML language server", + "version": "1.14.0", + "author": "Gorkem Ercan (Red Hat)", + "license": "MIT", + "contributors": [ + { + "name": "Joshua Pinkney", + "email": "joshpinkney@gmail.com" + }, + { + "name": "Yevhen Vydolob", + "email": "yvydolob@redhat.com" + }, + { + "name": "Google LLC" + } + ], + "bin": { + "yaml-language-server": "./bin/yaml-language-server" + }, + "main": "./out/server/src/index.js", + "keywords": [ + "yaml", + "LSP" + ], + "repository": { + "type": "git", + "url": "https://github.com/redhat-developer/yaml-language-server.git" + }, + "optionalDependencies": { + "prettier": "2.8.7" + }, + "dependencies": { + "ajv": "^8.11.0", + "lodash": "4.17.21", + "request-light": "^0.5.7", + "vscode-json-languageservice": "4.1.8", + "vscode-languageserver": "^7.0.0", + "vscode-languageserver-textdocument": "^1.0.1", + "vscode-languageserver-types": "^3.16.0", + "vscode-nls": "^5.0.0", + "vscode-uri": "^3.0.2", + "yaml": "2.2.2" + }, + "devDependencies": { + "@microsoft/eslint-formatter-sarif": "3.0.0", + "@types/chai": "^4.2.12", + "@types/mocha": "8.2.2", + "@types/node": "16.x", + "@types/prettier": "2.7.2", + "@types/sinon": "^9.0.5", + "@types/sinon-chai": "^3.2.5", + "@typescript-eslint/eslint-plugin": "^5.38.0", + "@typescript-eslint/parser": "^5.38.0", + "chai": "^4.2.0", + "coveralls": "3.1.1", + "eslint": "^8.24.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-prettier": "^4.2.1", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.0", + "mocha": "9.2.2", + "mocha-lcov-reporter": "^1.3.0", + "nyc": "^15.1.0", + "rimraf": "^3.0.2", + "sinon": "^9.0.3", + "sinon-chai": "^3.5.0", + "source-map-support": "^0.5.19", + "ts-node": "^10.0.0", + "typescript": "^4.8.3" + }, + "scripts": { + "clean": "rimraf out/server && rimraf lib", + "compile": "tsc -p .", + "watch": "tsc --watch -p .", + "test": "mocha --require ts-node/register --timeout 5000 --ui bdd ./test/*.test.ts", + "coverage": "nyc mocha --require ts-node/register --timeout 5000 --require source-map-support/register --recursive --ui bdd ./test/*.test.ts", + "coveralls": "nyc --reporter=lcov --reporter=text mocha --timeout 5000 --require ts-node/register --require source-map-support/register --recursive --ui bdd ./test/*.test.ts", + "lint": "eslint --max-warnings 0 -c .eslintrc.js --ext .ts src test", + "lint-ci": "eslint --max-warnings 0 -c .eslintrc.js -f @microsoft/eslint-formatter-sarif -o eslint-result.sarif --ext .ts src test", + "prettier-fix": "yarn prettier --write .", + "build": "yarn clean && yarn lint && yarn compile && yarn build:libs", + "build:libs": "yarn compile:umd && yarn compile:esm", + "compile:umd": "tsc -p ./tsconfig.umd.json", + "compile:esm": "tsc -p ./tsconfig.esm.json", + "check-dependencies": "node ./scripts/check-dependencies.js", + "pull-remote": "git pull https://github.com/redhat-developer/yaml-language-server.git main" + }, + "nyc": { + "extension": [ + ".ts", + ".tsx" + ], + "exclude": [ + "**/*.d.ts", + "test/", + "out", + "lib", + "coverage/", + ".eslintrc.js", + "scripts" + ], + "all": true + } +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 984455682234..bc5ddfdb3081 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17615,7 +17615,7 @@ with pkgs; inherit (darwin) postLinkSignHook signingUtils; } // extraArgs; in self); - yaml-language-server = nodePackages.yaml-language-server; + yaml-language-server = callPackage ../development/tools/language-servers/yaml-language-server { }; # prolog yap = callPackage ../development/compilers/yap { };