threepipe
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

each-plugin.mjs 881B

1年前
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. }