What is colon : in npm script names?

后端 未结 3 1567
滥情空心
滥情空心 2020-12-15 17:26

Trying to figure out what putting : in an npm script name does. For example:

package.json

\"test:ci\": \"rest of script\"
         


        
3条回答
  •  独厮守ぢ
    2020-12-15 17:58

    I believe it's just a naming convention to group a set of related tasks. For example you might have

    "test:ci": ...
    "test:units": ....
    "test:integration"...
    

    In this case it is grouping a related set of test tasks.

    It would be down to the package author to specify. You can split tasks out like described in the answer above and then have a 'global' test command which combines each of them e.g. test:ci && test:unit && test:integration enabling you to run them all at once or when individually when needed.

    You can use npm-run-all (link) and use the command npm-run-all test:*, which would then find all scripts starting with the test: group.

提交回复
热议问题