How to use npm scripts within javascript
<p>I need a complete guide or a good reference material to solve the running module commands within javascript file problem.</p>

<p>Say that I often run:</p>

<pre><code>$ npm run webpack-dev-server --progress --colors -- files
</code></pre>

<p>How can I run this within a javascript file and execute with </p>

<pre><code>$ node ./script.js
</code></pre>

<p><strong>script.js</strong></p>

<pre><code>var webpackDevServer = require('webpack-dev-server');

// need help here
var result = webpackDevServer.execute({
  progress: true,
  colors: true,
}, files);
</code></pre>