openexchangerates / accounting.js

A lightweight JavaScript library for number, money and currency formatting - fully localisable, zero dependencies.
http://openexchangerates.github.io/accounting.js
MIT License
4.95k stars 532 forks source link

Package for NPM #2

Closed mhemesath closed 12 years ago

mhemesath commented 13 years ago

It would be terrific if this were packaged on NPM.

wjcrowcroft commented 13 years ago

Yeah, that's interesting - I'll do some reading about how to package things up for npm while I'm on holiday and try to do it for the next release in a few weeks.

I'm also packaging it up as a requireJS module (not too much needed there) so I suppose it's a relatively similar process.

Thanks!

mhemesath commented 13 years ago

If you want any help, let me know. I think there are several ways to tackle this:

  1. Check for the module object, if it exists, assign account to it, else assign accounting to the window object.
  2. Create a task that generates the module file from the source file by appending a module.exports statement to it
  3. Create a task that generates the client and client minified versions from the module file.
wjcrowcroft commented 12 years ago

Just published accounting.js to npm, you can install it with npm install accounting.

eg:

var accounting = require("accounting");
// use accounting library methods just the same as in the browser