• yarn config set <key> <value> [-g|—global]
  • yarn config get <key>
  • yarn config delete <key>
  • yarn config list

    管理 yarn 配置文件。

    yarn config set <key> <value> [-g|—global]

    设置配置项 key 为一个确切值 value

    示例︰

    1. $ yarn config set init-license BSD-2-Clause
    2. yarn config vx.x.x
    3. success Set "init-license" to "BSD-2-Clause".
    4. Done in 0.05s.
    yarn config get <key>

    回显给定 key 的值到 stdout

    示例︰

    1. $ yarn config get init-license
    2. BSD-2-Clause
    yarn config delete <key>

    从配置里删除指定 key

    示例︰

    1. $ yarn config delete test-key
    2. yarn config vx.x.x
    3. success Deleted "test-key".
    4. Done in 0.06s.
    yarn config list

    显示当前配置。

    示例︰

    1. $ yarn config list
    2. yarn config vx.x.x
    3. info yarn config
    4. { 'version-tag-prefix': 'v',
    5. 'version-git-tag': true,
    6. 'version-git-sign': false,
    7. 'version-git-message': 'v%s',
    8. 'init-version': '1.0.0',
    9. 'init-license': 'MIT',
    10. 'save-prefix': '^',
    11. 'ignore-scripts': false,
    12. 'ignore-optional': true,
    13. registry: 'https://registry.yarnpkg.com',
    14. 'user-agent': 'yarn/0.15.0 npm/? node/v6.2.1 darwin x64' }
    15. info npm config
    16. { registry: 'https://registry.npmjs.org/',
    17. '//localhost:4873/:_authToken': 'some-auth-token' }
    18. Done in 0.05s.

    原文: https://yarnpkg.com/zh-Hans/docs/cli/config