Register as AMD module

Adds support for registering as an AMD module if some AMD loader is available, and also adds a grunt.js + package.json to aid in minifiying and linting.