dev.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 pluginUpdateTask = require( './utils/dev-update' );
  10. const pluginStatusTask = require( './utils/dev-status' );
  11. const installTask = require( './utils/dev-install' );
  12. const relinkTask = require( './utils/dev-relink' );
  13. const boilerplateUpdateTask = require( './utils/dev-boilerplate-update' );
  14. const ckeditor5Path = process.cwd();
  15. module.exports = ( grunt ) => {
  16. const packageJSON = grunt.config.data.pkg;
  17. const workspaceRoot = grunt.config.data.workspaceRoot;
  18. grunt.registerTask( 'dev-init', function() {
  19. initTask( ckeditor5Path, packageJSON, workspaceRoot, grunt.log.writeln, grunt.log.error );
  20. } );
  21. grunt.registerTask( 'dev-plugin-create', function() {
  22. const done = this.async();
  23. pluginCreateTask( ckeditor5Path, workspaceRoot, grunt.log.writeln )
  24. .then( done )
  25. .catch( ( error ) => done( error ) );
  26. } );
  27. grunt.registerTask( 'dev-plugin-install', function() {
  28. const done = this.async();
  29. pluginInstallTask( ckeditor5Path, workspaceRoot, grunt.log.writeln )
  30. .then( done )
  31. .catch( ( error ) => done( error ) );
  32. } );
  33. grunt.registerTask( 'dev-update', function() {
  34. pluginUpdateTask( ckeditor5Path, packageJSON, workspaceRoot, grunt.log.writeln, grunt.log.error );
  35. } );
  36. grunt.registerTask( 'dev-status', function() {
  37. pluginStatusTask( ckeditor5Path, packageJSON, workspaceRoot, grunt.log.writeln, grunt.log.error );
  38. } );
  39. grunt.registerTask( 'dev-boilerplate-update', function() {
  40. boilerplateUpdateTask( ckeditor5Path, packageJSON, workspaceRoot, grunt.log.writeln, grunt.log.error );
  41. } );
  42. grunt.registerTask( 'dev-relink', function() {
  43. relinkTask( ckeditor5Path, packageJSON, workspaceRoot, grunt.log.writeln, grunt.log.error );
  44. } );
  45. grunt.registerTask( 'dev-install', function( ) {
  46. installTask( ckeditor5Path, workspaceRoot, grunt.option( 'plugin' ), grunt.log.writeln );
  47. } );
  48. };