Gruntfile.ls 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. require! <[./build fs ./config]>
  2. library-tests = <[client/library.js tests/helpers.js tests/library.js]>map -> src: it
  3. module.exports = (grunt)->
  4. grunt.loadNpmTasks \grunt-contrib-clean
  5. grunt.loadNpmTasks \grunt-contrib-copy
  6. grunt.loadNpmTasks \grunt-contrib-uglify
  7. grunt.loadNpmTasks \grunt-contrib-watch
  8. grunt.loadNpmTasks \grunt-livescript
  9. grunt.loadNpmTasks \grunt-karma
  10. grunt.initConfig do
  11. pkg: grunt.file.readJSON './package.json'
  12. uglify: build:
  13. files: '<%=grunt.option("path")%>.min.js': '<%=grunt.option("path")%>.js'
  14. options:
  15. mangle: {+sort, +keep_fnames}
  16. compress: {+pure_getters, +keep_fargs, +keep_fnames}
  17. sourceMap: on
  18. banner: config.banner
  19. livescript: src: files:
  20. './tests/helpers.js': './tests/helpers/*'
  21. './tests/tests.js': './tests/tests/*'
  22. './tests/library.js': './tests/library/*'
  23. './tests/es.js': './tests/tests/es*'
  24. './tests/experimental.js': './tests/experimental/*'
  25. './build/index.js': './build/build.ls*'
  26. clean: <[./library]>
  27. copy: lib: files:
  28. * expand: on
  29. cwd: './'
  30. src: <[es5/** es6/** es7/** js/** web/** core/** fn/** index.js shim.js]>
  31. dest: './library/'
  32. * expand: on
  33. cwd: './'
  34. src: <[modules/*]>
  35. dest: './library/'
  36. filter: \isFile
  37. * expand: on
  38. cwd: './modules/library/'
  39. src: '*'
  40. dest: './library/modules/'
  41. watch:
  42. core:
  43. files: './modules/*'
  44. tasks: \default
  45. tests:
  46. files: './tests/tests/*'
  47. tasks: \livescript
  48. karma:
  49. 'options':
  50. configFile: './tests/karma.conf.js'
  51. browsers: <[PhantomJS]>
  52. singleRun: on
  53. 'continuous': {}
  54. 'continuous-library':
  55. files: library-tests
  56. grunt.registerTask \build (options)->
  57. done = @async!
  58. err, it <- build {
  59. modules: (options || 'es5,es6,es7,js,web,core')split \,
  60. blacklist: (grunt.option(\blacklist) || '')split \,
  61. library: !!grunt.option \library
  62. }
  63. if err
  64. console.error err
  65. process.exit 1
  66. grunt.option(\path) || grunt.option(\path, './custom')
  67. fs.writeFile grunt.option(\path) + '.js', it, done
  68. grunt.registerTask \client ->
  69. grunt.option \library ''
  70. grunt.option \path './client/core'
  71. grunt.task.run <[build:es5,es6,es7,js,web,core uglify]>
  72. grunt.registerTask \library ->
  73. grunt.option \library 'true'
  74. grunt.option \path './client/library'
  75. grunt.task.run <[build:es5,es6,es7,js,web,core uglify]>
  76. grunt.registerTask \shim ->
  77. grunt.option \library ''
  78. grunt.option \path './client/shim'
  79. grunt.task.run <[build:es5,es6,es7,js,web uglify]>
  80. grunt.registerTask \e ->
  81. grunt.option \library ''>
  82. grunt.option \path './client/core'
  83. grunt.task.run <[build:es5,es6,es7,js,web,core,exp uglify]>
  84. grunt.registerTask \default <[clean copy client library shim]>