You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.6 KiB

  1. /*******************************
  2. Register PM
  3. *******************************/
  4. /*
  5. Task to register component repos with Package Managers
  6. * Registers component with bower
  7. * Registers component with NPM
  8. */
  9. var
  10. // node dependencies
  11. process = require('child_process'),
  12. // config
  13. release = require('../config/admin/release'),
  14. total = release.components.length,
  15. index = -1,
  16. stream,
  17. stepRepo
  18. ;
  19. module.exports = function(callback) {
  20. console.log('Registering repos with package managers');
  21. // Do Git commands synchronously per component, to avoid issues
  22. stepRepo = function() {
  23. index = index + 1;
  24. if(index >= total) {
  25. return;
  26. }
  27. var
  28. component = release.components[index],
  29. outputDirectory = release.outputRoot + component + '/',
  30. capitalizedComponent = component.charAt(0).toUpperCase() + component.slice(1),
  31. packageName = release.packageRoot + component,
  32. repoName = release.repoRoot + capitalizedComponent,
  33. gitURL = 'https://github.com/' + release.org + '/' + repoName + '.git',
  34. exec = process.exec,
  35. execSettings = {cwd: outputDirectory},
  36. registerBower = 'bower register ' + packageName + ' ' + gitURL,
  37. updateNPM = 'npm publish'
  38. ;
  39. /* Register with Bower */
  40. /* One Time
  41. exec(registerBower, execSettings, function(err, stdout, stderr) {
  42. stepRepo();
  43. });
  44. */
  45. /* Register with NPM */
  46. exec(updateNPM, execSettings, function(err, stdout, stderr) {
  47. console.log(err, stdout, stderr);
  48. stepRepo();
  49. });
  50. };
  51. stepRepo();
  52. };