Skip to content

Commit

Permalink
Merge pull request #2 from cayasso/master
Browse files Browse the repository at this point in the history
[Fix] removing browserbuild dependency
  • Loading branch information
swissmanu committed Jan 25, 2014
2 parents 566ac9e + d28226d commit 265c5da
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 194 deletions.
16 changes: 2 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
MAIN = index.js
GLOBAL = 'var PrimusResponder'
FILE = build/primus-responder.client.js

build:
@[ -d build ] || mkdir build
@./node_modules/.bin/browserbuild \
--main $(MAIN) \
--global $(GLOBAL) \
--basepath lib/client/ `find lib/client -name '*.js'` \
> $(FILE)

lint:
@./node_modules/.bin/jshint \
lib/

test: build
test:
@./node_modules/.bin/mocha \
--reporter spec

.PHONY: build lint test
.PHONY: lint test
168 changes: 0 additions & 168 deletions build/primus-responder.client.js

This file was deleted.

17 changes: 16 additions & 1 deletion lib/client/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/* global Primus, window */


function responder() {

var init = Primus.prototype.initialise
, responseCallbacks = {};

Expand Down Expand Up @@ -162,4 +165,16 @@ var generateGUID = (typeof(window) !== 'undefined' &&
return v.toString(16);
}
);
};
};

}

responder.source = [
';(function (Primus, undefined) {',
'if (undefined === Primus) return;',
responder.toString(),
'responder();',
'})(Primus);'
].join('\n');

module.exports = responder;
25 changes: 16 additions & 9 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
var fs = require('fs')
, path = require('path')
, file = path.join(__dirname, '..', 'build', 'primus-responder.client.js')
, library = fs.readFileSync(file, 'utf-8')
, PrimusResponder = require('./server');
'use strict';

/**
* Module dependencies.
*/

var ResponderServer = require('./server')
, ResponderClient = require('./client');

/**
* Expose modules.
*/

module.exports = {
library: library
, client: function() {}
, server: PrimusResponder
, PrimusResponder: PrimusResponder
client: function(){}
, server: ResponderServer
, library: ResponderClient.source
, PrimusResponder: ResponderServer
};
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "Request-Response ortiented communication for websockets with Primus.",
"main": "index.js",
"scripts": {
"build": "make build",
"test": "make test"
},
"repository": {
Expand All @@ -23,7 +22,6 @@
"url": "https://github.com/swissmanu/primus-responder/issues"
},
"dependencies": {
"browserbuild": "~0.7.0",
"debug": "~0.7.2"
}
, "devDependencies": {
Expand Down

0 comments on commit 265c5da

Please sign in to comment.