millermedeiros / js-signals

Custom Event/Messaging system for JavaScript inspired by AS3-Signals
http://millermedeiros.github.com/js-signals/
1.97k stars 179 forks source link

Distribute browser version signals via npm as well #23

Closed mrjjwright closed 13 years ago

mrjjwright commented 13 years ago

I use npm to manage many of my client packages so if you distribute the browser based version of js-signals via NPM that would be great. No biggie though and thanks for this great lib!

millermedeiros commented 13 years ago

not sure how to do that.. do you have any example of another project that does what you want? I also didn't understood how do you use the NPM files for the browser..

The easiest way that I can think right now is to change the closure wrapper and use the same version for browser and Node... something like this:

(function(exports){
  ...
  exports.signals = signals;
}((typeof module !== 'undefined' && module.exports? module.exports : null) || window || this));

But I'm trying to avoid adding complex wrappers, specially like this one, that's why I created 3 different files.

millermedeiros commented 13 years ago

ohh... now I realized that you just want to keep the regular version of signals inside the package and I excluded it using the .npmignore file...

still not sure how are you using the files and if it makes sense to keep the whole /dist folder since npm is target only for node...

mrjjwright commented 13 years ago

Exactly that will work. I wrote a cake task that parses my package.json dependencies and concatenates a JS file. I wrote a bit of an extension to package.json that specifies whether the file is local or in npm and I look inside node_modules for npm packages. I look inside lib, dist, or the root, so wherever you want to put it.

Thanks!

John Wright Sent with Sparrow

On Wednesday, May 25, 2011 at 10:58 AM, millermedeiros wrote:

ohh... now I realized that you just want to keep the regular version of signals inside the package and I excluded it using the .npmignore file...

still not sure how are you using the files and if it makes sense to keep the whole /dist folder since npm is target only for node...

Reply to this email directly or view it on GitHub: https://github.com/millermedeiros/js-signals/issues/23#comment_1236548