zoukankan      html  css  js  c++  java
  • [NPM] Pass arguments to npm scripts

    Often times you’ll have variations that you’ll want to make to your npm scripts and repeating yourself is inefficient and verbose. Instead you can create a base script and pass arguments into it from another script.

    For example, you have a script:

    "test": "mocha spec/ --require babel-register",

    And you want to add a watcher to the test script:

    "test:watch": "mocha spec/ --require babel-register --watch",

    Here what we do is copy the script and add a '--watch' behind. This is not good enough, because if you want to change the 'test' script, you also need to modify the 'test:watch' script.

    So what you can do:

    "test:watch": "npm t -- --watch"

    First '--' tell the compiler that we still need to pass in some arguments; And '--watch' is what we want to pass in.

  • 相关阅读:
    lc377完全背包问题
    lc650
    lc583
    java static序列化
    lc90回溯
    lc78回溯
    Java基础之常量池
    语法与语义
    数据结构之复杂度分析
    数据结构与算法前言
  • 原文地址:https://www.cnblogs.com/Answer1215/p/6371579.html
Copyright © 2011-2022 走看看