[NPM] Use custom config settings in your npm scripts

In addition to package.json level variables (such as name and version), you can have custom conf settings that can be used in your npm scripts. These config values can be overridden outside of the package.json by using the npm config set command if necessary.

 

{
  "name": "react-file-size",
  ...
  "config": {
    "port": "1337"
  },
  ....
}
    "server": "npm-run-all --parallel server:*",
    "server:create": "http-server public/$npm_package_version -p $npm_package_config_port",
    "server:launch": "open http://localhost:$npm_package_config_port"

 

posted @ 2017-02-07 21:13  Zhentiw  阅读(164)  评论(0编辑  收藏  举报