diff --git a/.gitignore b/.gitignore index 3c143659..17cbfa54 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .idea/ experiments/ node_modules/ -.externs.js +build/when.js diff --git a/.npmignore b/.npmignore index c01db569..9c1d3b3b 100644 --- a/.npmignore +++ b/.npmignore @@ -1,16 +1,12 @@ .idea/ -.idea/.name .gitignore/ test/ -projectFilesBackup/ experiments/ -docs -jsdoc -jsdoc3 +docs/ +build/ .npmignore .gitmodules .travis.yml -*.globalized.jsbenchmark/ .jshintrc .jshintignore .editorconfig diff --git a/README.md b/README.md index 8fdabb23..01fc11e2 100644 --- a/README.md +++ b/README.md @@ -47,23 +47,15 @@ Quick Start 1. `ringo-admin install cujojs/when` 1. `var when = require('when');` -#### Legacy environments - -1. `git clone https://github.com/cujojs/when` or `git submodule add https://github.com/cujojs/when` -1. Add a transient `define` shim, and a ` - - ``` - -1. `when` will be available as `window.when` +#### Legacy environments (via browserify) + +1. `git clone https://github.com/cujojs/when` +1. `npm install` - installs [browserify](http://browserify.org) locally +1. `npm run browserify` - generated `build/when.js` + 1. Or `npm run browserify-debug` if you want a build with [when/monitor/console](docs/api.md#debugging-promises) enabled +1. `` + 1. `when` will be available as `window.when` + 1. Other modules will be available as sub-objects/functions, e.g. `window.when.fn.lift`, `window.when.sequence`. See the [full sub-namespace list in the browserify build file](build/when.browserify.js) Running the Unit Tests ---------------------- diff --git a/bower.json b/bower.json new file mode 100644 index 00000000..f764406d --- /dev/null +++ b/bower.json @@ -0,0 +1,21 @@ +{ + "name": "when", + "main": "when.js", + "version": "2.6.0", + "description": "A lightweight Promises/A+ and when() implementation, plus other async goodies.", + "keywords": ["Promises/A+", "promises-aplus", "promise", "promises", "deferred", "deferreds", "when", "async", "asynchronous", "cujo"], + "homepage": "https://github.com/cujojs/when", + "authors": [ + "Brian Cavalier " + ], + "license": "MIT", + "ignore": [ + "**/.*", + "docs", + "experiments", + "node_modules", + "bower_components", + "test", + "build" + ] +} diff --git a/build/when.browserify-debug.js b/build/when.browserify-debug.js new file mode 100644 index 00000000..1f01a4a3 --- /dev/null +++ b/build/when.browserify-debug.js @@ -0,0 +1,3 @@ +require('../monitor/console'); +module.exports = require('./when.browserify.js'); + diff --git a/build/when.browserify.js b/build/when.browserify.js new file mode 100644 index 00000000..a8baf133 --- /dev/null +++ b/build/when.browserify.js @@ -0,0 +1,14 @@ +var when = module.exports = require('../when'); + +when.callbacks = require('../callbacks'); +when.cancelable = require('../cancelable'); +when.delay = require('../delay'); +when.fn = require('../function'); +when.guard = require('../guard'); +when.keys = require('../keys'); +when.nodefn = require('../node/function'); +when.parallel = require('../parallel'); +when.pipeline = require('../pipeline'); +when.poll = require('../poll'); +when.sequence = require('../sequence'); +when.timeout = require('../timeout'); diff --git a/package.json b/package.json index b9bb93a3..d3ca0734 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "test-support": "~0.3", "promises-aplus-tests": "~2", "benchmark": "~1", - "microtime": "~0" + "microtime": "~0", + "browserify": "~2" }, "main": "when", "ender": { "files": ["*.js", "node/*.js", "unfold/*.js", "monitor/*.js"] }, @@ -55,6 +56,8 @@ "ci": "npm test && sauceme", "tunnel": "sauceme -m", "start": "buster static -e browser", - "benchmark": "node benchmark/promise && node benchmark/map" + "benchmark": "node benchmark/promise && node benchmark/map", + "browserify": "browserify -s when build/when.browserify.js -o build/when.js", + "browserify-debug": "browserify -s when build/when.browserify-debug.js -o build/when.js" } }