yarn upgrade [package | package | package@version | /]… [—ignore-engines] [—pattern]
该命令会根据在 文件中所指定的版本范围将依赖更新到其最新版本。也会重新生成yarn.lock
文件。
可以选择指定一个或多个包名称。指定包名称时,将只升级这些包。未指定包名称时,将升级所有依赖项。
[package]
: When a specified package is only a name then the latest patching version of this package will be upgraded to.
[package@tag]
: 指定包包含标签时,将升级到该标签的版本。 名称由项目维护者选择,通常你用这个命令来安装一个活跃开发中的包的实验版本或长期支持版本。 你选择的标签会成为出现在你的 package.json
文件里的版本。
: 此标志可用于跳过引擎检查。
示例:
yarn upgrade —pattern <pattern>
将升级所有匹配此模式的包。
示例:
yarn upgrade [package]… —latest|-L [—caret | —tilde | —exact] [—pattern]
The package.json
file will be updated to reflect the latest version range. By default, the existing range specifier in will be reused if it is one of: ^, ~, <=, >, or an exact version. 否则,它将被更改为插入符号 (^)。 One of the flags —caret
, —tilde
or —exact
can be used to explicitely specify a range.
示例:
yarn upgrade (—scope|-S) @scope [—latest] [—pattern]
—作用域 /
: 指定作用域时, 只会升级以作用域开头的包。作用域必须以 “@” 开头。
—latest
: 忽略在 package.json
中指定的版本范围。 Instead, the version specified by the tag will be used (potentially upgrading the packages across major versions).