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 反應版本
yarn info v1.1.0
[ '0.0.1',
  '0.0.2',
  '0.0.3',
(等)

若指定的欄位是個嵌套的物件,則回傳其子樹。

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/).
...