dev.js 1.8 KB

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