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.exeI'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.