title: Clean package.json before packing
body: <p>Let's say you have a npm project with the following <code>package.json</code>:</p>
  
  <pre><code>{
    "name": "XXX",
    "version": "YYY",
    "license": "ZZZ",
    "scripts": {
      "scriptA": "...",
      "scriptB": "...",
      "preinstall": "...",
      "postinstall": "..."
    },
    "devDependencies": {
      "depA": "vA",
      "depB": "vB"
    },
    "dependencies": {
      "depC": "vC",
      "depD": "vD"
    }
  }
  </code></pre>
  
  <p>When packing/publishing your package, you don't need the <code>scripts</code> or <code>devDependencies</code> keys. But more dangerously, the <code>preinstall</code> and <code>postinstall</code> scripts could trigger weird/unwanted actions when people install your package as a dependency.</p>
  
  <p><strong>So how do you clean your <code>package.json</code>, ie remove the keys that you don't need?</strong></p>
  
  <p>I'm currently using npm 3.10. If I use the <code>npm pack</code> command, according to the <a href="https://docs.npmjs.com/cli/pack" rel="nofollow noreferrer">npm documentation</a> it will simply pack the current package if no arguments are provided (therefore taking the raw <code>package.json</code> from disk) and there is no options I can provide to clean it up.</p>
  
  <p>I can of course write my own scripts that would zip the package and generate my own <code>package.json</code>. Is it the way to go?</p>