title: Using npm to build my typescript/node project
body: <p>I have a project written in TypeScript and running on Node. I'm really struggling to write the script with npm to get it running for development. 
  What I trying to do is:</p>
  
  <ul>
  <li>clean the <code>/dist</code> folder</li>
  <li>if a <code>.ts</code> change, compile it into <code>/dist</code> and restart node</li>
  </ul>
  
  <p>Here is my 1st attempt, from the <code>scripts</code> section of my <code>package.json</code>:</p>
  
  <pre><code>"clean": "rimraf dist/**/*",
  "build": "tsc",
  "watch:start": "npm run clean &amp;&amp; nodemon -e ts --exec \"npm run start\"",
  "start": "npm run build &amp;&amp; node dist/index.js"
  </code></pre>
  
  <p>If I start my project with <code>npm run watch:start</code>, it got stuck in a loop:</p>
  
  <pre><code>npm run watch:start
  &gt; nodemon -e ts --exec "npm run start"
  
  [nodemon] 1.11.0
  [nodemon] to restart at any time, enter `rs`
  [nodemon] watching: *.*
  [nodemon] starting `npm run start`
  [nodemon] restarting due to changes...
  [nodemon] restarting due to changes...
  [nodemon] starting `npm run start`
  [nodemon] restarting due to changes...
  [nodemon] restarting due to changes...
  </code></pre>
  
  <p>Here is my 2nd attempt, using <code>npm-run-all</code> to run several task in parallel:</p>
  
  <pre><code>"clean": "rimraf dist/**/*",
  "build": "tsc",
  "watch:start": "npm-run-all clean build --parallel --race watch:build watch:serve --print-label",
  "watch:build": "tsc -w",
  "watch:serve": "nodemon dist/index.js"
  </code></pre>
  
  <p>This one works better but it still restart node several time at startup.</p>
  
  <p>Suggestions and improvements welcome ! </p>