【发布时间】:2019-07-05 22:48:28
【问题描述】:
我刚刚看了 Kent C. Dodds 的 video,他解释了他的 .bash_profile.
他对yarn 和npm 使用以下别名:
## npm aliases
alias ni="npm install";
alias nrs="npm run start -s --";
alias nrb="npm run build -s --";
alias nrd="npm run dev -s --";
alias nrt="npm run test -s --";
alias nrtw="npm run test:watch -s --";
alias nrv="npm run validate -s --";
alias rmn="rm -rf node_modules";
alias flush-npm="rm -rf node_modules && npm i && say NPM is done";
alias nicache="npm install --prefer-offline";
alias nioff="npm install --offline";
## yarn aliases
alias yar="yarn run";
alias yas="yarn run start -s --";
alias yab="yarn run build -s --";
alias yat="yarn run test -s --";
alias yav="yarn run validate -s --";
alias yoff="yarn add --offline";
alias ypm="echo \"Installing deps without lockfile and ignoring engines\" && yarn install --no-lockfile --ignore-engines"
我想知道,-s -- 标志有什么作用?肯特没有在视频中解释它,我在旗帜上找不到任何info。
【问题讨论】:
-
这是两个标志。按照惯例,
-s是--silent的简写。--只是run的 args 的结尾和你正在运行的任何 args 的开始。请参阅docs.npmjs.com/cli/run-script.html(不是安装文档,未使用)。
标签: bash npm yarnpkg flags npm-scripts