8
0

dev.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. 'use strict';
  2. var tools = require( './utils/tools' );
  3. var path = require( 'path' );
  4. var ckeditor5Path = process.cwd();
  5. var json = require( path.join( ckeditor5Path, 'package.json' ) );
  6. var dependencies = json.dependencies;
  7. module.exports = function( grunt ) {
  8. grunt.registerTask( 'dev', function( target ) {
  9. var pluginPath;
  10. switch ( target ) {
  11. case 'init':
  12. var ckeDependencies = tools.getCKEditorDependencies( dependencies );
  13. var regexp = /^ckeditor\//;
  14. var location = path.join( ckeditor5Path, '..' );
  15. if ( ckeDependencies ) {
  16. Object.keys( ckeDependencies ).forEach( function( name ) {
  17. // Check if CKEditor GitHub url.
  18. if ( regexp.test( ckeDependencies[ name ] ) ) {
  19. grunt.log.writeln( 'Clonning repository ' + ckeDependencies[ name ] + '...' );
  20. tools.cloneRepository( ckeDependencies[ name ], location );
  21. pluginPath = path.join( location, name );
  22. grunt.log.writeln( 'Linking ' + pluginPath + ' into ' + ckeditor5Path + '...' );
  23. tools.npmLink( pluginPath, ckeditor5Path, name );
  24. }
  25. } );
  26. }
  27. break;
  28. }
  29. } );
  30. };