zoukankan      html  css  js  c++  java
  • [NPM] Avoid Duplicate Commands by Calling one NPM Script from Another

    We can get a lot of utility through CLI tools invoked via npm scripts. Many of these tools have APIs with many flags and options, meaning we will frequently find ourselves using the same CLI tool in multiple npm scripts, often with only minor differences. In this lesson, we'll take two very similar npm scripts and see how to remove the duplication by calling one script from another and passing in additional flags.

    From:

    "scripts": {
      ...
      "dev": "webpack-dev-server --open --config webpack.config.dev.js",
      "dev:hot": "webpack-dev-server --open --hot --config webpack.config.dev.js"
    }

    To:

    "dev": "webpack-dev-server --open --config webpack.config.dev.js",
    "dev:hot": "npm run dev -- --hot",

    RUN:

    $ npm run dev --hot
  • 相关阅读:
    Android兼容性测试CTS
    Tkinter
    初探socket
    性能监控2
    HTTP
    python实现接口自动化1
    pip安装超时问题
    一行 Python
    Python 面向对象进阶
    Python 面向对象编程基础
  • 原文地址:https://www.cnblogs.com/Answer1215/p/10397478.html
Copyright © 2011-2022 走看看