gulpfile.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. const path = require( 'path' );
  7. const gulp = require( 'gulp' );
  8. // Lint tasks. ---------------------------------------------------------------
  9. const ckeditor5Lint = require( '@ckeditor/ckeditor5-dev-lint' )();
  10. gulp.task( 'lint', ckeditor5Lint.lint );
  11. gulp.task( 'lint-staged', ckeditor5Lint.lintStaged );
  12. gulp.task( 'pre-commit', [ 'lint-staged' ] );
  13. // Development environment tasks. ---------------------------------------------
  14. const ckeditor5DevEnv = require( '@ckeditor/ckeditor5-dev-env' )( {
  15. workspaceDir: '..'
  16. } );
  17. gulp.task( 'init', ckeditor5DevEnv.initRepository );
  18. gulp.task( 'create-package', ckeditor5DevEnv.createPackage );
  19. gulp.task( 'update', ckeditor5DevEnv.updateRepositories );
  20. gulp.task( 'pull', ckeditor5DevEnv.updateRepositories );
  21. gulp.task( 'status', ckeditor5DevEnv.checkStatus );
  22. gulp.task( 'st', ckeditor5DevEnv.checkStatus );
  23. gulp.task( 'relink', ckeditor5DevEnv.relink );
  24. gulp.task( 'install', ckeditor5DevEnv.installPackage );
  25. gulp.task( 'exec', ckeditor5DevEnv.execOnRepositories );
  26. // Documentation. -------------------------------------------------------------
  27. gulp.task( 'docs', () => {
  28. return require( '@ckeditor/ckeditor5-dev-docs' )
  29. .build( {
  30. readmePath: path.join( process.cwd(), 'README.md' ),
  31. sourceFiles: [
  32. process.cwd() + '/node_modules/ckeditor5-*/src/**/*.@(js|jsdoc)',
  33. '!' + process.cwd() + '/node_modules/ckeditor5-*/src/lib/**/*.js'
  34. ],
  35. destinationPath: path.join( process.cwd(), 'build', 'docs' )
  36. } );
  37. } );
  38. // Tests. ---------------------------------------------------------------------
  39. gulp.task( 'test', () => {
  40. return require( '@ckeditor/ckeditor5-dev-tests' )
  41. .runAutomatedTests( getTestOptions() );
  42. } );
  43. gulp.task( 'test:manual', () => {
  44. return require( '@ckeditor/ckeditor5-dev-tests' )
  45. .runManualTests( getTestOptions() );
  46. } );
  47. function getTestOptions() {
  48. return require( '@ckeditor/ckeditor5-dev-tests' )
  49. .parseArguments( process.argv.slice( 2 ) );
  50. }