build.coffee 633 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env coffee
  2. fs = require('fs')
  3. path = require('path')
  4. uglify = require('uglify-js')
  5. browserify = require('browserify')
  6. BANNER = '''
  7. /**
  8. * @fileoverview Text diff library ported from Python's difflib module.
  9. * https://github.com/qiao/difflib.js
  10. */
  11. '''
  12. build = (dest) ->
  13. browserified = browserify.bundle(__dirname + '/../lib/difflib.js')
  14. namespaced = 'var difflib = (function() {' + browserified + 'return require("/difflib");})();'
  15. uglified = uglify(namespaced)
  16. bannered = BANNER + uglified
  17. fs.writeFileSync(dest, bannered)
  18. build(__dirname + '/../dist/difflib-browser.js')