node.js - Best practice for distributing a nodejs command line application -


how people expect nodejs commandline application organised when distributed via npm?

would expect have build it? install locally or globally? should output bin.js? need kind of alias / script run (via bin.js?).

  • use bin field in package.json specify entrypoint javascript file cli.
  • add #!/usr/bin/env node top of entrypoint js file.
  • specify files need packaged app, using files field of package.json
  • in readme, provide npm install command line consumer can use install app, example point @ github repository, or package uploaded npm registry, can create npm pack.

upon installing app locally or globally, script created in path (or locally in node_modules/.bin), let command line app run conveniently.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -