diff --git a/.jshintignore b/.jshintignore index 79e6ea4..0d8c0b7 100644 --- a/.jshintignore +++ b/.jshintignore @@ -1,2 +1,3 @@ +dist node_modules test \ No newline at end of file diff --git a/README.md b/README.md index 82c0788..334338d 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,28 @@ client.droplets.list(function (err, account, headers, response) { npm test ``` +## Usage in the Browser + +This library is also available as a single file built for usage in the browser at `dist/digitalocean.js`. It uses [browserify](http://browserify.org/) to package all dependencies and output the built file. This file is updated and released to [Bower](https://bower.io) for each release with the same version. + + +For example, using the built file at `dist/digitalocean.js`: +```html + + + + + + + +``` + ## License MIT diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..c2aa681 --- /dev/null +++ b/bower.json @@ -0,0 +1,28 @@ +{ + "name": "digitalocean", + "description": "js wrapper for digitalocean v2 api", + "main": "dist/digitalocean.js", + "authors": [ + "Phillip Baker " + ], + "license": "MIT", + "keywords": [ + "wrapper", + "api", + "v2", + "droplet", + "digitalocean", + "digital ocean" + ], + "homepage": "https://github.com/phillbaker/digitalocean-node", + "moduleType": [ + "node" + ], + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/package.json b/package.json index acd70e3..3adff6f 100644 --- a/package.json +++ b/package.json @@ -12,13 +12,24 @@ "digitalocean" ], "scripts": { - "test": "mocha --bail --recursive --reporter dot" + "test": "mocha --bail --recursive --reporter dot", + "clean": "rm -r dist/*", + "build:js": "browserify lib/digitalocean.js -o dist/digitalocean.js --standalone 'digitalocean'", + "build": "mkdir -p dist && npm run build:js", + "preversion": "npm test", + "version": "npm run build && git add -A dist", + "release": "git push --follow-tags && npm publish", + "release:patch": "npm version patch -m 'Bump version to %s'", + "release:minor": "npm version minor -m 'Bump version to %s'", + "release:major": "npm version major -m 'Bump version to %s'" }, "dependencies": { "deep-extend": "0.x.x", "request": "2.51.x" }, "devDependencies": { + "bower": ">= 0.0.0", + "browserify": "^13.0.0", "chai": "~1.10.0", "mocha": "~2.1.0", "mocha-jshint": "^2.3.1",