npm-prune.1 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. .TH "NPM\-PRUNE" "1" "October 2021" "" ""
  2. .SH "NAME"
  3. \fBnpm-prune\fR \- Remove extraneous packages
  4. .SS Synopsis
  5. .P
  6. .RS 2
  7. .nf
  8. npm prune [[<@scope>/]<pkg>\.\.\.] [\-\-production] [\-\-dry\-run] [\-\-json]
  9. .fi
  10. .RE
  11. .SS Description
  12. .P
  13. This command removes "extraneous" packages\. If a package name is provided,
  14. then only packages matching one of the supplied names are removed\.
  15. .P
  16. Extraneous packages are those present in the \fBnode_modules\fP folder that are
  17. not listed as any package's dependency list\.
  18. .P
  19. If the \fB\-\-production\fP flag is specified or the \fBNODE_ENV\fP environment
  20. variable is set to \fBproduction\fP, this command will remove the packages
  21. specified in your \fBdevDependencies\fP\|\. Setting \fB\-\-no\-production\fP will negate
  22. \fBNODE_ENV\fP being set to \fBproduction\fP\|\.
  23. .P
  24. If the \fB\-\-dry\-run\fP flag is used then no changes will actually be made\.
  25. .P
  26. If the \fB\-\-json\fP flag is used, then the changes \fBnpm prune\fP made (or would
  27. have made with \fB\-\-dry\-run\fP) are printed as a JSON object\.
  28. .P
  29. In normal operation, extraneous modules are pruned automatically, so you'll
  30. only need this command with the \fB\-\-production\fP flag\. However, in the real
  31. world, operation is not always "normal"\. When crashes or mistakes happen,
  32. this command can help clean up any resulting garbage\.
  33. .SS Configuration
  34. <!\-\- AUTOGENERATED CONFIG DESCRIPTIONS START \-\->
  35. <!\-\- automatically generated, do not edit manually \-\->
  36. <!\-\- see lib/utils/config/definitions\.js \-\->
  37. .SS \fBomit\fP
  38. .RS 0
  39. .IP \(bu 2
  40. Default: 'dev' if the \fBNODE_ENV\fP environment variable is set to
  41. \|'production', otherwise empty\.
  42. .IP \(bu 2
  43. Type: "dev", "optional", or "peer" (can be set multiple times)
  44. .RE
  45. .P
  46. Dependency types to omit from the installation tree on disk\.
  47. .P
  48. Note that these dependencies \fIare\fR still resolved and added to the
  49. \fBpackage\-lock\.json\fP or \fBnpm\-shrinkwrap\.json\fP file\. They are just not
  50. physically installed on disk\.
  51. .P
  52. If a package type appears in both the \fB\-\-include\fP and \fB\-\-omit\fP lists, then
  53. it will be included\.
  54. .P
  55. If the resulting omit list includes \fB\|'dev'\fP, then the \fBNODE_ENV\fP environment
  56. variable will be set to \fB\|'production'\fP for all lifecycle scripts\.
  57. <!\-\- automatically generated, do not edit manually \-\->
  58. <!\-\- see lib/utils/config/definitions\.js \-\->
  59. .SS \fBdry\-run\fP
  60. .RS 0
  61. .IP \(bu 2
  62. Default: false
  63. .IP \(bu 2
  64. Type: Boolean
  65. .RE
  66. .P
  67. Indicates that you don't want npm to make any changes and that it should
  68. only report what it would have done\. This can be passed into any of the
  69. commands that modify your local installation, eg, \fBinstall\fP, \fBupdate\fP,
  70. \fBdedupe\fP, \fBuninstall\fP, as well as \fBpack\fP and \fBpublish\fP\|\.
  71. .P
  72. Note: This is NOT honored by other network related commands, eg \fBdist\-tags\fP,
  73. \fBowner\fP, etc\.
  74. <!\-\- automatically generated, do not edit manually \-\->
  75. <!\-\- see lib/utils/config/definitions\.js \-\->
  76. .SS \fBjson\fP
  77. .RS 0
  78. .IP \(bu 2
  79. Default: false
  80. .IP \(bu 2
  81. Type: Boolean
  82. .RE
  83. .P
  84. Whether or not to output JSON data, rather than the normal output\.
  85. .RS 0
  86. .IP \(bu 2
  87. In \fBnpm pkg set\fP it enables parsing set values with JSON\.parse() before
  88. saving them to your \fBpackage\.json\fP\|\.
  89. .RE
  90. .P
  91. Not supported by all npm commands\.
  92. <!\-\- automatically generated, do not edit manually \-\->
  93. <!\-\- see lib/utils/config/definitions\.js \-\->
  94. .SS \fBworkspace\fP
  95. .RS 0
  96. .IP \(bu 2
  97. Default:
  98. .IP \(bu 2
  99. Type: String (can be set multiple times)
  100. .RE
  101. .P
  102. Enable running a command in the context of the configured workspaces of the
  103. current project while filtering by running only the workspaces defined by
  104. this configuration option\.
  105. .P
  106. Valid values for the \fBworkspace\fP config are either:
  107. .RS 0
  108. .IP \(bu 2
  109. Workspace names
  110. .IP \(bu 2
  111. Path to a workspace directory
  112. .IP \(bu 2
  113. Path to a parent workspace directory (will result in selecting all
  114. workspaces within that folder)
  115. .RE
  116. .P
  117. When set for the \fBnpm init\fP command, this may be set to the folder of a
  118. workspace which does not yet exist, to create the folder and set it up as a
  119. brand new workspace within the project\.
  120. .P
  121. This value is not exported to the environment for child processes\.
  122. <!\-\- automatically generated, do not edit manually \-\->
  123. <!\-\- see lib/utils/config/definitions\.js \-\->
  124. .SS \fBworkspaces\fP
  125. .RS 0
  126. .IP \(bu 2
  127. Default: null
  128. .IP \(bu 2
  129. Type: null or Boolean
  130. .RE
  131. .P
  132. Set to true to run the command in the context of \fBall\fR configured
  133. workspaces\.
  134. .P
  135. Explicitly setting this to false will cause commands like \fBinstall\fP to
  136. ignore workspaces altogether\. When not set explicitly:
  137. .RS 0
  138. .IP \(bu 2
  139. Commands that operate on the \fBnode_modules\fP tree (install, update, etc\.)
  140. will link workspaces into the \fBnode_modules\fP folder\. \- Commands that do
  141. other things (test, exec, publish, etc\.) will operate on the root project,
  142. \fIunless\fR one or more workspaces are specified in the \fBworkspace\fP config\.
  143. .RE
  144. .P
  145. This value is not exported to the environment for child processes\.
  146. <!\-\- automatically generated, do not edit manually \-\->
  147. <!\-\- see lib/utils/config/definitions\.js \-\->
  148. .SS \fBinclude\-workspace\-root\fP
  149. .RS 0
  150. .IP \(bu 2
  151. Default: false
  152. .IP \(bu 2
  153. Type: Boolean
  154. .RE
  155. .P
  156. Include the workspace root when workspaces are enabled for a command\.
  157. .P
  158. When false, specifying individual workspaces via the \fBworkspace\fP config, or
  159. all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on
  160. the specified workspaces, and not on the root project\.
  161. <!\-\- automatically generated, do not edit manually \-\->
  162. <!\-\- see lib/utils/config/definitions\.js \-\->
  163. <!\-\- AUTOGENERATED CONFIG DESCRIPTIONS END \-\->
  164. .SS See Also
  165. .RS 0
  166. .IP \(bu 2
  167. npm help uninstall
  168. .IP \(bu 2
  169. npm help folders
  170. .IP \(bu 2
  171. npm help ls
  172. .RE