The request library has a rather large dependency chain that not everybody needs. In cases with very little disk space (e.g. embedded platforms) this can be a problem. This pull request changes some of these dependencies into optional dependencies, which are still installed by default, but are skipped when installed via npm install --no-optional. The relevant unit tests are skipped in case the modules are not found on the system.
npm install --no-optional
this is already planned for the 3.0 branch. as this is a breaking change it'll need to be held off until 3.0.
oh wait, i didn't realize the default still installs these.
give me a day or so to consider this patch, i'd like some more feedback.
yes, exactly. the default behavior is just like before, unless you install the library with --no-optional.
lib: Added optional() function
This works in the same way as required() but does not throw errors
if the module was not found.
dependencies: Set `aws-sign` as optional dependency
dependencies: Set `oauth-sign` as optional dependency
dependencies: Set `http-signature` as optional dependency
dependencies: Set `hawk` as optional dependency
dependencies: Set `tunnel-agent` as optional dependency
dependencies: Set `form-data` as optional dependency
dependencies: Set `tough-cookie` as optional dependency
Added .npmignore file
Ignore the tests folder when packaging and publishing. The tests folder
is only used during development and doesn't have to be packaged in the
final tarball. This reduces the package size by another 148 kB.
rebased the commits on top of the current master to take advantage of Travis CI checking
TravisCI: Test with and without optional dependencies
as you can see in https://api.travis-ci.org/jobs/12582058/log.txt?deansi=true only the required dependencies are getting installed when using npm install --no-optional, while https://api.travis-ci.org/jobs/12582056/log.txt?deansi=true shows the default npm install.
@mikeal please let me know if you have any more questions about this
I know this has already been fixed but 👍