Gruntfile.ls 2.9 KB

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