Pure-D / serve-d

D LSP server (dlang language server protocol server)
MIT License
208 stars 49 forks source link

Create npm package #113

Open aminya opened 3 years ago

aminya commented 3 years ago

As discussed, given the complexity of downloading, checking for the versions, building from source, etc., we should look into making an npm package for serve-d

WebFreak001 commented 3 years ago

npm package for serve-d? I was thinking of moving the download & update code from code-d into an npm package, which downloads releases from GitHub releases like currently done. Otherwise it would be duplicate maintenance effort to publish releases to GitHub and to NPM.

The code for code-d exists and I think abstracting it to be usable in any JS-based editor would be useful and allow updates at runtime.

Do you think it would be worth the effort to publish binaries to NPM when there are already existing GitHub releases?

aminya commented 3 years ago

Most of the language servers are available from npm: https://www.npmjs.com/search?q=language%20server

The issue with GitHub releases is that the installation, updating, etc needs to be done manually instead of relying on npm.

I am fine with any approach as long as this management becomes abstracted.

aminya commented 3 years ago

I made a very compact code to manage the binaries. I think we can integrate it into serve-d and publish it as a npm package.

Package time script: https://github.com/Pure-D/atom-ide-d/blob/main/scripts/get-servers.ts

Runtime installer: https://github.com/Pure-D/atom-ide-d/blob/main/src/installation.ts

WebFreak001 commented 3 years ago

https://github.com/Pure-D/atom-ide-d/blob/84c69caad34be2d441674498e8b83818547487e8/src/installation.ts#L53

does this code work? it's cast to a boolean below which would return true here.

aminya commented 3 years ago

Oh, yeah that should be false instead of -1. Fixed now.

Another thing to improve is to build from source automatically for other operating systems or architectures. https://github.com/Pure-D/atom-ide-d/blob/999dd68672318c6b0584bf095431df5bfd95cbb3/src/installation.ts#L83