Permalink
Browse files

Add browserify support. Clean up package.

  • Loading branch information...
1 parent 5f292b0 commit 2af7e28535b4b356460886a3f56f71e2f9decdd7 Eric Hamilton committed Nov 27, 2012
Showing with 18 additions and 20 deletions.
  1. +4 −5 dist/browser-cuid.js
  2. +4 −5 dist/node-cuid.js
  3. +2 −1 grunt.js
  4. +4 −4 package.json
  5. +3 −2 src/footer.js
  6. +1 −3 src/head.js
View
9 dist/browser-cuid.js
@@ -10,9 +10,7 @@
* MIT License
*/
-/*global window, navigator, document, require, process*/
-var global = global || this, module = module || undefined;
-
+/*global window, navigator, document, require, process, module */
(function (app) {
'use strict';
var namespace = 'cuid',
@@ -88,9 +86,10 @@ var global = global || this, module = module || undefined;
// don't change anything from here down.
if (app.register) {
app.register(namespace, api);
+ } else if (typeof module !== 'undefined') {
+ module.exports = api;
} else {
- namespace = app.exports ? 'exports' : namespace;
app[namespace] = api;
}
-}(global.applitude || module || this));
+}(this.applitude || this));
View
9 dist/node-cuid.js
@@ -10,9 +10,7 @@
* MIT License
*/
-/*global window, navigator, document, require, process*/
-var global = global || this, module = module || undefined;
-
+/*global window, navigator, document, require, process, module */
(function (app) {
'use strict';
var namespace = 'cuid',
@@ -83,9 +81,10 @@ var global = global || this, module = module || undefined;
// don't change anything from here down.
if (app.register) {
app.register(namespace, api);
+ } else if (typeof module !== 'undefined') {
+ module.exports = api;
} else {
- namespace = app.exports ? 'exports' : namespace;
app[namespace] = api;
}
-}(global.applitude || module || this));
+}(this.applitude || this));
View
3 grunt.js
@@ -46,6 +46,7 @@ module.exports = function(grunt) {
"node-cuid": ['test/node-cuid-test.js']
}
});
- grunt.registerTask('default', 'concat lint qunit test');
+ grunt.registerTask('testall', 'qunit test');
+ grunt.registerTask('default', 'concat lint');
grunt.registerTask('install', 'concat');
};
View
8 package.json
@@ -1,12 +1,13 @@
{
"name": "cuid",
- "version": "1.1.6",
+ "version": "1.1.7",
"description": "Collission-resistant ids optimized for horizontal scaling and performance. For node and browsers.",
"author": {
"name": "Eric Elliott",
"url": "http://ericleads.com"
},
"main": "./dist/node-cuid.js",
+ "browserify": "./dist/browser-cuid.js",
"keywords": [
"uid",
"unique id",
@@ -23,13 +24,12 @@
"src": "./src",
"test": "./test"
},
- "dependencies": {
+ "devDependencies": {
"applitude": "~0.x.x",
"grunt": "~0.3.x"
},
"scripts": {
- "postinstall": "grunt install",
- "test": "grunt"
+ "test": "grunt testall"
},
"engines": {
"node": "~0.x.x"
View
5 src/footer.js
@@ -2,9 +2,10 @@
// don't change anything from here down.
if (app.register) {
app.register(namespace, api);
+ } else if (typeof module !== 'undefined') {
+ module.exports = api;
} else {
- namespace = app.exports ? 'exports' : namespace;
app[namespace] = api;
}
-}(global.applitude || module || this));
+}(this.applitude || this));
View
4 src/head.js
@@ -10,9 +10,7 @@
* MIT License
*/
-/*global window, navigator, document, require, process*/
-var global = global || this, module = module || undefined;
-
+/*global window, navigator, document, require, process, module */
(function (app) {
'use strict';
var namespace = 'cuid',

0 comments on commit 2af7e28

Please sign in to comment.