You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
624 B

7 years ago
  1. fs = require 'fs'
  2. CoffeeScript = require 'coffee-script'
  3. nodeunit = require 'nodeunit'
  4. UglifyJS = require 'uglify-js'
  5. task 'build', 'build the JavaScript files from CoffeeScript source', build = (cb) ->
  6. source = fs.readFileSync 'src/ipaddr.coffee'
  7. fs.writeFileSync 'lib/ipaddr.js', CoffeeScript.compile source.toString()
  8. invoke 'test'
  9. invoke 'compress'
  10. task 'test', 'run the bundled tests', (cb) ->
  11. nodeunit.reporters.default.run ['test']
  12. task 'compress', 'uglify the resulting javascript', (cb) ->
  13. result = UglifyJS.minify('lib/ipaddr.js')
  14. fs.writeFileSync('ipaddr.min.js', result.code)