What is colon : in npm script names?

后端 未结 3 1572
滥情空心
滥情空心 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 18:02

    If using Yarn package manager, you can use a colon in the name to call the script from any workspace.

    According to the yarn docs on How to share scripts between workspaces?:

    Little-known Yarn feature: any script with a colon in its name (build:foo) can be called from any workspace.

    Also, according to yarn docs on CLI > run:

    Otherwise, if the specified name contains a colon character and if one of the workspaces in the project contains exactly one script with a matching name, then this script will get executed.

提交回复
热议问题