-
-
Notifications
You must be signed in to change notification settings - Fork 14k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
angular-language-server-bin: init at 18.2.0 #350257
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
{ | ||
lib, | ||
stdenvNoCC, | ||
fetchurl, | ||
nodejs, | ||
makeBinaryWrapper, | ||
runCommand, | ||
angular-language-server-bin, | ||
writeShellApplication, | ||
curl, | ||
common-updater-scripts, | ||
jq, | ||
unzip, | ||
}: | ||
|
||
let | ||
owner = "angular"; | ||
repo = "vscode-ng-language-service"; | ||
in | ||
stdenvNoCC.mkDerivation (finalAttrs: { | ||
pname = "angular-language-server-bin"; | ||
version = "18.2.0"; | ||
src = fetchurl { | ||
name = "${finalAttrs.pname}-${finalAttrs.version}.zip"; | ||
url = "https://github.com/${owner}/${repo}/releases/download/v${finalAttrs.version}/ng-template.vsix"; | ||
hash = "sha256-rl04nqSSBMjZfPW8Y+UtFLFLDFd5FSxJs3S937mhDWE="; | ||
}; | ||
|
||
nativeBuildInputs = [ | ||
unzip | ||
makeBinaryWrapper | ||
]; | ||
|
||
buildInputs = [ nodejs ]; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
install -Dm755 server/bin/ngserver $out/bin/ngserver | ||
install -Dm755 server/index.js $out/index.js | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we place those not at /? |
||
cp -r node_modules $out/node_modules | ||
runHook postInstall | ||
''; | ||
|
||
postFixup = '' | ||
patchShebangs $out/bin/ngserver $out/index.js $out/node_modules | ||
wrapProgram $out/bin/ngserver \ | ||
--prefix PATH : ${lib.makeBinPath [ nodejs ]} \ | ||
--add-flags "--tsProbeLocations $out/node_modules --ngProbeLocations $out/node_modules" | ||
''; | ||
|
||
passthru = { | ||
tests = { | ||
start-ok = runCommand "${finalAttrs.pname}-test" { } '' | ||
${angular-language-server-bin}/bin/ngserver --stdio --help &> $out | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can use lib.getExe here and grep in one go |
||
cat $out | grep "Angular Language Service that implements the Language Server Protocol (LSP)" | ||
''; | ||
}; | ||
|
||
updateScript = lib.getExe (writeShellApplication { | ||
name = "update-${finalAttrs.pname}"; | ||
runtimeInputs = [ | ||
curl | ||
common-updater-scripts | ||
jq | ||
]; | ||
text = '' | ||
LATEST_VERSION=$(curl -H "Accept: application/vnd.github+json" \ | ||
-Ls https://api.github.com/repos/${owner}/${repo}/releases/latest | \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should optionally take a GITHUB_TOKEN |
||
jq -r .tag_name | cut -c 2-) | ||
update-source-version ${finalAttrs.pname} "$LATEST_VERSION" | ||
''; | ||
}); | ||
}; | ||
|
||
meta = { | ||
description = "LSP for angular completions, AOT diagnostic, quick info and go to definitions"; | ||
homepage = "https://github.com/angular/vscode-ng-language-service"; | ||
changelog = "https://github.com/angular/vscode-ng-language-service/blob/${finalAttrs.version}/CHANGELOG.md"; | ||
license = lib.licenses.mit; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if we have an appropriate sourceProvenance for prebuild js things. |
||
mainProgram = "ngserver"; | ||
maintainers = with lib.maintainers; [ tricktron ]; | ||
}; | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just hardcore those. They will likely never ever change.