serverless/serverless

Make large aws-sdk and platform-sdk dependencies optional

Ouverte

#5 099 ouverte le 6 juil. 2018

 (2 commentaires) (0 réaction) (0 personne assignée)JavaScript (5 734 forks)batch import
cat/dependencyhelp wantedrefactor

Métriques du dépôt

Stars
 (46 915 étoiles)
Métriques de merge PR
 (Merge moyen 1j 15h) (34 PRs mergées en 30 j)

Description

It would be nice if the two large dependencies aws-sdk and platform-sdk could be separated from the main serverless tool into their own plugin or at least be marked optional (possibly by placing into peerDependencies). AFAICS they are only required when using serverless for AWS Lambda or Serverless Platform respectively.

  • What is the use case that should be solved. The more detail you describe this in the easier it is to understand for us.

aws-sdk brings in 30 MB and @serverless/platform-sdk another 12 MB. They are currently always included when installing serverless. However, they are not required when using serverless with another provider (e.g. serverless-openwhisk).

This makes npm install slower than needed and increases disk space usage (think docker images for CI tooling). We are also packaging serverless into a custom build tool and that extra cost (for unused code) is significant.

Here is the output of cost-of-modules on the latest serverless git checkout:

┌──────────────────────────┬──────────────┬────────┐
│ name                     │ children     │ size   │
├──────────────────────────┼──────────────┼────────┤
│ aws-sdk                  │ 17           │ 30.89M │
├──────────────────────────┼──────────────┼────────┤
│ @serverless/platform-sdk │ 123          │ 12.32M │
├──────────────────────────┼──────────────┼────────┤
│ tabtab                   │ 60           │ 8.69M  │
├──────────────────────────┼──────────────┼────────┤
│ archiver                 │ 60           │ 7.38M  │
├──────────────────────────┼──────────────┼────────┤
│ json-refs                │ 26           │ 4.37M  │
├──────────────────────────┼──────────────┼────────┤
│ download                 │ 76           │ 2.76M  │
├──────────────────────────┼──────────────┼────────┤
│ moment                   │ 0            │ 2.59M  │
├──────────────────────────┼──────────────┼────────┤
│ lodash                   │ 0            │ 1.34M  │
├──────────────────────────┼──────────────┼────────┤
│ @serverless/fdk          │ 7            │ 1.06M  │
├──────────────────────────┼──────────────┼────────┤
│ update-notifier          │ 66           │ 0.77M  │
├──────────────────────────┼──────────────┼────────┤
│ + 27 modules             │              │        │
├──────────────────────────┼──────────────┼────────┤
│ 37 modules               │ 274 children │ 57.67M │
└──────────────────────────┴──────────────┴────────┘
  • If there is additional config how would it look

Similar or dependent issues:

Guide contributeur