[NPM] Execute npx commands with $npm_ Environment Variables

We will incorporate npm specific environment variables when executing various npx commands. In our example, we will transpile code to a folder name that matches the version of the current package.

"scripts": {
      "build": "babel index.js -d lib/$npm_package_version"
  },

output file will be stored in lib/1.0.0/index.js

原文地址:https://www.cnblogs.com/Answer1215/p/10518842.html