3 ms·
The number one reason to write CLI apps in node is npm. npm gets package management right, preferring local dependencies to global ones - this means no worrying
by jasondenizac 13y ago
The number one reason to write CLI apps in node is npm. npm gets package management right, preferring local dependencies to global ones - this means no worrying about what version of a library a user has in their global environment.
You also get to bring node's parallel io-centric patterns to your scripting. Need to download a bunch of files from a remote host, process them, and write them to disk? Go for it.
But take it with a grain of salt: it's very much a use-what-you-know kind of thing.
- FooBarWidget 13y agoI thought a lot of people discourage the use of static linking or any form of local dependency bundling, because when there's a security update every app needs to be updated individually. But it seems that with the emergence of Bundler and NPM, people are trending more and more towards local bundling. What happened?
- CamperBob2 13y agoOne possible contrarian view: global dependencies actually cause a lot of those security updates to be necessary. Exploits that target a given version of a given library may be easier to propagate if you know that almost every application run by every user depends on that library version.
- octo_t 13y agoalternatively: maven managed to get dependency management right about 5 years ago.
- dk8996 13y agoHahaha really? Have you seen a pom file on a real project its about 10 pages with plugins galore.
- sehrope 13y agoThe verbosity of the XML pom is the problem. Alternative syntax using the same coordinate system are great and much easier on the eyes. The real value in maven (I think) is having that clean dependency chain and it works great. XML is what sucks (especially doing it by hand).
- cgag 13y agoYeah, pom files are disgusting, but leiningen (the clojure build tool) is built on top of maven and it's wonderful. [enlive "1.1.1"] instead of <dependency> <groupId>enlive</groupId> <artifactId>enlive</artifactId> <version>1.1.1</version> </dependency>
- rnovak 13y agoreally. if a page is about 60-80 lines, that's what, 1000 lines? and most IDE's help manage them. The makefile's to some open source projects get longer than that, and they only get worse when they're proprietary.
- dk8996 13y agoI didn't know that the bar is makefiles... welcome to 1977.
- barrkel 13y agoNeed to download a bunch of files from a remote host, process them, and write them to disk? cat urls.txt | while read -r url; do base="$(basename "$url")" wget "$url" -O - -o "$base.log" | process > "$base" & done wait For ad-hoc scripting, I tend to prefer bash, with anything remotely corresponding to heavy lifting assigned to the language with the best library / performance / whatever critical factor for it. Fork-join parallelism in bash is very easy.