简体   繁体   English

NPM脚本命名约定

[英]NPM script naming convention

I have a script in my package.json that looks something like this: 我的package.json中有一个脚本,看起来像这样:

{
    ...
    scripts: {
        ...
        "testdb:e2e": "TESTDB_ENV='...' gulp mocha:e2e:backend && gulp mocha:e2e:frontend"
   }
    ...
}

And I want to add a script to specifically call backend or frontend with my test environment. 我想添加一个脚本来专门用我的测试环境调用后端或前端。 But I wanted to know what the NPM script namespacing convention is, but I can't find documentation on it. 但我想知道NPM脚本命名空间约定是什么,但我找不到它的文档。 I'm thinking of namespacing with a colon like gulp does, something like this: 我正在考虑使用像gulp这样的冒号命名空间,如下所示:

"testdb:e2e": "TESTDB_ENV='...' gulp mocha:e2e:backend && gulp mocha:e2e:frontend",
"testdb:e2e:backend": "TESTDB_ENV='...' gulp mocha:e2e:backend",
"testdb:e2e:frontend": "TESTDB_ENV='...' gulp mocha:e2e:frontend"

Is there a specific naming convention for namespacing npm scripts? 命名空间npm脚本是否有特定的命名约定?

There isn't. 没有。

Internally, however, npm uses things like pretest and posttest . 然而,在内部,npm使用像pretestposttest类的东西。

It's not the best thing so you might prefer to use your own. 这不是最好的事情,所以你可能更愿意使用自己的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM