8
0

dev.js 992 B

123456789101112131415161718192021222324252627282930313233343536
  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. var ckeditor5Path = process.cwd();
  9. module.exports = ( grunt ) => {
  10. const packageJSON = grunt.config.data.pkg;
  11. grunt.registerTask( 'dev-init', function() {
  12. // Get workspace root relative path from configuration and convert it to absolute path.
  13. const options = getOptions( this );
  14. initTask( ckeditor5Path, packageJSON, options, grunt.log.writeln, grunt.log.error );
  15. } );
  16. grunt.registerTask( 'dev-plugin-create', function() {
  17. const done = this.async();
  18. const options = getOptions( this );
  19. pluginCreateTask( ckeditor5Path, options, grunt.log.writeln, grunt.log.error ).then( done );
  20. } );
  21. function getOptions( context ) {
  22. const options = {
  23. workspaceRoot: '..'
  24. };
  25. return context.options( options );
  26. }
  27. };