News for hackers. Stuff that matters.
Re:Show HN: Coinmon – Check Bitcoin Prices in Terminal by 52-6F-62 on Monday November 20, 2017 @11:18AM (#15740991)
I personally usually use Python, Bash, or C, but there is a utility for packaging NodeJS tools into executables. I think it does some tree-shaking as well. Disclaimer: I haven't used it, so I'm not sure of the results. But it is possible.

https://www.npmjs.com/package/pkg

edit: For the curious -- Just tried on a really simple script that just takes one argument and writes it with some text to STDOUT and it still came to 35MB. So it must package a bunch of Node with it. I won't be leaving my go-to's for it anytime soon unless usability and development speed necessitate it. Going to have to go with the, best to not use NodeJS for general cmd-line utils outside of the NodeJS environment. The one perk is that it will, by default, output executables for Linux, macOS, and Windows.

Source:

    (function() {
    'use strict';

      function main(_string) {
        console.log(`${_string} was read from STDIN.`);
      }

      main(process.argv[2]);

    }());
Output file:

    35088858 Nov 20 11:36 index-linux
    35717043 Nov 20 11:36 index-macos
    23137020 Nov 20 11:36 index-win.exe
Re:Show HN: Coinmon – Check Bitcoin Prices in Terminal by WildGreenLeave on Monday November 20, 2017 @12:05PM (#15741363)
Thats because PKG is including the Node runtime in the binaries, this way users don't have to install Node itself to run them.

I'm using it myself and besides the fat binaries and the fact that you have to write Javascript, it is really good. (Working on replacing this daemon with Go ASAP)

Edit: just read your last line, I'm kinda stating the obvious here.