News for hackers. Stuff that matters.
Re:How to write a command line application in Node.js by jasondenizac on Friday August 09, 2013 @07:22PM (#6189239)
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.

Re:How to write a command line application in Node.js by barrkel on Saturday August 10, 2013 @02:39AM (#6190268)
Need 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.
Re:How to write a command line application in Node.js by FooBarWidget on Friday August 09, 2013 @08:02PM (#6189381)
I 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?
Re:How to write a command line application in Node.js by CamperBob2 on Friday August 09, 2013 @08:17PM (#6189455)
One 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.
Re:How to write a command line application in Node.js by octo_t on Friday August 09, 2013 @09:04PM (#6189611)
alternatively: maven managed to get dependency management right about 5 years ago.
Re:How to write a command line application in Node.js by dk8996 on Friday August 09, 2013 @10:14PM (#6189813)
Hahaha really? Have you seen a pom file on a real project its about 10 pages with plugins galore.
Re:How to write a command line application in Node.js by sehrope on Friday August 09, 2013 @10:28PM (#6189849)
The 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).
Re:How to write a command line application in Node.js by cgag on Saturday August 10, 2013 @01:01AM (#6190117)
Yeah, 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>
Re:How to write a command line application in Node.js by rnovak on Friday August 09, 2013 @10:46PM (#6189891)
really. 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.
Re:How to write a command line application in Node.js by dk8996 on Saturday August 10, 2013 @11:55AM (#6191490)
I didn't know that the bar is makefiles... welcome to 1977.