yarn info
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 react@15.3.0
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":...}}
...
检索自述文件字段
请注意,默认情况下,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/).
...