siddharthkp / cost-of-modules

Find out which of your dependencies are slowing you down 🐢
MIT License
2.84k stars 41 forks source link

Feature Request: Ignore Optional Dependencies #47

Open edm00se opened 6 years ago

edm00se commented 6 years ago

It would be nice to have an option to ignore optionalDependencies, which apparently are included with the invoked npm install --production that gets triggered.

siddharthkp commented 6 years ago

Make sense, would you like to create a PR?

edm00se commented 6 years ago

I'll put it on my list of "when I have time", but it might be a little while 🤔. I'll see when I can look into it. If I make some progress, I'll update here, but if somebody beats me to it, I'd love to see it implemented.

zodvik commented 6 years ago

@edm00se If you haven't started working on this, I'll take a shot on this today.

siddharthkp commented 6 years ago

Go for it!

siddharthkp commented 6 years ago

Also, oh damn! Hi Bafna!

zodvik commented 6 years ago

This was a rabbit hole that led to npm/npm#17633. The --no-optional isn't actually working in npm for some time now. I see 2 options

  1. Invoke as --no-shrinkwrap --no-optional as an fix to npm/npm#17633
  2. Parse package.json file to read optionalDependencies

I would prefer 1. if you don't anticipate side-effect of --no-shrinkwrap for this module usage. Your take?

aside: Hey! Last JS dev I did was in jQuery era, so am rusty :-)

edm00se commented 6 years ago

I don't expect the --no-shrinkwrap option should be an issue for the use case. Option 1 should be a pretty solid way to go.

Good find on that npm issue.

zodvik commented 6 years ago

npm ls doesn't support --no-optional. Looking for a workaround.