Skip to content

Instantly share code, notes, and snippets.

@nicholaskajoh
Created May 25, 2020 22:31
Show Gist options
  • Save nicholaskajoh/a4b068818b965b95f6eae3aa285e4fc3 to your computer and use it in GitHub Desktop.
Save nicholaskajoh/a4b068818b965b95f6eae3aa285e4fc3 to your computer and use it in GitHub Desktop.
Deduplication in an npm package dependency graph.
nicholas@Inspiron-3542:~/dev/SANDBOX/knex$ npm ls -prod
knex@0.21.1 /home/nicholas/dev/SANDBOX/knex
├── colorette@1.1.0
├── commander@5.1.0
├─┬ debug@4.1.1
│ └── ms@2.1.2
├── esm@3.2.25
├── getopts@2.2.5
├── inherits@2.0.4
├── interpret@2.0.0
├─┬ liftoff@3.1.0
│ ├── extend@3.0.2
│ ├─┬ findup-sync@3.0.0
│ │ ├── detect-file@1.0.0
│ │ ├─┬ is-glob@4.0.1
│ │ │ └── is-extglob@2.1.1
│ │ ├─┬ micromatch@3.1.10
│ │ │ ├── arr-diff@4.0.0
│ │ │ ├── array-unique@0.3.2
│ │ │ ├─┬ braces@2.3.2
│ │ │ │ ├── arr-flatten@1.1.0
│ │ │ │ ├── array-unique@0.3.2 deduped
│ │ │ │ ├─┬ extend-shallow@2.0.1
│ │ │ │ │ └── is-extendable@0.1.1
│ │ │ │ ├─┬ fill-range@4.0.0
│ │ │ │ │ ├─┬ extend-shallow@2.0.1
│ │ │ │ │ │ └── is-extendable@0.1.1 deduped
│ │ │ │ │ ├─┬ is-number@3.0.0
│ │ │ │ │ │ └─┬ kind-of@3.2.2
│ │ │ │ │ │ └── is-buffer@1.1.6
│ │ │ │ │ ├── repeat-string@1.6.1
│ │ │ │ │ └─┬ to-regex-range@2.1.1
│ │ │ │ │ ├── is-number@3.0.0 deduped
│ │ │ │ │ └── repeat-string@1.6.1 deduped
│ │ │ │ ├── isobject@3.0.1 deduped
│ │ │ │ ├── repeat-element@1.1.3
│ │ │ │ ├── snapdragon@0.8.2 deduped
│ │ │ │ ├─┬ snapdragon-node@2.1.1
│ │ │ │ │ ├─┬ define-property@1.0.0
│ │ │ │ │ │ └─┬ is-descriptor@1.0.2
│ │ │ │ │ │ ├─┬ is-accessor-descriptor@1.0.0
│ │ │ │ │ │ │ └── kind-of@6.0.3 deduped
│ │ │ │ │ │ ├─┬ is-data-descriptor@1.0.0
│ │ │ │ │ │ │ └── kind-of@6.0.3 deduped
│ │ │ │ │ │ └── kind-of@6.0.3 deduped
│ │ │ │ │ ├── isobject@3.0.1 deduped
│ │ │ │ │ └─┬ snapdragon-util@3.0.1
│ │ │ │ │ └─┬ kind-of@3.2.2
│ │ │ │ │ └── is-buffer@1.1.6 deduped
│ │ │ │ ├─┬ split-string@3.1.0
│ │ │ │ │ └── extend-shallow@3.0.2 deduped
│ │ │ │ └── to-regex@3.0.2 deduped
│ │ │ ├─┬ define-property@2.0.2
│ │ │ │ ├─┬ is-descriptor@1.0.2
│ │ │ │ │ ├─┬ is-accessor-descriptor@1.0.0
│ │ │ │ │ │ └── kind-of@6.0.3 deduped
│ │ │ │ │ ├─┬ is-data-descriptor@1.0.0
│ │ │ │ │ │ └── kind-of@6.0.3 deduped
│ │ │ │ │ └── kind-of@6.0.3 deduped
│ │ │ │ └── isobject@3.0.1 deduped
│ │ │ ├─┬ extend-shallow@3.0.2
│ │ │ │ ├── assign-symbols@1.0.0
│ │ │ │ └─┬ is-extendable@1.0.1
│ │ │ │ └── is-plain-object@2.0.4 deduped
│ │ │ ├─┬ extglob@2.0.4
│ │ │ │ ├── array-unique@0.3.2 deduped
│ │ │ │ ├─┬ define-property@1.0.0
│ │ │ │ │ └─┬ is-descriptor@1.0.2
│ │ │ │ │ ├─┬ is-accessor-descriptor@1.0.0
│ │ │ │ │ │ └── kind-of@6.0.3 deduped
│ │ │ │ │ ├─┬ is-data-descriptor@1.0.0
│ │ │ │ │ │ └── kind-of@6.0.3 deduped
│ │ │ │ │ └── kind-of@6.0.3 deduped
│ │ │ │ ├─┬ expand-brackets@2.1.4
│ │ │ │ │ ├─┬ debug@2.6.9
│ │ │ │ │ │ └── ms@2.0.0
│ │ │ │ │ ├─┬ define-property@0.2.5
│ │ │ │ │ │ └── is-descriptor@0.1.6 deduped
│ │ │ │ │ ├─┬ extend-shallow@2.0.1
│ │ │ │ │ │ └── is-extendable@0.1.1 deduped
│ │ │ │ │ ├── posix-character-classes@0.1.1
│ │ │ │ │ ├── regex-not@1.0.2 deduped
│ │ │ │ │ ├── snapdragon@0.8.2 deduped
│ │ │ │ │ └── to-regex@3.0.2 deduped
│ │ │ │ ├─┬ extend-shallow@2.0.1
│ │ │ │ │ └── is-extendable@0.1.1 deduped
│ │ │ │ ├── fragment-cache@0.2.1 deduped
│ │ │ │ ├── regex-not@1.0.2 deduped
│ │ │ │ ├── snapdragon@0.8.2 deduped
│ │ │ │ └── to-regex@3.0.2 deduped
│ │ │ ├─┬ fragment-cache@0.2.1
│ │ │ │ └── map-cache@0.2.2 deduped
│ │ │ ├── kind-of@6.0.3
│ │ │ ├─┬ nanomatch@1.2.13
│ │ │ │ ├── arr-diff@4.0.0 deduped
│ │ │ │ ├── array-unique@0.3.2 deduped
│ │ │ │ ├── define-property@2.0.2 deduped
│ │ │ │ ├── extend-shallow@3.0.2 deduped
│ │ │ │ ├── fragment-cache@0.2.1 deduped
│ │ │ │ ├── is-windows@1.0.2
│ │ │ │ ├── kind-of@6.0.3 deduped
│ │ │ │ ├── object.pick@1.3.0 deduped
│ │ │ │ ├── regex-not@1.0.2 deduped
│ │ │ │ ├── snapdragon@0.8.2 deduped
│ │ │ │ └── to-regex@3.0.2 deduped
│ │ │ ├── object.pick@1.3.0 deduped
│ │ │ ├─┬ regex-not@1.0.2
│ │ │ │ ├── extend-shallow@3.0.2 deduped
│ │ │ │ └─┬ safe-regex@1.1.0
│ │ │ │ └── ret@0.1.15
│ │ │ ├─┬ snapdragon@0.8.2
│ │ │ │ ├─┬ base@0.11.2
│ │ │ │ │ ├─┬ cache-base@1.0.1
│ │ │ │ │ │ ├─┬ collection-visit@1.0.0
│ │ │ │ │ │ │ ├─┬ map-visit@1.0.0
│ │ │ │ │ │ │ │ └── object-visit@1.0.1 deduped
│ │ │ │ │ │ │ └─┬ object-visit@1.0.1
│ │ │ │ │ │ │ └── isobject@3.0.1 deduped
│ │ │ │ │ │ ├── component-emitter@1.3.0 deduped
│ │ │ │ │ │ ├── get-value@2.0.6
│ │ │ │ │ │ ├─┬ has-value@1.0.0
│ │ │ │ │ │ │ ├── get-value@2.0.6 deduped
│ │ │ │ │ │ │ ├─┬ has-values@1.0.0
│ │ │ │ │ │ │ │ ├── is-number@3.0.0 deduped
│ │ │ │ │ │ │ │ └─┬ kind-of@4.0.0
│ │ │ │ │ │ │ │ └── is-buffer@1.1.6 deduped
│ │ │ │ │ │ │ └── isobject@3.0.1 deduped
│ │ │ │ │ │ ├── isobject@3.0.1 deduped
│ │ │ │ │ │ ├─┬ set-value@2.0.1
│ │ │ │ │ │ │ ├─┬ extend-shallow@2.0.1
│ │ │ │ │ │ │ │ └── is-extendable@0.1.1 deduped
│ │ │ │ │ │ │ ├── is-extendable@0.1.1 deduped
│ │ │ │ │ │ │ ├── is-plain-object@2.0.4 deduped
│ │ │ │ │ │ │ └── split-string@3.1.0 deduped
│ │ │ │ │ │ ├─┬ to-object-path@0.3.0
│ │ │ │ │ │ │ └─┬ kind-of@3.2.2
│ │ │ │ │ │ │ └── is-buffer@1.1.6 deduped
│ │ │ │ │ │ ├─┬ union-value@1.0.1
│ │ │ │ │ │ │ ├── arr-union@3.1.0 deduped
│ │ │ │ │ │ │ ├── get-value@2.0.6 deduped
│ │ │ │ │ │ │ ├── is-extendable@0.1.1 deduped
│ │ │ │ │ │ │ └── set-value@2.0.1 deduped
│ │ │ │ │ │ └─┬ unset-value@1.0.0
│ │ │ │ │ │ ├─┬ has-value@0.3.1
│ │ │ │ │ │ │ ├── get-value@2.0.6 deduped
│ │ │ │ │ │ │ ├── has-values@0.1.4
│ │ │ │ │ │ │ └─┬ isobject@2.1.0
│ │ │ │ │ │ │ └── isarray@1.0.0
│ │ │ │ │ │ └── isobject@3.0.1 deduped
│ │ │ │ │ ├─┬ class-utils@0.3.6
│ │ │ │ │ │ ├── arr-union@3.1.0
│ │ │ │ │ │ ├─┬ define-property@0.2.5
│ │ │ │ │ │ │ └── is-descriptor@0.1.6 deduped
│ │ │ │ │ │ ├── isobject@3.0.1 deduped
│ │ │ │ │ │ └─┬ static-extend@0.1.2
│ │ │ │ │ │ ├─┬ define-property@0.2.5
│ │ │ │ │ │ │ └── is-descriptor@0.1.6 deduped
│ │ │ │ │ │ └─┬ object-copy@0.1.0
│ │ │ │ │ │ ├── copy-descriptor@0.1.1
│ │ │ │ │ │ ├─┬ define-property@0.2.5
│ │ │ │ │ │ │ └── is-descriptor@0.1.6 deduped
│ │ │ │ │ │ └─┬ kind-of@3.2.2
│ │ │ │ │ │ └── is-buffer@1.1.6 deduped
│ │ │ │ │ ├── component-emitter@1.3.0
│ │ │ │ │ ├─┬ define-property@1.0.0
│ │ │ │ │ │ └─┬ is-descriptor@1.0.2
│ │ │ │ │ │ ├─┬ is-accessor-descriptor@1.0.0
│ │ │ │ │ │ │ └── kind-of@6.0.3 deduped
│ │ │ │ │ │ ├─┬ is-data-descriptor@1.0.0
│ │ │ │ │ │ │ └── kind-of@6.0.3 deduped
│ │ │ │ │ │ └── kind-of@6.0.3 deduped
│ │ │ │ │ ├── isobject@3.0.1 deduped
│ │ │ │ │ ├─┬ mixin-deep@1.3.2
│ │ │ │ │ │ ├── for-in@1.0.2 deduped
│ │ │ │ │ │ └─┬ is-extendable@1.0.1
│ │ │ │ │ │ └── is-plain-object@2.0.4 deduped
│ │ │ │ │ └── pascalcase@0.1.1
│ │ │ │ ├─┬ debug@2.6.9
│ │ │ │ │ └── ms@2.0.0
│ │ │ │ ├─┬ define-property@0.2.5
│ │ │ │ │ └─┬ is-descriptor@0.1.6
│ │ │ │ │ ├─┬ is-accessor-descriptor@0.1.6
│ │ │ │ │ │ └─┬ kind-of@3.2.2
│ │ │ │ │ │ └── is-buffer@1.1.6 deduped
│ │ │ │ │ ├─┬ is-data-descriptor@0.1.4
│ │ │ │ │ │ └─┬ kind-of@3.2.2
│ │ │ │ │ │ └── is-buffer@1.1.6 deduped
│ │ │ │ │ └── kind-of@5.1.0
│ │ │ │ ├─┬ extend-shallow@2.0.1
│ │ │ │ │ └── is-extendable@0.1.1 deduped
│ │ │ │ ├── map-cache@0.2.2 deduped
│ │ │ │ ├── source-map@0.5.7
│ │ │ │ ├─┬ source-map-resolve@0.5.3
│ │ │ │ │ ├── atob@2.1.2
│ │ │ │ │ ├── decode-uri-component@0.2.0
│ │ │ │ │ ├── resolve-url@0.2.1
│ │ │ │ │ ├── source-map-url@0.4.0
│ │ │ │ │ └── urix@0.1.0
│ │ │ │ └── use@3.1.1
│ │ │ └─┬ to-regex@3.0.2
│ │ │ ├── define-property@2.0.2 deduped
│ │ │ ├── extend-shallow@3.0.2 deduped
│ │ │ ├── regex-not@1.0.2 deduped
│ │ │ └── safe-regex@1.1.0 deduped
│ │ └─┬ resolve-dir@1.0.1
│ │ ├── expand-tilde@2.0.2 deduped
│ │ └─┬ global-modules@1.0.0
│ │ ├─┬ global-prefix@1.0.2
│ │ │ ├── expand-tilde@2.0.2 deduped
│ │ │ ├── homedir-polyfill@1.0.3 deduped
│ │ │ ├── ini@1.3.5
│ │ │ ├── is-windows@1.0.2 deduped
│ │ │ └─┬ which@1.3.1
│ │ │ └── isexe@2.0.0
│ │ ├── is-windows@1.0.2 deduped
│ │ └── resolve-dir@1.0.1 deduped
│ ├─┬ fined@1.2.0
│ │ ├─┬ expand-tilde@2.0.2
│ │ │ └── homedir-polyfill@1.0.3 deduped
│ │ ├── is-plain-object@2.0.4 deduped
│ │ ├─┬ object.defaults@1.1.0
│ │ │ ├── array-each@1.0.1
│ │ │ ├── array-slice@1.1.0
│ │ │ ├── for-own@1.0.0 deduped
│ │ │ └── isobject@3.0.1 deduped
│ │ ├─┬ object.pick@1.3.0
│ │ │ └── isobject@3.0.1 deduped
│ │ └─┬ parse-filepath@1.0.2
│ │ ├─┬ is-absolute@1.0.0
│ │ │ ├─┬ is-relative@1.0.0
│ │ │ │ └─┬ is-unc-path@1.0.0
│ │ │ │ └── unc-path-regex@0.1.2
│ │ │ └── is-windows@1.0.2 deduped
│ │ ├── map-cache@0.2.2
│ │ └─┬ path-root@0.1.1
│ │ └── path-root-regex@0.1.2
│ ├── flagged-respawn@1.0.1
│ ├─┬ is-plain-object@2.0.4
│ │ └── isobject@3.0.1
│ ├─┬ object.map@1.0.1
│ │ ├─┬ for-own@1.0.0
│ │ │ └── for-in@1.0.2
│ │ └─┬ make-iterator@1.0.1
│ │ └── kind-of@6.0.3 deduped
│ ├─┬ rechoir@0.6.2
│ │ └── resolve@1.17.0 deduped
│ └─┬ resolve@1.17.0
│ └── path-parse@1.0.6
├── lodash@4.17.15
├── mkdirp@1.0.4
├── pg-connection-string@2.2.0
├── tarn@3.0.0
├── tildify@2.0.0
├── uuid@7.0.3
└─┬ v8flags@3.1.3
└─┬ homedir-polyfill@1.0.3
└── parse-passwd@1.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment