Merge pull request #238814 from malob/fix-vscode-langservers-extracted-darwin

vscode-langservers-extracted: fix Darwin build
This commit is contained in:
Weijia Wang 2023-06-21 07:10:13 +03:00 committed by GitHub
commit b4d3a0e940
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
{ lib, buildNpmPackage, fetchFromGitHub, vscode }:
{ lib, stdenv, buildNpmPackage, fetchFromGitHub, vscode }:
buildNpmPackage rec {
pname = "vscode-langservers-extracted";
@ -19,15 +19,24 @@ buildNpmPackage rec {
sed -i '/^\s*"vscode-eslint-language-server":.*bin\//d' package.json package-lock.json
'';
buildPhase = let
extensions = "${vscode}/lib/vscode/resources/app/extensions";
in ''
npx babel ${extensions}/css-language-features/server/dist/* --out-dir lib/css-language-server/node/
npx babel ${extensions}/html-language-features/server/dist/* --out-dir lib/html-language-server/node/
npx babel ${extensions}/json-language-features/server/dist/* --out-dir lib/json-language-server/node/
npx babel ${extensions}/markdown-language-features/server/dist/* --out-dir lib/markdown-language-server/node/
mv lib/markdown-language-server/node/workerMain.js lib/markdown-language-server/node/main.js
'';
buildPhase =
let
extensions =
if stdenv.isDarwin
then "${vscode}/Applications/Visual\\ Studio\\ Code.app/Contents/Resources/app/extensions"
else "${vscode}/lib/vscode/resources/app/extensions";
in
''
npx babel ${extensions}/css-language-features/server/dist/node \
--out-dir lib/css-language-server/node/
npx babel ${extensions}/html-language-features/server/dist/node \
--out-dir lib/html-language-server/node/
npx babel ${extensions}/json-language-features/server/dist/node \
--out-dir lib/json-language-server/node/
npx babel ${extensions}/markdown-language-features/server/dist/node \
--out-dir lib/markdown-language-server/node/
mv lib/markdown-language-server/node/workerMain.js lib/markdown-language-server/node/main.js
'';
meta = with lib; {
description = "HTML/CSS/JSON/ESLint language servers extracted from vscode.";