Further progress on module-ify'ing

- npm-compatible scripts
- distribution files
- main.js uses module.exports if available