npm-view.1 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. .TH "NPM\-VIEW" "1" "August 2021" "" ""
  2. .SH "NAME"
  3. \fBnpm-view\fR \- View registry info
  4. .SS Synopsis
  5. .P
  6. .RS 2
  7. .nf
  8. npm view [<@scope>/]<name>[@<version>] [<field>[\.<subfield>]\.\.\.]
  9. aliases: info, show, v
  10. .fi
  11. .RE
  12. .SS Description
  13. .P
  14. This command shows data about a package and prints it to the stream
  15. referenced by the \fBoutfd\fP config, which defaults to stdout\.
  16. .P
  17. To show the package registry entry for the \fBconnect\fP package, you can do
  18. this:
  19. .P
  20. .RS 2
  21. .nf
  22. npm view connect
  23. .fi
  24. .RE
  25. .P
  26. The default version is "latest" if unspecified\.
  27. .P
  28. Field names can be specified after the package descriptor\.
  29. For example, to show the dependencies of the \fBronn\fP package at version
  30. 0\.3\.5, you could do the following:
  31. .P
  32. .RS 2
  33. .nf
  34. npm view ronn@0\.3\.5 dependencies
  35. .fi
  36. .RE
  37. .P
  38. You can view child fields by separating them with a period\.
  39. To view the git repository URL for the latest version of npm, you could
  40. do this:
  41. .P
  42. .RS 2
  43. .nf
  44. npm view npm repository\.url
  45. .fi
  46. .RE
  47. .P
  48. This makes it easy to view information about a dependency with a bit of
  49. shell scripting\. For example, to view all the data about the version of
  50. opts that ronn depends on, you can do this:
  51. .P
  52. .RS 2
  53. .nf
  54. npm view opts@$(npm view ronn dependencies\.opts)
  55. .fi
  56. .RE
  57. .P
  58. For fields that are arrays, requesting a non\-numeric field will return
  59. all of the values from the objects in the list\. For example, to get all
  60. the contributor names for the "express" project, you can do this:
  61. .P
  62. .RS 2
  63. .nf
  64. npm view express contributors\.email
  65. .fi
  66. .RE
  67. .P
  68. You may also use numeric indices in square braces to specifically select
  69. an item in an array field\. To just get the email address of the first
  70. contributor in the list, you can do this:
  71. .P
  72. .RS 2
  73. .nf
  74. npm view express contributors[0]\.email
  75. .fi
  76. .RE
  77. .P
  78. Multiple fields may be specified, and will be printed one after another\.
  79. For example, to get all the contributor names and email addresses, you
  80. can do this:
  81. .P
  82. .RS 2
  83. .nf
  84. npm view express contributors\.name contributors\.email
  85. .fi
  86. .RE
  87. .P
  88. "Person" fields are shown as a string if they would be shown as an
  89. object\. So, for example, this will show the list of npm contributors in
  90. the shortened string format\. (See npm help \fBpackage\.json\fP for more on this\.)
  91. .P
  92. .RS 2
  93. .nf
  94. npm view npm contributors
  95. .fi
  96. .RE
  97. .P
  98. If a version range is provided, then data will be printed for every
  99. matching version of the package\. This will show which version of jsdom
  100. was required by each matching version of yui3:
  101. .P
  102. .RS 2
  103. .nf
  104. npm view yui3@'>0\.5\.4' dependencies\.jsdom
  105. .fi
  106. .RE
  107. .P
  108. To show the \fBconnect\fP package version history, you can do
  109. this:
  110. .P
  111. .RS 2
  112. .nf
  113. npm view connect versions
  114. .fi
  115. .RE
  116. .SS Output
  117. .P
  118. If only a single string field for a single version is output, then it
  119. will not be colorized or quoted, so as to enable piping the output to
  120. another command\. If the field is an object, it will be output as a JavaScript object literal\.
  121. .P
  122. If the \-\-json flag is given, the outputted fields will be JSON\.
  123. .P
  124. If the version range matches multiple versions, than each printed value
  125. will be prefixed with the version it applies to\.
  126. .P
  127. If multiple fields are requested, than each of them are prefixed with
  128. the field name\.
  129. .SS See Also
  130. .RS 0
  131. .IP \(bu 2
  132. npm help search
  133. .IP \(bu 2
  134. npm help registry
  135. .IP \(bu 2
  136. npm help config
  137. .IP \(bu 2
  138. npm help npmrc
  139. .IP \(bu 2
  140. npm help docs
  141. .RE