npm-dedupe.1 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. .TH "NPM\-DEDUPE" "1" "August 2021" "" ""
  2. .SH "NAME"
  3. \fBnpm-dedupe\fR \- Reduce duplication
  4. .SS Synopsis
  5. .P
  6. .RS 2
  7. .nf
  8. npm dedupe
  9. npm ddp
  10. aliases: find\-dupes, ddp
  11. .fi
  12. .RE
  13. .SS Description
  14. .P
  15. Searches the local package tree and attempts to simplify the overall
  16. structure by moving dependencies further up the tree, where they can
  17. be more effectively shared by multiple dependent packages\.
  18. .P
  19. For example, consider this dependency graph:
  20. .P
  21. .RS 2
  22. .nf
  23. a
  24. +\-\- b <\-\- depends on c@1\.0\.x
  25. | `\-\- c@1\.0\.3
  26. `\-\- d <\-\- depends on c@~1\.0\.9
  27. `\-\- c@1\.0\.10
  28. .fi
  29. .RE
  30. .P
  31. In this case, \fBnpm dedupe\fP will transform the tree to:
  32. .P
  33. .RS 2
  34. .nf
  35. a
  36. +\-\- b
  37. +\-\- d
  38. `\-\- c@1\.0\.10
  39. .fi
  40. .RE
  41. .P
  42. Because of the hierarchical nature of node's module lookup, b and d
  43. will both get their dependency met by the single c package at the root
  44. level of the tree\.
  45. .P
  46. The deduplication algorithm walks the tree, moving each dependency as far
  47. up in the tree as possible, even if duplicates are not found\. This will
  48. result in both a flat and deduplicated tree\.
  49. .P
  50. If a suitable version exists at the target location in the tree
  51. already, then it will be left untouched, but the other duplicates will
  52. be deleted\.
  53. .P
  54. Arguments are ignored\. Dedupe always acts on the entire tree\.
  55. .P
  56. Modules
  57. .P
  58. Note that this operation transforms the dependency tree, but will never
  59. result in new modules being installed\.
  60. .SS See Also
  61. .RS 0
  62. .IP \(bu 2
  63. npm help ls
  64. .IP \(bu 2
  65. npm help update
  66. .IP \(bu 2
  67. npm help install
  68. .RE