gulpfile.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* jshint browser: false, node: true, strict: true */
  6. 'use strict';
  7. const gulp = require( 'gulp' );
  8. const runSequence = require( 'run-sequence' );
  9. const config = {
  10. ROOT_DIR: '.',
  11. BUILD_DIR: 'build',
  12. BUNDLE_DIR: 'bundle',
  13. WORKSPACE_DIR: '..',
  14. // Files ignored by jshint and jscs tasks. Files from .gitignore will be added automatically during tasks execution.
  15. IGNORED_FILES: [
  16. 'src/lib/**'
  17. ]
  18. };
  19. require( './dev/tasks/build/tasks' )( config ).register();
  20. require( './dev/tasks/test/tasks' )( config ).register();
  21. require( './dev/tasks/docs/tasks' )( config ).register();
  22. // Lint tasks.
  23. const ckeditor5Lint = require( 'ckeditor5-dev-lint' )( config );
  24. gulp.task( 'lint', ckeditor5Lint.lint );
  25. gulp.task( 'lint-staged', ckeditor5Lint.lintStaged );
  26. gulp.task( 'default', [ 'build' ] );
  27. gulp.task( 'pre-commit', [ 'lint-staged' ] );
  28. // Development environment tasks.
  29. const ckeditor5DevEnv = require( 'ckeditor5-dev-env' )( config );
  30. gulp.task( 'init', ckeditor5DevEnv.initRepository );
  31. gulp.task( 'create-package', ckeditor5DevEnv.createPackage );
  32. gulp.task( 'update', ckeditor5DevEnv.updateRepositories );
  33. gulp.task( 'pull', ckeditor5DevEnv.updateRepositories );
  34. gulp.task( 'status', ckeditor5DevEnv.checkStatus );
  35. gulp.task( 'st', ckeditor5DevEnv.checkStatus );
  36. gulp.task( 'relink', ckeditor5DevEnv.relink );
  37. gulp.task( 'install', ckeditor5DevEnv.installPackage );
  38. gulp.task( 'exec', ckeditor5DevEnv.execOnRepositories );
  39. // Bundling tasks.
  40. const ckeditor5DevBundle = require( 'ckeditor5-dev-bundler-rollup' )( config );
  41. gulp.task( 'bundle:clean', ckeditor5DevBundle.clean );
  42. gulp.task( 'bundle:generate',
  43. [
  44. 'bundle:clean',
  45. 'build:js:esnext',
  46. 'build:themes:esnext'
  47. ],
  48. ckeditor5DevBundle.generateFromConfig
  49. );
  50. gulp.task( 'bundle:minify:js', ckeditor5DevBundle.minify.js );
  51. gulp.task( 'bundle:minify:css', ckeditor5DevBundle.minify.css );
  52. gulp.task( 'bundle', ( callback ) => {
  53. runSequence( 'bundle:generate',
  54. [
  55. 'bundle:minify:js',
  56. 'bundle:minify:css'
  57. ],
  58. () => ckeditor5DevBundle.showSummary( callback )
  59. );
  60. } );