Skip to content

Instantly share code, notes, and snippets.

@jmervine
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmervine/8838076 to your computer and use it in GitHub Desktop.
Save jmervine/8838076 to your computer and use it in GitHub Desktop.
request -> requets-lite
language: node_js
node_js:
- 0.8
- 0.10

Request (Lite Fork) -- Simplified HTTP client

NPM

What is this?

This is a request fork with all optional dependencies removed. So less get's installed when you install it in a project via package.json. I will do my best to keep it up to date with the core request module. (No guarantees).

Pick and choose your optional dependencies:

  • tough-cookie
  • form-data
  • tunnel-agent
  • http-signature
  • oauth-sign
  • hawk
  • aws-sign2
npm install --save request-lite <optional modules>

Note: This will only exists until npm supports a way to install a package without optional dependencies via package.json.


#!/usr/bin/env node
var fs = require('fs');
var pkg = require(process.cwd() + '/package.json');
pkg.name = "request-lite";
pkg.description = "Simplified HTTP request client (fork from mikeal without optional deps).";
pkg.author = "Joshua Mervine <joshua@mervine.net>";
delete pkg.repsoitory;
pkg.repository = "jmervine/request-lite";
delete pkg.optionalDependencies;
fs.writeFile('package.json', JSON.stringify(pkg, null, 2), { encoding: 'utf8' }, function (err) {
if (err) {
console.trace(err);
process.exit(1);
} else {
process.exit();
}
});
#!/bin/bash
set -e
function pp {
echo "\$ $@"
test "$DEBUG" || $@
}
pp cd /home/jmervine/sync/request
pp git pull --all
pp git checkout master
if test "$FORCE" || test "$DEBUG" || git diff origin jmervine/master | grep '+ "version":'
then
pp node ../sync.js
pp cp ../.travis.yml .
echo "\$ cat ../header.md > .README.md"
if ! test "$DEBUG"; then
cat ../header.md > .README.md
fi
echo "\$ cat README.md | \ "
echo " sed -e "s/'request'/\'request-lite\'/g" \ "
echo " -e "s/'User-Agent': 'request-lite'/\'User-Agent\': \'request\'/g" \ "
echo " >> .README.md"
if ! test "$DEBUG"; then
cat README.md | \
sed -e "s/'request'/\'request-lite\'/g" \
-e "s/'User-Agent': 'request-lite'/\'User-Agent\': \'request\'/g" \
>> .README.md
fi
pp mv .README.md README.md
echo 'git commit -a -m "Syncing with mikeal/request."'
git commit -a -m "Syncing with mikeal/request."
pp git push jmervine master --force
pp npm publish
pp git reset --hard origin/master
else
echo "No changes."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment