Fix for use with --metadata option

I had a lot of trouble getting the metadata option to run. This fixes all the issues I had.

* When running the metadata option (which should be a bool, right??), I dont want the generated html output.
* It had a convoluted method for determining the main file. I think we should just have proper mains defined. The [npm spec](https://www.npmjs.org/doc/files/package.json.html#main) explicitly states it should be relative from the root.
* It was broken when trying to parse a dir outside of the current directory. 
The diff looks a little messed up, but, all I did is indent from the else down to the done line, then add a newline.