8
0

dev.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. const initTask = require( './utils/dev-init' );
  7. const pluginCreateTask = require( './utils/dev-plugin-create' );
  8. const pluginInstallTask = require( './utils/dev-plugin-install' );
  9. const ckeditor5Path = process.cwd();
  10. module.exports = ( grunt ) => {
  11. const packageJSON = grunt.config.data.pkg;
  12. grunt.registerTask( 'dev-init', function() {
  13. // Get workspace root relative path from configuration and convert it to absolute path.
  14. const options = getOptions( this );
  15. initTask( ckeditor5Path, packageJSON, options, grunt.log.writeln, grunt.log.error );
  16. } );
  17. grunt.registerTask( 'dev-plugin-create', function() {
  18. const done = this.async();
  19. const options = getOptions( this );
  20. pluginCreateTask( ckeditor5Path, options, grunt.log.writeln, grunt.log.error ).then( done );
  21. } );
  22. grunt.registerTask( 'dev-plugin-install', function() {
  23. const done = this.async();
  24. const options = getOptions( this );
  25. pluginInstallTask( ckeditor5Path, options, grunt.log.writeln, grunt.log.error ).then( done );
  26. } );
  27. function getOptions( context ) {
  28. const options = {
  29. workspaceRoot: '..'
  30. };
  31. return context.options( options );
  32. }
  33. };