4 ms·
About time, js cli apps were never a good idea.
by shzhdbi09gv8ioi 3y ago
About time, js cli apps were never a good idea.
- maccard 3y agoThey exist because it's significantly easier to distribute js apps than it is to distribute a compiled app. npm install works on Linux, Mac and windows, regardless of what libc, Msys, crt, you have installed. It could be python, but pip is a usability nightmare
- boredumb 3y agoNot particularly true especially in this case. You can get a rust binary and run it anywhere regardless of libc or having cargo installed on the users machine. A Javascript CLI requires nodejs and npm to be installed before running it.
- rob74 3y agoSame goes for Go BTW. I even find it easier to install Go (haven't done it for Rust that often yet) and compile a binary (of a "pure" project that doesn't involve C libraries or other complications) than installing node/npm/nvm/whatever to get something up and running...
- maccard 3y agoIn this particular case, you wouldn't be installing oxlint unless you had npm installed already?
- boredumb 3y agoFor their main use case they do package it up for npm, but the crates folder have each portion available to build/distribute as a stand alone binary you can run against javascript without node or npm installed.
- lixy 3y agoI wish the nix programming language wasn't so rough because it can be pretty great at this problem. Being able to compile from source while just listing out package dependencies is powerful.
- bluejekyll 3y agoCargo and crates.io is easily as simple as npm for installation and distribution. I find it to be more reliable than npm in general. Generally it’s very easy to write system agnostic software in Rust, as most of the foundational libraries abstract that away. So when you say “compiled app” you might be referring instead to C or C++ apps, which don’t generally have as simple and common a distribution model. Rust is entirely different, and incorporated a lot of design decisions about how to package software from npm and other languages.
- andygeorge 3y agoCargo is still a dev tool and isn't a great distribution solution.
- bluejekyll 3y agoI disagree. Cargo is a great distribution tool, for Rust projects. I just tell people, first install rust, then just `cargo install` Second, this was in response to an npm is simpler comment; npm and cargo are absolutely the same category of tool.
- satvikpendem 3y agoI actually recommend cargo install cargo-binstall first, then cargo install <crate>. This is because it is quite annoying to compile packages every time you want to install something new whereas binstall distributes binaries instead, much faster.
- bluejekyll 3y agoFeels like we need a single command for that, I have two goals for my workflow (like maybe bininstall should be included in Cargo): 1) what’s the easiest way to give people access to a tool I just wrote, `cargo publish` 2) what’s the easiest way for someone to use it, as few steps as possible, right now it’s `install rust` && `cargo install`. Once I get to three or more steps on 2 I tend to turn to just or make depending on the context.
- kbknapp 3y agoI've had significantly fewer issues with `cargo [b]install`ed compiled Rust programs than `npm install`ed ones. Getting nodejs/npm installed (and at an appropriate version) is not always trivial, especially when programs require different versions. OOTH, Precompiled Rust binaries have the libc version issue only if you're distributing binaries to unknown/all distribtuions, but that's pretty trivially solved by just compiling using an old glibc (or MUSL). Whereas `cargo install' (and targetting specific distributions) does the actual compiling and uses the current glibc so it's not an issue.
- nsonha 3y agoI think more like tools for a language tend to be written in that language. Obviously the author needs to care enough about the target language and if they support plugins then it’s also desirable for the plugins to be written in the target lang.