-
Notifications
You must be signed in to change notification settings - Fork 76
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
Install + run binary using npm #499
Comments
The npm package is just a library which can be integrated into other projects - it does not run the executable itself. The CLI has a lot of logic in it, which is why I didn't initially intend to rewrite a binary for npm. Is being able to install and run stylua binary from npm something which is of interest to you? I could potentially look to make a thin wrapper for npm which downloads the binary from github actions |
Alternatively, you can follow one of the other installation steps yourself to install the binary. Not sure if npm exposes a nice way (or if there is a simple helper library) to download a binary from another source and just run that |
Thanks for the prompt response!
If this is something that would allow me to run the For context, I'm looking at implementing a simple pre-commit hook for my team that would process StyLua for all files (using husky). So far, having to have Python, pip, and cargo installed on all machines just to get this functionality feels too tedious for every machine. I think a simple npm script would be much easier to setup. |
Not sure how husky works, but for the time being if you're interested you could probably make a wrapper yourself which automatically installs a prebuilt binary from https://github.com/JohnnyMorganz/StyLua/releases/tag/v0.14.0 With this, you won't need python, pip or cargo. I'll take a look at creating some sort of tool installable and runnable using npm though |
I'd like to add the
format
script to mypackage.json
, so I can executenpm run format
in my project root. At the moment, I have this added to myscripts
:Running this command currently completes without errors, but also with no edited files. Running the Windows release
stylua.exe src/
formats all files insrc/
correctly. How can I get stylua working using mynpm run format
command?The text was updated successfully, but these errors were encountered: