Front end of the Slack clone application.

gulpfile.babel.js 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // Copyright (C) 2014 Yusuke Suzuki <utatane.tea@gmail.com>
  2. //
  3. // Redistribution and use in source and binary forms, with or without
  4. // modification, are permitted provided that the following conditions are met:
  5. //
  6. // * Redistributions of source code must retain the above copyright
  7. // notice, this list of conditions and the following disclaimer.
  8. // * Redistributions in binary form must reproduce the above copyright
  9. // notice, this list of conditions and the following disclaimer in the
  10. // documentation and/or other materials provided with the distribution.
  11. //
  12. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  13. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  14. // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  15. // ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  16. // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  17. // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  18. // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  20. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  21. // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. import gulp from 'gulp';
  23. import mocha from 'gulp-mocha';
  24. import eslint from 'gulp-eslint';
  25. import minimist from 'minimist';
  26. import git from 'gulp-git';
  27. import bump from 'gulp-bump';
  28. import filter from 'gulp-filter';
  29. import tagVersion from 'gulp-tag-version';
  30. import 'babel-register';
  31. const SOURCE = [
  32. '*.js'
  33. ];
  34. let ESLINT_OPTION = {
  35. parser: 'babel-eslint',
  36. parserOptions: {
  37. 'sourceType': 'module'
  38. },
  39. rules: {
  40. 'quotes': 0,
  41. 'eqeqeq': 0,
  42. 'no-use-before-define': 0,
  43. 'no-shadow': 0,
  44. 'no-new': 0,
  45. 'no-underscore-dangle': 0,
  46. 'no-multi-spaces': 0,
  47. 'no-native-reassign': 0,
  48. 'no-loop-func': 0
  49. },
  50. env: {
  51. 'node': true
  52. }
  53. };
  54. gulp.task('test', function() {
  55. let options = minimist(process.argv.slice(2), {
  56. string: 'test',
  57. default: {
  58. test: 'test/*.js'
  59. }
  60. }
  61. );
  62. return gulp.src(options.test).pipe(mocha({reporter: 'spec'}));
  63. });
  64. gulp.task('lint', () =>
  65. gulp.src(SOURCE)
  66. .pipe(eslint(ESLINT_OPTION))
  67. .pipe(eslint.formatEach('stylish', process.stderr))
  68. .pipe(eslint.failOnError())
  69. );
  70. let inc = importance =>
  71. gulp.src(['./package.json'])
  72. .pipe(bump({type: importance}))
  73. .pipe(gulp.dest('./'))
  74. .pipe(git.commit('Bumps package version'))
  75. .pipe(filter('package.json'))
  76. .pipe(tagVersion({
  77. prefix: ''
  78. }))
  79. ;
  80. gulp.task('travis', [ 'lint', 'test' ]);
  81. gulp.task('default', [ 'travis' ]);
  82. gulp.task('patch', [ ], () => inc('patch'));
  83. gulp.task('minor', [ ], () => inc('minor'));
  84. gulp.task('major', [ ], () => inc('major'));