threepipe
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.

each-plugin.mjs 881B

2 years ago
2 years ago
1 year ago
12345678910111213141516171819202122232425262728293031
  1. import {execEachPlugin, execEachPluginParallel} from './utils.mjs';
  2. const args = process.argv.slice(2);
  3. const command = args.join(' ');
  4. if (!command) {
  5. throw new Error('Command is required');
  6. }
  7. // Check if parallel flag is provided
  8. const isParallel = args.includes('--parallel') || args.includes('-p');
  9. const cleanCommand = command.replace(/--parallel|-p/g, '').trim();
  10. if (!cleanCommand) {
  11. throw new Error('Command is required');
  12. }
  13. console.log(`Executing '${cleanCommand}' in all plugins${isParallel ? ' (parallel mode)' : ''}`);
  14. try {
  15. if (isParallel) {
  16. // Use parallel execution
  17. await execEachPluginParallel(cleanCommand);
  18. } else {
  19. // Use sequential execution (original behavior)
  20. execEachPlugin(`npm ${cleanCommand}`);
  21. }
  22. } catch (error) {
  23. console.error('❌ Execution failed:', error.message);
  24. process.exit(1);
  25. }