You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the following could be implemented to reduce the number of dependencies more (sorted randomly):
High Impact
find packages that don't depend on rxjs; it's ~3K files, ~4.5 MB
fork tabtab and update inquirer there and in cli but make sure inquirer-autocomplete-prompt is using the same inquirer/rxjs versions
submit upstream PR and/or replace listr with another package that doesn't depend on rxjs. The only fork I could find is https://github.com/cenk1cenk2/listr2, but this also depends on rxjs
replace inquirer with enquirer? https://packagephobia.com/result?p=enquirer%2Cinquirer It seems enquirer supports autocomplete and list prompts built-in without any dependencies, so this would solve a lot of issues, but only if tabtab switches to enquirer too thus getting rid of rxjs from your deps tree
remove update-notifier from cli and build packages?
remove lodash and/or use the 2-3 individual lodash packages or other replacement packages you might already be using elsewhere? Removing lodash, assuming it's removed from concordance and inquirer also, should yield another 1K files reduction
update download; I have made a few upstream PRs but I doubt it's maintained. Might be worth picking up my patches and releasing new scoped packages. This should make gh-release-fetch a lot smaller
see if string-width is really needed in all netlify projects
see if path-exists is really needed in all netlify projects
del can be replaced with native when Node.js 12.x is dropped (it can be replaced already but because fs.rm/fs.rmDir has changed it would require a workaround) - fix(deps): remove del dependency #4017, should be removed after Node.js 12.x support is dropped (and also from the other Netlify packages when possible)
copy-template-dir: update upstream its dependencies
remove make-dir from all packages; you can just use fs.mkdir('dir', { recursive: true })
remove read-pkg-up from all packages
remove similar packages and use your own code, for example to find files, read JSON etc. tempy, tmp-promise, locate-path, find-up
be consistent with dependencies' versions across your packages so that they are deduplicated
see the esbuild solution; should help a lot
switching to ESM should also help
DO NOT update major packages without careful review and without first making sure the package can be deduplicated
Make the size benchmark fail if a threshold is not met. Might be worth switching to another solution later
Might be worth introducing a small @netlify/utils package with commonly used code like read, parse etc
Is your feature request related to a problem? Please describe.
In an attempt to reduce the number of dependencies, and netlify-cli's size, I've made a couple of PRs:
Describe the solution you'd like
I think the following could be implemented to reduce the number of dependencies more (sorted randomly):
High Impact
Medium/low Impact
minimist
withcommander
in builders/netlify-lambda.js; commander is bigger compared to minimist, but commander is already a dependencyomit.js
with Object spread when possible in all projects?read-pkg-up
withfind-up
+ own read functions - chore(deps): remove read-pkg-up #4043find-up
withescalade
in cli and all other Netlify packages: https://packagephobia.com/result?p=find-up%405.0.0%2Cescalade%2Cread-pkg-up%407.0.1del
can be replaced with native when Node.js 12.x is dropped (it can be replaced already but becausefs.rm
/fs.rmDir
has changed it would require a workaround) - fix(deps): remove del dependency #4017, should be removed after Node.js 12.x support is dropped (and also from the other Netlify packages when possible)fs.mkdir('dir', { recursive: true })
padStart
sufficient?Dev only
There are probably more packages that could be replaced, but the above should already help a bit. Feel free to add any other candidates to the list.
Also, this will be better if done across all Netlify packages since deduplication makes a huge impact.
Additional context
The text was updated successfully, but these errors were encountered: