yarn: default configuration

2020-08-23

 | 

~1 min read

 | 

128 words

Similar to git and npm, yarn also allows basic CRUD operations for its configuration (which affect the results of the yarn init command).

The commands are:

yarn config set <key> <value> # Create/Update
yarn config get <key> # Read Single
yarn config list # Read all
yarn config delete <key> # Delete

Example:

yarn config set author "Stephen Weiss<stephencweiss@gmail.com>"
yarn config list
yarn config v1.22.4
info yarn config
{
  'version-tag-prefix': 'v',
  'version-git-tag': true,
  'version-commit-hooks': true,
  'version-git-sign': false,
  'version-git-message': 'v%s',
  'init-version': '0.0.1',
  'init-license': 'MIT',
  'save-prefix': '^',
  'bin-links': true,
  'ignore-scripts': false,
  'ignore-optional': false,
  registry: 'https://registry.yarnpkg.com',
  'strict-ssl': true,
  'user-agent': 'yarn/1.22.4 npm/? node/v12.18.3 darwin x64',
  author: 'Stephen Weiss<stephencweiss@gmail.com',
  lastUpdateCheck: 1596636862383
}

I love saving time like this. Plus setting these defaults is a win for consistency.



Hi there and thanks for reading! My name's Stephen. I live in Chicago with my wife, Kate, and dog, Finn. Want more? See about and get in touch!