title: Locally-installed cli NPM project that is easy to execute
body: <p>I'm building a cli node module. I would like people to be able to <code>npm install</code> it and use it right away with a command like <code>npm my-project --arg=foo</code>. It's meant for local project CLI use as a dev tool, not global installation.</p>
  
  <p>It seems like the standard is to use <a href="https://docs.npmjs.com/files/package.json#bin" rel="nofollow"><code>bin</code></a> in the <code>package.json</code>, but I don't understand some things about it:</p>
  
  <ol>
  <li>When should I use <code>bin</code> and when should I use <code>scripts</code>?</li>
  <li>How to I run the command in the including project? <code>npm my-project</code> doesn't do it.</li>
  </ol>
  
  <p>Here is what I am doing now in <code>package.json</code>:</p>
  
  <pre><code>{
    "name": "my-project",
    "bin": "./cli.js"
  }
  </code></pre>
  
  <p>And I can run it locally:</p>
  
  <pre><code>node cli.js --arg=foo
  </code></pre>
  
  <p>But when I <code>npm-install my-project</code> somewhere else, I don't know how to run the script it puts in bin (<code>npm run my-project</code> doesn't work), or if I'm using this correctly.</p>