npm-view.1 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. .TH "NPM\-VIEW" "1" "October 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 stdout\.
  15. .P
  16. As an example, to view information about the \fBconnect\fP package from the registry, you would run:
  17. .P
  18. .RS 2
  19. .nf
  20. npm view connect
  21. .fi
  22. .RE
  23. .P
  24. The default version is \fB"latest"\fP if unspecified\.
  25. .P
  26. Field names can be specified after the package descriptor\.
  27. For example, to show the dependencies of the \fBronn\fP package at version
  28. \fB0\.3\.5\fP, you could do the following:
  29. .P
  30. .RS 2
  31. .nf
  32. npm view ronn@0\.3\.5 dependencies
  33. .fi
  34. .RE
  35. .P
  36. You can view child fields by separating them with a period\.
  37. To view the git repository URL for the latest version of \fBnpm\fP, you would run the following command:
  38. .P
  39. .RS 2
  40. .nf
  41. npm view npm repository\.url
  42. .fi
  43. .RE
  44. .P
  45. This makes it easy to view information about a dependency with a bit of
  46. shell scripting\. For example, to view all the data about the version of
  47. \fBopts\fP that \fBronn\fP depends on, you could write the following:
  48. .P
  49. .RS 2
  50. .nf
  51. npm view opts@$(npm view ronn dependencies\.opts)
  52. .fi
  53. .RE
  54. .P
  55. For fields that are arrays, requesting a non\-numeric field will return
  56. all of the values from the objects in the list\. For example, to get all
  57. the contributor email addresses for the \fBexpress\fP package, you would run:
  58. .P
  59. .RS 2
  60. .nf
  61. npm view express contributors\.email
  62. .fi
  63. .RE
  64. .P
  65. You may also use numeric indices in square braces to specifically select
  66. an item in an array field\. To just get the email address of the first
  67. contributor in the list, you can run:
  68. .P
  69. .RS 2
  70. .nf
  71. npm view express contributors[0]\.email
  72. .fi
  73. .RE
  74. .P
  75. Multiple fields may be specified, and will be printed one after another\.
  76. For example, to get all the contributor names and email addresses, you
  77. can do this:
  78. .P
  79. .RS 2
  80. .nf
  81. npm view express contributors\.name contributors\.email
  82. .fi
  83. .RE
  84. .P
  85. "Person" fields are shown as a string if they would be shown as an
  86. object\. So, for example, this will show the list of \fBnpm\fP contributors in
  87. the shortened string format\. (See npm help \fBpackage\.json\fP for more on this\.)
  88. .P
  89. .RS 2
  90. .nf
  91. npm view npm contributors
  92. .fi
  93. .RE
  94. .P
  95. If a version range is provided, then data will be printed for every
  96. matching version of the package\. This will show which version of \fBjsdom\fP
  97. was required by each matching version of \fByui3\fP:
  98. .P
  99. .RS 2
  100. .nf
  101. npm view yui3@'>0\.5\.4' dependencies\.jsdom
  102. .fi
  103. .RE
  104. .P
  105. To show the \fBconnect\fP package version history, you can do
  106. this:
  107. .P
  108. .RS 2
  109. .nf
  110. npm view connect versions
  111. .fi
  112. .RE
  113. .SS Configuration
  114. <!\-\- AUTOGENERATED CONFIG DESCRIPTIONS START \-\->
  115. <!\-\- automatically generated, do not edit manually \-\->
  116. <!\-\- see lib/utils/config/definitions\.js \-\->
  117. .SS \fBjson\fP
  118. .RS 0
  119. .IP \(bu 2
  120. Default: false
  121. .IP \(bu 2
  122. Type: Boolean
  123. .RE
  124. .P
  125. Whether or not to output JSON data, rather than the normal output\.
  126. .RS 0
  127. .IP \(bu 2
  128. In \fBnpm pkg set\fP it enables parsing set values with JSON\.parse() before
  129. saving them to your \fBpackage\.json\fP\|\.
  130. .RE
  131. .P
  132. Not supported by all npm commands\.
  133. <!\-\- automatically generated, do not edit manually \-\->
  134. <!\-\- see lib/utils/config/definitions\.js \-\->
  135. .SS \fBworkspace\fP
  136. .RS 0
  137. .IP \(bu 2
  138. Default:
  139. .IP \(bu 2
  140. Type: String (can be set multiple times)
  141. .RE
  142. .P
  143. Enable running a command in the context of the configured workspaces of the
  144. current project while filtering by running only the workspaces defined by
  145. this configuration option\.
  146. .P
  147. Valid values for the \fBworkspace\fP config are either:
  148. .RS 0
  149. .IP \(bu 2
  150. Workspace names
  151. .IP \(bu 2
  152. Path to a workspace directory
  153. .IP \(bu 2
  154. Path to a parent workspace directory (will result in selecting all
  155. workspaces within that folder)
  156. .RE
  157. .P
  158. When set for the \fBnpm init\fP command, this may be set to the folder of a
  159. workspace which does not yet exist, to create the folder and set it up as a
  160. brand new workspace within the project\.
  161. .P
  162. This value is not exported to the environment for child processes\.
  163. <!\-\- automatically generated, do not edit manually \-\->
  164. <!\-\- see lib/utils/config/definitions\.js \-\->
  165. .SS \fBworkspaces\fP
  166. .RS 0
  167. .IP \(bu 2
  168. Default: null
  169. .IP \(bu 2
  170. Type: null or Boolean
  171. .RE
  172. .P
  173. Set to true to run the command in the context of \fBall\fR configured
  174. workspaces\.
  175. .P
  176. Explicitly setting this to false will cause commands like \fBinstall\fP to
  177. ignore workspaces altogether\. When not set explicitly:
  178. .RS 0
  179. .IP \(bu 2
  180. Commands that operate on the \fBnode_modules\fP tree (install, update, etc\.)
  181. will link workspaces into the \fBnode_modules\fP folder\. \- Commands that do
  182. other things (test, exec, publish, etc\.) will operate on the root project,
  183. \fIunless\fR one or more workspaces are specified in the \fBworkspace\fP config\.
  184. .RE
  185. .P
  186. This value is not exported to the environment for child processes\.
  187. <!\-\- automatically generated, do not edit manually \-\->
  188. <!\-\- see lib/utils/config/definitions\.js \-\->
  189. .SS \fBinclude\-workspace\-root\fP
  190. .RS 0
  191. .IP \(bu 2
  192. Default: false
  193. .IP \(bu 2
  194. Type: Boolean
  195. .RE
  196. .P
  197. Include the workspace root when workspaces are enabled for a command\.
  198. .P
  199. When false, specifying individual workspaces via the \fBworkspace\fP config, or
  200. all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on
  201. the specified workspaces, and not on the root project\.
  202. <!\-\- automatically generated, do not edit manually \-\->
  203. <!\-\- see lib/utils/config/definitions\.js \-\->
  204. <!\-\- AUTOGENERATED CONFIG DESCRIPTIONS END \-\->
  205. .SS Output
  206. .P
  207. If only a single string field for a single version is output, then it
  208. will not be colorized or quoted, to enable piping the output to
  209. another command\. If the field is an object, it will be output as a JavaScript object literal\.
  210. .P
  211. If the \fB\-\-json\fP flag is given, the outputted fields will be JSON\.
  212. .P
  213. If the version range matches multiple versions then each printed value
  214. will be prefixed with the version it applies to\.
  215. .P
  216. If multiple fields are requested, then each of them is prefixed with
  217. the field name\.
  218. .SS See Also
  219. .RS 0
  220. .IP \(bu 2
  221. npm help search
  222. .IP \(bu 2
  223. npm help registry
  224. .IP \(bu 2
  225. npm help config
  226. .IP \(bu 2
  227. npm help npmrc
  228. .IP \(bu 2
  229. npm help docs
  230. .RE