ulixee / secret-agent

The web scraper that's nearly impossible to block - now called @ulixee/hero
https://secretagent.dev
MIT License
670 stars 44 forks source link

Documentation: Install Secret-Agent #56

Closed GlenDC closed 4 years ago

GlenDC commented 4 years ago

In https://secretagent.dev/docs#installation it is mentioned that the download size is quite substantial and also why. But if this is all the case, why is it not simply recommended to download this instead as a global dependency (-g)? Is there a reason why you would want to have this as a local dependency?

I ask, as I cannot imagine that if you have 10 projects using it, that you want all of them using this dependency downloaded locally.

calebjclark commented 4 years ago

@GlenDC, you are welcome to install it globally -- and it works great when installed globally. However, there are a few reasons why our default recommendation is to install locally:

The foremost reason is that by adding it into your local package.json, you are able to lock the version number. This ensures that your local code won't break because another project is using a different version. Equally important this allows you to deploy to production with the assurance that your production version will be the same as your development. Relying on globally installed node packages does not allow this (so far as I know).

The good news is the majority of the package size is from downloading Chrome, and in this area we have optimized SecretAgent so that all your locally installed versions should share the same Chrome download. This means that once you install it in one project, the other nine should be relatively quick and small.

GlenDC commented 4 years ago

That makes total sense. I guess the chrome version does depend also on your version of secret agent, so you might never the less need multiple chrome versions? I wonder if a small percept from this nice explanation of yours could be put in the linked documentation page, as it does help. It is however not that important that I you would want these 3 paragraphs there, I imagine. Either way, for me that does explain it nicely. Thank you for this :)