folke / ultra-runner

🏃⛰ Ultra fast monorepo script runner and build tool
https://www.npmjs.com/package/ultra-runner
Apache License 2.0
1.2k stars 32 forks source link

Question/Suggestion: How to execute multiple task in the same module in parallel? #187

Open Bessonov opened 3 years ago

Bessonov commented 3 years ago

Hey @folke , ultra seems very cool and works in very desired way!

I want to run multiple commands in parallel in one module without install ultra global. For now I use start:all as workaround:

{
  "name": "webpack-monorepo",
  "scripts": {
    "start": "ultra start:all",
    "start:all": "pnpm run start:frontend || pnpm run start:backend || pnpm run start:backend-nodemon",
    "start:frontend": "pnpm --filter frontend start",
    "start:backend": "pnpm --filter backend start:watch",
    "start:backend-nodemon": "pnpm --filter backend start:nodemon",
  },
  "ultra": {
    "concurrent": [
      "start:all"
    ]
  },
  "devDependencies": {
[...]
    "ultra-runner": "3.10.5",
  }
}

It would be great if I could use:

{
  "scripts": {
    "start": "ultra start:*", // runs all tasks below in parallel, doesn't work yet
    "start:frontend": "pnpm --filter frontend start",
    "start:backend": "pnpm --filter backend start:watch",
    "start:backend-nodemon": "pnpm --filter backend start:nodemon"
  },
}

Or even:

{
  "scripts": {
    "start": "ultra --recursive start:*", // runs all tasks in sub-modules beginning with "start:", doesn't work yet
  },
}

Or in my perfect world cleanest way:

root:

{
  "scripts": {
    "start": "ultra --recursive start", // run start in every module, works now
  },
}

backend:

{
  "scripts": {
    "start": "ultra start:watch,start:nodemon", // run both tasks in parallel, doesn't work yet; alternative: "ultra start:*"
    "start:watch": "webpack --watch",
    "start:nodemon": "nodemon ..."
  },
}

frontend: trivial