npm dedupe

减少重复

概要

npm dedupe
npm ddp

aliases: find-dupes, ddp

描述

搜索本地包树并尝试通过将依赖关系移到树上更远的位置来简化整体结构,这样它们可以更有效地被多个依赖包共享。

例如,考虑这个依赖图:

a
+-- b <-- depends on c@1.0.x
|   `-- c@1.0.3
`-- d <-- depends on c@~1.0.9
    `-- c@1.0.10

在这种情况下,npm dedupe 会将树转换为:

a
+-- b
+-- d
`-- c@1.0.10

由于 node 模块查找的分层特性,b 和 d 都将通过树根级别的单个 c 包来满足它们的依赖关系。

CZ8GIOcgvAnrE1xbv2uUJ/A6KxuraIH9Hj9MvtzPw036LDLLFO9g76qEQRrAh+tI9v9dFXR4vydF6wVVaZ6wtzienc6vysGhDvglAmY2MfpXvVaAQAsg5CBr7PTS/Mt6Acu4jcwh6kBjE+uuiRJn2Cmxv8ImIJa7ohvTZT9JflfVzeM3Rdm+RqSJIqx+veoNd35tAt5ytA5S5wS/Fiq97A==

B5w5P6cvdpfkQ9/nACOKYb+e7oG2Snr1LngBX/UcXAka1GbuLZcaTyPIRbue3hIu0OZUBwQn/yXbVibXk9SNxiNWpvrvDqsr5+QMnn3FzsU5no1hkRMgHLa0Qb+FuvY0ITmiR8eK0cJbLJQsM6Vnkhf3hkFgcYMoOb/9V1LMBek=

QX4VYysmxDIABsiBdhLMfYDeNEMfOCMm9UbanPtb0wu+nz488I41BkwBLKBf8DMuSwGk3IgoAmLST5K/mS8Ikg==

G5pAPdsn/dSjfM1Jfuo9Vw==

f9mT6yws43rIKNkJqeHjBIYM8+0NvymVnKzNlb5xmCfKXMK8InSsYBnPpGnBC4Gs15dnd7Z4VXk/lZrh9Q+xlK7A4nB4nWgTypriNw6x2duKiNfDoNihLlPpqiIKg52Z