什么是冒号:在npm脚本名称中? [英] What is colon : in npm script names?

查看:421
本文介绍了什么是冒号:在npm脚本名称中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图弄清楚在npm脚本名称中放置:是什么.例如:

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

package.json

"test:ci": "rest of script"

:ci会做什么? npm run test:ci运行失败

what would :ci do? running npm run test:ci fails

我真的找不到任何bash语法.

I can't find anything bash syntax really.

推荐答案

我认为,将一组相关任务组合在一起只是一种命名约定.例如,您可能有

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.

由包作者指定.您可以像上面的答案中所述将任务拆分出来,然后使用全局" test命令将每个任务组合在一起,例如test:ci && test:unit && test:integration使您可以一次运行所有这些,也可以在需要时单独运行它们.

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.

您可以使用npm-run-all(链接)并使用命令npm-run-all test:*,它将查找以test:组开头的所有脚本.

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.

这篇关于什么是冒号:在npm脚本名称中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆