title: Nodejs app with npm start script
body: <p>I'm very new to nodejs.</p>
  
  <p>In my dockerized environment, I want to provide appdynamics support to nodejs apps. This mandates every app to require the following as the first line in their app.</p>
  
  <pre><code>require("appdynamics").profile({
      controllerHostName: '&lt;controller host name&gt;',
        controllerPort: &lt;controller port number&gt;, 
        controllerSslEnabled: false,  // Set to true if controllerPort is SSL
        accountName: '&lt;AppDynamics_account_name&gt;',
        accountAccessKey: '&lt;AppDynamics_account_key&gt;', //required
        applicationName: 'your_app_name',
        tierName: 'choose_a_tier_name', 
        nodeName: 'choose_a_node_name', 
   });
  </code></pre>
  
  <p>I plan to do that by providing a wrapper called <strong>appdynamics.js</strong> around the app's entry file. Details:</p>
  
  <ol>
  <li><p>I run a script in my nodejs docker image to replace the entry file name in the app's package.json with "appdynamics.js", where appdynamics.js has the above appdynamics related require statement.
  Ex : <code>{scripts { "start" : "node server.js" }}</code> will be replaced with 
   <code>{scripts { "start" : "node appdynamics.js"}}</code></p></li>
  <li><p>Then, i "require" the "server.js" inside appdynamics.js.</p></li>
  <li><p>Invoke npm start.</p></li>
  </ol>
  
  <p>My only concern is this:</p>
  
  <p>If the <strong>package.json</strong> had something like scripts <code>{ "start" : "coffee server.coffee" }</code>, my script will replace it to <code>{ "start" : "coffee appdynamics.js" }</code>. and then my script will invoke <code>npm start</code>, which will error out.</p>
  
  <p>What is the best way to solve this?</p>
  
  <p>This is a follow up question to <a href="https://stackoverflow.com/questions/7596230/use-coffee-instead-of-node-command-in-production">Use &quot;coffee&quot; instead of &quot;node&quot; command in production</a></p>