Skip to content
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

publish bin so that it can be easily used by other editors #134

Closed
prabirshrestha opened this issue Aug 5, 2017 · 4 comments
Closed

publish bin so that it can be easily used by other editors #134

prabirshrestha opened this issue Aug 5, 2017 · 4 comments
Assignees

Comments

@prabirshrestha
Copy link

I'm working on the language server provider plugin for vim and would like to have a binary so that npm install would just work.

Would it be possible to publish a bin file so when I run npm install -g dockerfile-language-server-nodejs, I can run the server by running docker-langserver --stdio?

@rcjsuen
Copy link
Owner

rcjsuen commented Aug 6, 2017

This is certainly something that can be considered. I will have to do some research to see how difficult this would be.

Do you have a workaround that you can use for the time being, @prabirshrestha?

@prabirshrestha
Copy link
Author

It should be very simple to implement this. You would need is to expose the bin setting in package.json.

Add this to your package.json and after running npm install -g dockerfile-language-server-nodejs, we should then be able to use docker-langserver --stdio. docker-langserver will be the name of the executable.

    "bin": {
        "docker-langserver": "lib/server.js"
    }

You can read a tutorial about this at http://markmarkoh.com/nodejs-npm-and-executables/

rcjsuen added a commit that referenced this issue Aug 6, 2017
Using the "bin" field in package.json, it is possible to declare an
executable for a package. Declared the "bin" field to point at
./lib/server.js so that one just has to install the npm module
globally and then launch the executable.

Signed-off-by: Remy Suen <[email protected]>
rcjsuen added a commit that referenced this issue Aug 6, 2017
It seems that referencing the server.js directly in package.json does
not appear to pass on the arguments on the command line to the
script. As other Node.js projects that uses a binary seems to
explicitly create a separate script for the launching of an
executable, we have done the same and created a bin/docker-langserver
file to startup lib/server.js.

Signed-off-by: Remy Suen <[email protected]>
@rcjsuen
Copy link
Owner

rcjsuen commented Aug 6, 2017

The lib/server.js method did not work so I ended up creating a bin/docker-langserver file instead.

Please use version 0.0.4 of the npm module and not 0.0.3.

@rcjsuen rcjsuen closed this as completed Aug 6, 2017
@rcjsuen rcjsuen self-assigned this Aug 6, 2017
@prabirshrestha
Copy link
Author

Thanks. It works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants