subql icon indicating copy to clipboard operation
subql copied to clipboard

Look into dependency sizes for CLI and project

Open stwiname opened this issue 1 year ago • 3 comments

The polkadot start installs about 800MB of dependencies right now. This includes the CLI as a dependency. We should look at reducing this.

This file is the output of du -h -d 1 | sort -n on node_modules with the sorting fixed with the units modules_size.txt

Starting with the larger dependencies I think there are a few easy wins, these changes will probably need to be made to common and types packages for each chain.

  • [ ] Ensure dependencies are actual required dependencies, if not they should be moved to devDependencies (e.g prettier)
  • [x] Update oclif and use correct sub packages. Currently we have aws-cli as a transient dependency which is 90MB
  • [x] Move ethereum codegen to @subql/common-ethereum. This will ensure versions of ethers remain the same between different packages
  • [ ] More specific imports. Do we need @polkadot/api as a dependency if we only use @polkadot/types
  • [ ] Investigate a way to make the CLI more modular, currently it supports every chain which brings along the associated sdks for those chains. typechain could be a good example where you need to also install the target
  • [ ] Look at bundling the CLI into a single js file (e.g webpack)

stwiname avatar Sep 04 '23 22:09 stwiname

The linked PR doesn't relate to this?

jamesbayly avatar Sep 06 '23 06:09 jamesbayly

This was incorrectly marked as fixed, reopened

stwiname avatar Sep 06 '23 21:09 stwiname

After the oclif update we're down to 580MB

modules_size.txt

stwiname avatar Sep 06 '23 23:09 stwiname

Closing this as we've reduced the size from >300MB to <100MB. If this is picked up again looking into the dependencies of class-transformer would be the next place to look.

stwiname avatar Jul 26 '24 02:07 stwiname