Skip to content

Commit

Permalink
Add test browserify build. Update README with instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
briancavalier committed Dec 2, 2013
1 parent 0f9b031 commit 8dee90b
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,4 +1,4 @@
.idea/
experiments/
node_modules/
.externs.js
build/when.js
8 changes: 2 additions & 6 deletions .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
26 changes: 9 additions & 17 deletions README.md
Expand Up @@ -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 `<script>` element for when.js

```html
<script>
window.define = function(factory) {
try{ delete window.define; } catch(e){ window.define = void 0; } // IE
window.when = factory();
};
window.define.amd = {};
</script>
<script src="path/to/when/when.js"></script>
```

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. `<script src="path/to/when/build/when.js"></script>`
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
----------------------
Expand Down
21 changes: 21 additions & 0 deletions 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 <brian@hovercraftstudios.com>"
],
"license": "MIT",
"ignore": [
"**/.*",
"docs",
"experiments",
"node_modules",
"bower_components",
"test",
"build"
]
}
3 changes: 3 additions & 0 deletions build/when.browserify-debug.js
@@ -0,0 +1,3 @@
require('../monitor/console');
module.exports = require('./when.browserify.js');

14 changes: 14 additions & 0 deletions 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');
7 changes: 5 additions & 2 deletions package.json
Expand Up @@ -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"] },
Expand All @@ -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"
}
}

0 comments on commit 8dee90b

Please sign in to comment.