josh.js icon indicating copy to clipboard operation
josh.js copied to clipboard

add to npm

Open stephenhandley opened this issue 12 years ago • 4 comments

any interest in adding this to NPM so it can get bundled for client side code via browserify or similar libs.

stephenhandley avatar Jul 07 '13 21:07 stephenhandley

Sounds like a good idea. I have no experience with packaging for NPM, especially not client side libs. If you can provide a pull request it would help. Otherwise, if you have some resources on how to proceed at them to the issue and I'll try to get to it.

sdether avatar Jul 07 '13 23:07 sdether

This is very easy. Have a look at this little guide. https://gist.github.com/coolaj86/1318304

I could send a pull request, but it's really no point because the package.json file should be configured by the author.

hooloovooo avatar Dec 21 '15 20:12 hooloovooo

Basically, you'll have a local tool named npm that you use to manage your package.

# Setup your package:
npm init

# Make it modular...
git add ...
git commit -m "..."

# Publish
npm publish

With modular, I mean that your code exports something:

// module.exports is an object. Anything attached to it, is exported.
module.exports = Josh;

You can test if you are in a browser or "modular" environment:

if(typeof module == "object") {
    module.exports = ...;
} else {
    window.something = ...;
}

IngwiePhoenix avatar Dec 21 '15 20:12 IngwiePhoenix

Well NPM is the package manager of Node.js. So if you have node.js installed it comes with that.

hooloovooo avatar Dec 21 '15 22:12 hooloovooo