8
0

dev-init.js 1.2 KB

123456789101112131415161718192021222324252627282930313233
  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 tools = require( './tools' );
  7. /**
  8. * 1. Get CKEditor5 dependencies from package.json file.
  9. * 2. Run install task on each dependency.
  10. *
  11. * @param {Function} installTask Install task to use on each dependency.
  12. * @param {String} ckeditor5Path Path to main CKEditor5 repository.
  13. * @param {Object} packageJSON Parsed package.json file from CKEditor5 repository.
  14. * @param {String} workspaceRoot Relative path to workspace root.
  15. * @param {Function} writeln Function for log output.
  16. */
  17. module.exports = ( installTask, ckeditor5Path, packageJSON, workspaceRoot, writeln ) => {
  18. // Get all CKEditor dependencies from package.json.
  19. const dependencies = tools.getCKEditorDependencies( packageJSON.dependencies );
  20. if ( dependencies ) {
  21. for ( let dependency in dependencies ) {
  22. const repositoryURL = dependencies[ dependency ];
  23. writeln( `\x1b[1m\x1b[36m${ dependency }\x1b[0m` );
  24. installTask( ckeditor5Path, workspaceRoot, repositoryURL, writeln );
  25. }
  26. } else {
  27. writeln( 'No CKEditor5 dependencies (ckeditor5-) found in package.json file.' );
  28. }
  29. };