Gruntfile.ls 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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: {+sort, +keep_fnames}
  15. compress: {+pure_getters, +keep_fargs, +keep_fnames}
  16. sourceMap: on
  17. banner: config.banner
  18. livescript: src: files:
  19. './tests/helpers.js': './tests/helpers/*'
  20. './tests/tests.js': './tests/tests/*'
  21. './tests/library.js': './tests/library/*'
  22. './tests/es.js': './tests/tests/es*'
  23. './tests/experimental.js': './tests/experimental/*'
  24. './build/index.js': './build/build.ls*'
  25. clean: <[./library]>
  26. copy: lib: files:
  27. * expand: on
  28. cwd: './'
  29. src: <[es5/** es6/** es7/** stage/** web/** core/** fn/** index.js shim.js]>
  30. dest: './library/'
  31. * expand: on
  32. cwd: './'
  33. src: <[modules/*]>
  34. dest: './library/'
  35. filter: \isFile
  36. * expand: on
  37. cwd: './modules/library/'
  38. src: '*'
  39. dest: './library/modules/'
  40. watch:
  41. core:
  42. files: './modules/*'
  43. tasks: \default
  44. tests:
  45. files: './tests/tests/*'
  46. tasks: \livescript
  47. karma:
  48. 'options':
  49. configFile: './tests/karma.conf.js'
  50. browsers: <[PhantomJS]>
  51. singleRun: on
  52. 'default': {}
  53. 'library': files: <[client/library.js tests/helpers.js tests/library.js]>map -> src: it
  54. grunt.registerTask \build (options)->
  55. done = @async!
  56. build {
  57. modules: (options || 'es5,es6,es7,js,web,core')split \,
  58. blacklist: (grunt.option(\blacklist) || '')split \,
  59. library: grunt.option(\library) in <[yes on true]>
  60. umd: grunt.option(\umd) not in <[no off false]>
  61. }
  62. .then !->
  63. grunt.option(\path) || grunt.option(\path, './custom')
  64. fs.writeFile grunt.option(\path) + '.js', it, done
  65. .catch !->
  66. console.error it
  67. process.exit 1
  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]>