.yarnrc

.yarnrc 文件允许你配置更多的 Yarn 功能。 也可以用 config 命令来配置这些选项。 Yarn 会把你的 .yarnrc merge 进文件树里。

yarn-offline-mirror

yarn-offline-mirror "./packages-cache"

离线维护你的包,这样可以让你的构建过程更加稳定。在这里看更多信息

必须是个相对路径,或者用 false 来禁用镜像(默认值)。

yarn-offline-mirror-pruning

yarn-offline-mirror-pruning true

Control automatic pruning of the offline mirror. Find more information here.

值必须是一个布尔值,默认值为 false

yarn-path

yarn-path "./bin/yarn"

Instructs yarn to defer to another Yarn binary for execution. Useful if you want to bundle Yarn into your repository and have everyone use the same version for consistency. This was introduced in Yarn 1.0, so all developers must have Yarn >= 1.0 installed.

Value must be a relative file path, or false to disable (default).

disable-self-update-check

disable-self-update-check true

When installing packages, Yarn will provide upgrade instructions if you have an outdated CLI installation. You can disable this check here.

值必须是一个布尔值,默认值为 false

child-concurrency

child-concurrency #number#

Controls the number of child processes run parallely to build node modules.

Setting this number to 1 will cause the node modules to be built sequentially which can avoid linker errors on windows with node-gyp.

CLI 参数

Setting --<command>.<flag> <value> in .yarnrc would be the same as running yarn <command> --<flag> <value>.

示例︰

$> cat .yarnrc
--install.check-files true

Is the same running yarn install --check-files

示例 2:

$> cat .yarnrc
--cache-folder /tmp/yarn-cache/

$> yarn cache dir
/tmp/yarn-cache/v1