Browserify transform to fallback node.js basics in PhantomJS
This was built to be able to run option parsers like commander inside of PhantomJS.
Install the module with: npm install phantomjsify
Use it as a transform with browserify:
# Currently, we require you to skip over PhantomJS exclusive require's (e.g. `system`)
browserify --standalone commander --entry node_modules/commander/index.js --transform phantomjsify --external system --outfile vendor/commander.jsInside of your PhantomJS script, load in the browserified file:
var program = require('./vendor/commander')
.parse(process.argv);
console.log(program); // {"options":[{"flags":"-V, --version", ... "args":[]}It is an aggressive venture to shim over all of [node][]'s functionality, especially across multiple versions. As a result, we are taking only what we need as we need it.
Pull requests are encouraged!
- process.stdout - http://nodejs.org/api/process.html#process_process_stdout
- process.stderr - http://nodejs.org/api/process.html#process_process_stderr
- process.exit - http://nodejs.org/api/process.html#process_process_exit_code
- process.argv - http://nodejs.org/api/process.html#process_process_argv
Support this project and others by twolfson via gittip.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint via grunt and test via npm test.
As of Nov 16 2013, Todd Wolfson has released this repository and its contents to the public domain.
It has been released under the UNLICENSE.

