unlock-protocol / unlock

Ʉnlock is a protocol for memberships built on a blockchain.
https://unlock-protocol.com
MIT License
841 stars 248 forks source link

Depcheck results #4510

Closed cnasc closed 5 years ago

cnasc commented 5 years ago

Posting the result of running depcheck on our repos here. We shouldn't take this output too literally, as there could be false positives (especially for things we move with link-parent-bin) but it gives us a starting point for identifying unneeded dependencies. I suspect that most if not all of the "missing dependencies" are actually things we copy in.

unlock (root directory)

Unused dependencies

Unused devDependencies

unlock-app

Unused dependencies

Missing dependencies

paywall

Unused dependencies

Missing dependencies

tickets

Unused dependencies

Missing dependencies

locksmith

Unused dependencies

Unused devDependencies

Missing dependencies

wedlocks

Unused dependencies

Missing dependencies

unlock-js

Missing dependencies

cnasc commented 5 years ago

As a bonus, output from cost-of-modules showing the top 10 heaviest dependencies in each repo. First, the root unlock directory:


┌──────────────────────┬──────────────┬─────────┐
│ name                 │ children     │ size    │
├──────────────────────┼──────────────┼─────────┤
│ netlify-cli          │ 1332         │ 220.59M │
├──────────────────────┼──────────────┼─────────┤
│ jest                 │ 418          │ 84.82M  │
├──────────────────────┼──────────────┼─────────┤
│ babel-jest           │ 316          │ 55.40M  │
├──────────────────────┼──────────────┼─────────┤
│ typescript           │ 0            │ 42.39M  │
├──────────────────────┼──────────────┼─────────┤
│ eslint               │ 156          │ 25.11M  │
├──────────────────────┼──────────────┼─────────┤
│ lint-staged          │ 328          │ 15.07M  │
├──────────────────────┼──────────────┼─────────┤
│ babel-eslint         │ 38           │ 10.48M  │
├──────────────────────┼──────────────┼─────────┤
│ prettier             │ 0            │ 8.89M   │
├──────────────────────┼──────────────┼─────────┤
│ link-parent-bin      │ 29           │ 4.17M   │
├──────────────────────┼──────────────┼─────────┤
│ eslint-plugin-import │ 57           │ 3.80M   │
├──────────────────────┼──────────────┼─────────┤
│ + 16 modules         │              │         │
├──────────────────────┼──────────────┼─────────┤
│ 26 modules           │ 924 children │ 250.61M │
└──────────────────────┴──────────────┴─────────┘
cnasc commented 5 years ago

unlock-app now:


┌────────────────────────────────┬───────────────┬─────────┐
│ name                           │ children      │ size    │
├────────────────────────────────┼───────────────┼─────────┤
│ @storybook/react               │ 1503          │ 242.03M │
├────────────────────────────────┼───────────────┼─────────┤
│ next                           │ 550           │ 77.09M  │
├────────────────────────────────┼───────────────┼─────────┤
│ @storybook/addon-actions       │ 232           │ 69.58M  │
├────────────────────────────────┼───────────────┼─────────┤
│ typescript                     │ 0             │ 42.39M  │
├────────────────────────────────┼───────────────┼─────────┤
│ @storybook/addon-knobs         │ 84            │ 33.08M  │
├────────────────────────────────┼───────────────┼─────────┤
│ @unlock-protocol/unlock-js     │ 109           │ 30.07M  │
├────────────────────────────────┼───────────────┼─────────┤
│ storybook-chromatic            │ 239           │ 22.75M  │
├────────────────────────────────┼───────────────┼─────────┤
│ @babel/core                    │ 50            │ 15.42M  │
├────────────────────────────────┼───────────────┼─────────┤
│ @storybook/addon-storyshots    │ 104           │ 14.97M  │
├────────────────────────────────┼───────────────┼─────────┤
│ fork-ts-checker-webpack-plugin │ 457           │ 14.45M  │
├────────────────────────────────┼───────────────┼─────────┤
│ + 46 modules                   │               │         │
├────────────────────────────────┼───────────────┼─────────┤
│ 56 modules                     │ 1216 children │ 237.11M │
└────────────────────────────────┴───────────────┴─────────┘
cnasc commented 5 years ago

Paywall:


┌────────────────────────────┬───────────────┬─────────┐
│ name                       │ children      │ size    │
├────────────────────────────┼───────────────┼─────────┤
│ @storybook/react           │ 1185          │ 214.68M │
├────────────────────────────┼───────────────┼─────────┤
│ next                       │ 554           │ 78.28M  │
├────────────────────────────┼───────────────┼─────────┤
│ @storybook/addon-actions   │ 209           │ 69.60M  │
├────────────────────────────┼───────────────┼─────────┤
│ cssnano                    │ 193           │ 51.94M  │
├────────────────────────────┼───────────────┼─────────┤
│ typescript                 │ 0             │ 42.39M  │
├────────────────────────────┼───────────────┼─────────┤
│ @storybook/addon-knobs     │ 84            │ 33.09M  │
├────────────────────────────┼───────────────┼─────────┤
│ @unlock-protocol/unlock-js │ 65            │ 27.19M  │
├────────────────────────────┼───────────────┼─────────┤
│ webpack                    │ 264           │ 24.47M  │
├────────────────────────────┼───────────────┼─────────┤
│ @babel/core                │ 50            │ 15.42M  │
├────────────────────────────┼───────────────┼─────────┤
│ @zeit/next-css             │ 48            │ 15.29M  │
├────────────────────────────┼───────────────┼─────────┤
│ + 52 modules               │               │         │
├────────────────────────────┼───────────────┼─────────┤
│ 62 modules                 │ 1197 children │ 248.09M │
└────────────────────────────┴───────────────┴─────────┘
cnasc commented 5 years ago

Noticing some patterns here, all the frontend apps have basically the same huge dependencies. Unlock-js, locksmith, et al are so small by comparison that I don't think they're worth considering until we take care of the major stuff.

julien51 commented 5 years ago

yeah. And this makes me think we should give another shot at yarn.

julien51 commented 5 years ago

Also the depcheck stuff is not entirely accurate. For example the babel stuff is being used.

cnasc commented 5 years ago

Also the depcheck stuff is not entirely accurate. For example the babel stuff is being used.

Yup. And most of the types don't get directly referenced but they are actually active.

julien51 commented 5 years ago

so agree regarding "weight" but I think we can also consider build times. These deps do add up eventually on that front as well. If we can remove them easily we should!

cnasc commented 5 years ago

so agree regarding "weight" but I think we can also consider build times. These deps do add up eventually on that front as well. If we can remove them easily we should!

Agreed 100%

cnasc commented 5 years ago

Going to close this, we can monitor depcheck as needed moving forward