Gruntfile.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. module.exports = function(grunt) {
  2. require('load-grunt-tasks')(grunt);
  3. grunt.loadNpmTasks('grunt-execute');
  4. grunt.loadNpmTasks('grunt-contrib-clean');
  5. grunt.initConfig({
  6. clean: ["dist"],
  7. copy: {
  8. src_to_dist: {
  9. cwd: 'src',
  10. expand: true,
  11. src: ['**/*', '!**/*.js', '!**/*.scss'],
  12. dest: 'dist'
  13. },
  14. pluginDef: {
  15. expand: true,
  16. src: ['README.md'],
  17. dest: 'dist'
  18. }
  19. },
  20. watch: {
  21. rebuild_all: {
  22. files: ['src/**/*'],
  23. tasks: ['default'],
  24. options: {spawn: false}
  25. }
  26. },
  27. babel: {
  28. options: {
  29. sourceMap: true,
  30. presets: ['es2015']
  31. },
  32. dist: {
  33. options: {
  34. plugins: ['transform-es2015-modules-systemjs', 'transform-es2015-for-of']
  35. },
  36. files: [{
  37. cwd: 'src',
  38. expand: true,
  39. src: ['**/*.js'],
  40. dest: 'dist',
  41. ext:'.js'
  42. }]
  43. },
  44. distTestNoSystemJs: {
  45. files: [{
  46. cwd: 'src',
  47. expand: true,
  48. src: ['**/*.js'],
  49. dest: 'dist/test',
  50. ext:'.js'
  51. }]
  52. },
  53. distTestsSpecsNoSystemJs: {
  54. files: [{
  55. expand: true,
  56. cwd: 'spec',
  57. src: ['**/*.js'],
  58. dest: 'dist/test/spec',
  59. ext:'.js'
  60. }]
  61. }
  62. },
  63. mochaTest: {
  64. test: {
  65. options: {
  66. reporter: 'spec'
  67. },
  68. src: ['dist/test/spec/test-main.js', 'dist/test/spec/*_spec.js']
  69. }
  70. }
  71. });
  72. grunt.registerTask('default', ['clean', 'copy:src_to_dist', 'copy:pluginDef', 'babel', 'mochaTest']);
  73. };