From 5d18e249abf573e3f88eab63be35b870f287e25f Mon Sep 17 00:00:00 2001 From: Mutsuha Asada Date: Sun, 3 Mar 2024 09:40:15 +0900 Subject: [PATCH 1/2] maintainers: Add momeemt --- maintainers/maintainer-list.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 852735ac9696..f5304bbf92aa 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -12980,6 +12980,15 @@ fingerprint = "1248 D3E1 1D11 4A85 75C9 8934 6794 D45A 488C 2EDE"; }]; }; + momeemt = { + name = "Mutsuha Asada"; + email = "me@momee.mt"; + github = "momeemt"; + githubId = 43488453; + keys = [{ + fingerprint = "D94F EA9F 5B08 F6A1 7B8F EB8B ACB5 4F0C BC6A A7C6"; + }]; + }; monaaraj = { name = "Mon Aaraj"; email = "owo69uwu69@gmail.com"; From ef0d7b755bbf86e78dfaecaf2784c01d897213fd Mon Sep 17 00:00:00 2001 From: Mutsuha Asada Date: Fri, 5 Apr 2024 14:10:52 +0900 Subject: [PATCH 2/2] spectral-language-server: init at 1.0.8-unstable-2023-06-06 Co-authored-by: OTABI Tomoya --- .../sp/spectral-language-server/package.json | 159 ++++++++++++++++++ .../sp/spectral-language-server/package.nix | 109 ++++++++++++ 2 files changed, 268 insertions(+) create mode 100644 pkgs/by-name/sp/spectral-language-server/package.json create mode 100644 pkgs/by-name/sp/spectral-language-server/package.nix diff --git a/pkgs/by-name/sp/spectral-language-server/package.json b/pkgs/by-name/sp/spectral-language-server/package.json new file mode 100644 index 000000000000..1f3651349c62 --- /dev/null +++ b/pkgs/by-name/sp/spectral-language-server/package.json @@ -0,0 +1,159 @@ +{ + "activationEvents": [ + "onStartupFinished" + ], + "author": "Stoplight ", + "bugs": { + "url": "https://github.com/stoplightio/vscode-spectral/issues" + }, + "categories": [ + "Linters" + ], + "contributes": { + "configuration": { + "properties": { + "spectral.enable": { + "default": true, + "description": "Controls whether or not Spectral is enabled.", + "scope": "resource", + "type": "boolean" + }, + "spectral.rulesetFile": { + "description": "Location of the ruleset file to use when validating. If omitted, the default is a .spectral.yml/.spectral.json in the same folder as the document being validated. Paths are relative to the workspace. This can also be a remote HTTP url.", + "scope": "resource", + "type": "string" + }, + "spectral.run": { + "default": "onType", + "description": "Run the linter on save (onSave) or as you type (onType).", + "enum": [ + "onSave", + "onType" + ], + "scope": "resource", + "type": "string" + }, + "spectral.trace.server": { + "default": "off", + "description": "Traces the communication between VS Code and the language server.", + "enum": [ + "off", + "messages", + "verbose" + ], + "scope": "window", + "type": "string" + }, + "spectral.validateFiles": { + "description": "An array of file globs (e.g., `**/*.yaml`) in minimatch glob format which should be validated by Spectral. If language identifiers are also specified, the file must match both in order to be validated. You can also use negative file globs (e.g., `!**/package.json`) here to exclude files.", + "items": { + "type": "string" + }, + "scope": "resource", + "type": "array" + }, + "spectral.validateLanguages": { + "default": [ + "json", + "yaml" + ], + "description": "An array of language IDs which should be validated by Spectral. If file globs are also specified, the file must match both in order to be validated.", + "items": { + "type": "string" + }, + "scope": "resource", + "type": "array" + } + }, + "title": "Spectral", + "type": "object" + }, + "commands": [ + { + "title": "Show Output Channel", + "category": "Spectral", + "command": "spectral.showOutputChannel" + } + ] + }, + "description": "JSON/YAML linter with OpenAPI and custom ruleset support.", + "devDependencies": { + "@types/chai": "^4.3.1", + "@types/chai-jest-snapshot": "^1.3.6", + "@types/glob": "^7.2.0", + "@types/mocha": "^9.1.0", + "@types/node": "^18.11.18", + "@types/vscode": "^1.48.0", + "@typescript-eslint/eslint-plugin": "^4.33.0", + "@typescript-eslint/parser": "^4.1.0", + "chai": "^4.2.0", + "chai-jest-snapshot": "^2.0.0", + "copyfiles": "^2.4.1", + "cross-env": "^7.0.3", + "eslint": "^7.8.1", + "eslint-config-google": "^0.14.0", + "glob": "^8.0.3", + "http-test-servers": "^2.0.0", + "merge-options": "^3.0.0", + "mocha": "^8.1.3", + "rimraf": "^3.0.2", + "semver": "^7.3.2", + "shelljs": "^0.8.5", + "ts-loader": "^9.2.8", + "ts-node": "^8.10.2", + "typescript": "beta", + "vsce": "^1.103.1", + "vscode-test": "^1.5.0", + "webpack": "^5.72.0", + "webpack-cli": "^4.9.2" + }, + "displayName": "Spectral", + "engines": { + "vscode": "^1.48.0", + "node": "^12.20 || >= 14.13" + }, + "homepage": "https://github.com/stoplightio/vscode-spectral", + "icon": "icon.png", + "keywords": [ + "linter", + "validator", + "OpenAPI", + "Swagger", + "API", + "style guide", + "API description", + "API specification", + "OAS", + "OAS2", + "OAS3", + "AsyncAPI", + "json", + "yaml" + ], + "license": "Apache-2.0", + "main": "./client/index.js", + "name": "spectral", + "private": true, + "publisher": "stoplight", + "repository": { + "type": "git", + "url": "https://github.com/stoplightio/vscode-spectral" + }, + "scripts": { + "clean": "rimraf dist && rimraf \"{server,client}/dist\"", + "lint": "eslint --ext .ts,.js .", + "test": "mocha -r ts-node/register \"./+(client|server)/__tests__/unit/**/*.test.ts\"", + "test:e2e": "cross-env CI=true CHAI_JEST_SNAPSHOT_UPDATE_ALL=false ts-node ./client/src/__tests__/e2e/index.ts" + }, + "version": "1.1.2", + "workspaces": { + "packages": [ + "client", + "server" + ], + "nohoist": [ + "client/**", + "server/**" + ] + } +} diff --git a/pkgs/by-name/sp/spectral-language-server/package.nix b/pkgs/by-name/sp/spectral-language-server/package.nix new file mode 100644 index 000000000000..8193ff3acebd --- /dev/null +++ b/pkgs/by-name/sp/spectral-language-server/package.nix @@ -0,0 +1,109 @@ +{ lib +, buildNpmPackage +, mkYarnPackage +, fetchYarnDeps +, fetchFromGitHub +, typescript +, jq +, fetchpatch +}: +let + # Instead of the build script that spectral-language-server provides (ref: https://github.com/luizcorreia/spectral-language-server/blob/master/script/vscode-spectral-build.sh), we build vscode-spectral manually. + # This is because the script must go through the network and will not work under the Nix sandbox environment. + vscodeSpectral = mkYarnPackage rec { + pname = "vscode-spectral"; + version = "1.1.2"; + + src = fetchFromGitHub { + owner = "stoplightio"; + repo = "vscode-spectral"; + rev = "v${version}"; + hash = "sha256-TWy+bC6qhTKDY874ORTBbvCIH8ycpmBiU8GLYxBIiAs="; + }; + + packageJSON = ./package.json; + + offlineCache = fetchYarnDeps { + yarnLock = src + "/yarn.lock"; + hash = "sha256-am27A9VyFoXuOlgG9mnvNqV3Q7Bi7GJzDqqVFGDVWIA="; + }; + + nativeBuildInputs = [ typescript jq ]; + + postPatch = '' + cp server/tsconfig.json server/tsconfig.json.bak + jq '.compilerOptions += {"module": "NodeNext", "moduleResolution": "NodeNext"}' server/tsconfig.json.bak > server/tsconfig.json + ''; + + dontConfigure = true; + + buildPhase = '' + runHook preBuild + # FIXME: vscode-spactral depends on @rollup/pluginutils, but it may have a bug that doesn't provide the type definitions for NodeNext module resolution. (ref: https://github.com/rollup/plugins/issues/1192) + # tsc detects some type errors in the code. However we ignore this because it's not a problem for the final build if server/dist is generated. + tsc -p server || true + test -d server/dist + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + mkdir -p $out + cp -R server/dist $out + runHook postInstall + ''; + + doDist = false; + + meta = with lib; { + homepage = "https://github.com/stoplightio/vscode-spectral"; + description = "VS Code extension bringing the awesome Spectral JSON/YAML linter with OpenAPI/AsyncAPI support"; + license = licenses.asl20; + }; + }; +in +buildNpmPackage rec { + pname = "spectral-language-server"; + version = "1.0.8-unstable-2023-06-06"; + + src = fetchFromGitHub { + owner = "luizcorreia"; + repo = "spectral-language-server"; + rev = "c9a7752b08e6bba937ef4f5435902afd41b6957f"; + hash = "sha256-VD2aAzlCnJ6mxPUSbNRfMOlslM8kLPqrAI2ah6sX9cU="; + }; + + npmDepsHash = "sha256-ixAXy/rRkyWL3jdAkrXJh1qhWcKIkr5nH/Bhu2JV6k8="; + + patches = [ + # https://github.com/luizcorreia/spectral-language-server/pull/15 + (fetchpatch { + name = "fix-package-lock.patch"; + url = "https://github.com/luizcorreia/spectral-language-server/commit/909704850dd10e7b328fc7d15f8b07cdef88899d.patch"; + hash = "sha256-+mN93xP4HCll4dTcnh2W/m9k3XovvgnB6AOmuJpZUZ0="; + }) + ]; + + dontNpmBuild = true; + + npmFlags = [ "--ignore-scripts" ]; + + installPhase = '' + runHook preInstall + mkdir -p $out/bin + mkdir -p $out/node_modules + mkdir -p $out/dist/spectral-language-server + cp -R ${vscodeSpectral}/dist/* $out/dist/spectral-language-server/ + cp ./bin/* $out/bin + cp -R ./node_modules/* $out/node_modules + runHook postInstall + ''; + + meta = with lib; { + homepage = "https://github.com/luizcorreia/spectral-language-server"; + description = "Awesome Spectral JSON/YAML linter with OpenAPI/AsyncAPI support"; + maintainers = with maintainers; [ momeemt ]; + license = licenses.mit; + mainProgram = "spectral-language-server"; + }; +}