Publish to NPM
Opened this issue · 12 comments
It would be nice to be able to use this module via npm / browserify
Related to #25
+1
I am in favour of publishing to npm, but I don't know how to do it. So it's waiting until I have time to read about it.
Hopefully it's really easy to do it: https://gist.github.com/coolaj86/1318304
So 2 command lines :) you can even automate the process with Travis CI
Ok, thanks, that's a useful link. So I just tried it quickly, and it errors out.
npm ERR! publish Failed PUT 403
npm ERR! Error: forbidden user: stephband not authorized to modify jquery.event.swipe
It isn't just 2 command lines, like all computing, it takes time to set this stuff up and maintain. I'll have to do it for the jquery.event.move dependency too. So sometime in the future :)
Ah yes true enough, 3 command lines is when there is no problems^^ It possible that there is a level of permissions required or some dependancies lacking. And of course, the Travis automation is by far a better solution for easing the maintenance.
Still, it was worth trying^^
Oh weird, I just tried npm install jquery.event.swipe
(I thought maybe someone else had bagged the package name) and it works! With dependencies! I have obviously registered it at some point in the past, and I don't know my own user credentials at npm :)
So given that it's already on npm, can I close this ticket, or is there something else that needs done?
Looks like someone else published it 8 hours ago.
Oh shit, I published it in a rush. I thought I hadn't done that since I'm not the maintainer. Anyway now I transferred the ownership to you stephband. If you wish to change it, really simple : https://docs.npmjs.com/cli/owner
I think that's why you failed to publish it a moment ago!
Ha! Yes publish works now, thanks.
As a side note, I'm kind of waiting for the whole modules mess to get resolved before diving into package managers and everything. We used requireJS at Cruncher for a while, but it didn't give us much but longer stack traces and more code to maintain, so I ditched it. I'm quite happy using git submodules and managing dependencies myself - as a front-end you have to watch dependencies like a hawk anyway, if you want to keep JS file sizes down, so I'm not yet convinced of their usefulness. When ES6 modules hit the scene I will perk up, because there, hopefully, the community will rally around the One True Way of writing modules and things will get a bit easier.
Hopefully npm will have a hand in that. But my take-away from their recent blog post was "we're not ready yet" (http://blog.npmjs.org/post/101775448305/npm-and-front-end-packaging?utm_source=javascriptweekly&utm_medium=email).
*unless you use browserify :D
Yeah, maybe. Though there is something to be said for Keep It Simple (yeah, I realise the reason for Browserify is to simplify, but ... och, I've run out of reasons. Truth is, we use a few good libraries - localforage, jQuery.cookie, Angular sometimes ... and build on top of those. I got interested in Angular so I wrote a live data binding library which we use now. Sparky: https://github.com/cruncher/sparky. It's pretty good. Only semi-well documented, though.).