RSS feed iconGitHub logo

Upgrade scoped packages with yarn

2023-04-111 minute readJavaScript, Yarn

yarn up '*' upgrades only unscoped packages.

Scoped packages are those that start with @ and have 2 parts (the scope and the name) separated with a slash, e.g. @types/node.

To upgrade scoped packages, use yarn up '*/*'.

Make sure to surround the argument with quotes so it does not undergo shell filename expansion.

Reason

yarn up uses the parseDescriptor function to parse the patterns from the command line arguments. It parses the argument and sets the scope to null if it is not provided.

In the case of just *, the descriptor's name will be parsed to *, but the scope will be set to null. This targets only unscoped packages.

Related resources

  1. https://github.com/yarnpkg/berry/issues/3550 - issue on the yarn repository to change yarn up * to upgrade both scoped and unscoped packages.

  2. https://yarnpkg.com/cli/up - yarn up documentation