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
binfield inpackage.jsonspecify entrypoint javascript file cli. - add
#!/usr/bin/env nodetop of entrypoint js file. - specify files need packaged app, using
filesfield of package.json - in readme, provide
npm installcommand line consumer can use install app, example point @ github repository, or package uploaded npm registry, can createnpm pack.
upon installing app locally or globally, script created in path (or locally in node_modules/.bin), let command line app run conveniently.
Comments
Post a Comment