简体   繁体   English

npm 运行脚本删除标志

[英]npm run script deletes flags

In my package.json in scripts i have this在我的脚本中的 package.json 我有这个

"typeorm": "ts-node ./node_modules/typeorm/cli.js"

i want to be able to extend this script from cli usage eg.我希望能够从 cli 使用扩展这个脚本,例如。

npm run typeorm migration:create -n Example 

but when i do run it like that in terminal this gets executed:但是当我在终端中像这样运行它时,它会被执行:

ts-node ./node_modules/typeorm/cli.js "migrations:create" "Example"

note that the flag -n is being deleted by npm Do you know how would i run scripts like this and keep flags and everything thank you.请注意,npm 正在删除标志 -n 你知道我将如何运行这样的脚本并保留标志和一切谢谢。

Okay i have found an answer... just add -- after npm run typeorm好的,我找到了答案...只需添加 -- 在 npm 运行 typeorm 之后

example:例子:

npm run typeorm -- migration:create -n Example

everyting after -- will be added directly to script according to docs everyting after -- 将根据文档直接添加到脚本中

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

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