yarn info
显示有关软件包的信息。
yarn info <package> [<field>]
此命令将提取有关软件包的信息,并以树格式返回该信息。该软件包不必已在本地安装。
yarn info react
yarn info vx.x.x
{ name: 'react',
version: '15.4.0-rc.2',
description: 'React is a JavaScript library for building user interfaces.',
time: { modified: '2016-10-06T22:09:27.397Z', ... } ... }
此命令的默认报告样式是单引号序列化。若要发出有效 JSON 的行,请使用标准 --json
标志
yarn info react --json
{"type":"inspect","data":{"name":"react","time":{...}}}
{"type":"finished","data":417}
特定版本的信息
将 @[version]
附加到软件包参数以提供特定于该版本的信息
yarn info [email protected]
yarn info vx.x.x
{ name: 'react',
version: '15.3.0',
description: 'React is a JavaScript library for building user interfaces.',
time: { modified: '2016-10-06T22:09:27.397Z', ... } ... }
选择特定字段
如果提供了可选字段参数,则仅返回树的该部分。
yarn info react description
yarn info vx.x.x
React is a JavaScript library for building user interfaces.
或检查可用的版本
yarn info react versions
yarn info v1.1.0
[ '0.0.1',
'0.0.2',
'0.0.3',
(etc)
如果指定字段属于嵌套对象,则返回子树
yarn info react time
yarn info vx.x.x
{ modified: '2016-10-06T22:09:27.397Z',
created: '2011-10-26T17:46:21.942Z', ... }
yarn info react time --json
{"type":"inspect","data":{"modified":"2016-10-06T22:09:27.397Z","created":...}}
...
检索 readme 字段
请注意,默认情况下,yarn info
不会返回 readme
字段(因为它通常很长)。若要明确请求该字段,请使用第二个参数
yarn info react readme
yarn info vx.x.x
## react
An npm package to get you immediate access to
[React](https://facebook.github.io/react/).
...