title: npm scripts: read .env file
body: <p>I have a simple requirement: In my npm scripts package.json file I have the line:</p>
  
  <pre class="lang-json prettyprint-override"><code>{
      "scripts": {
          "example": "some-lib --argument --domain \"https://tld.com\""
      }
  }
  </code></pre>
  
  <p>Now I want the "domain" to be factored out.</p>
  
  <p>First try is to use <code>$npm_package_config</code>, which works:</p>
  
  <pre class="lang-json prettyprint-override"><code>{
      "config": {
          "domain": "https://tld.com"
      },
      "scripts": {
          "example": "some-lib --argument --domain \"$npm_package_config_domain\""
      }
  }
  </code></pre>
  
  <p>But I want the domain loaded from an local .env file.</p>
  
  <p>I did not find any solution out there to read the contents of an env file inside npm scripts on the command line.</p>
  
  <p>Can somebody give me a hint to a possible solution for this problem?</p>