Replies: 4 comments 7 replies
-
You can create a "wrapper" task that will spawn other tasks in parallel, like so: {
"tasks": {
"foo": "echo 1",
"bar": "echo 2",
"parallel": "deno task foo & deno task bar"
}
}
|
Beta Was this translation helpful? Give feedback.
-
A common thing I do with node is add npm-run-all to dev-deps, so I can do this: {
"scripts": {
"start:frontend": "node frontend.js",
"start:backend": "node backend.js",
"start": "run-p start:frontend start:backend"
}
} If you Ctrl-C, it kills both of them, and There is a bit about a single I was looking into this to combine a webview wrapper with a an ultra backend (including live-reloading) and it seems to work great: {
"tasks": {
"dev:frontend": "deno run -A --no-check --watch ./server.jsx",
"dev:wrapper": "deno run -Ar --unstable deckagog.js",
"dev": "deno task dev:frontend & deno task dev:wrapper"
}
} Ctrl-C kills them both, closing the web window leaves the server running (which can be Ctrl-C'd.) I love that this is built-in! |
Beta Was this translation helpful? Give feedback.
-
So, it sounds like the original suggestion results in 2 processes, only one of which is killed with Ctrl-C. That makes it less than useful. I've used npm-run-all in NodeJS and would like to see something similar in Deno, though I suppose I could use the npm version of npm-run-all in Deno (but I'm on Windows, so maybe that would not work?). Does anyone know of a library in jsr that does this? |
Beta Was this translation helpful? Give feedback.
-
I'm trying to run 2 deno servers with one command.
Looking at how task dependencies work: {
// a
// / \
// b c
// \ /
// d
"tasks": {
"a": {
"command": "deno run a.js",
"dependencies": ["b", "c"]
},
"b": {
"command": "deno run b.js",
"dependencies": ["d"]
},
"c": {
"command": "deno run c.js",
"dependencies": ["d"]
},
"d": "deno run d.js"
}
} I came up with this workaround: {
"workspace": ["./service", "./server"],
"tasks": {
"dev": {
"command": "echo 'No dev task defined'",
"dependencies": ["server:dev", "service:dev"]
},
"server:dev": "cd server && deno task dev",
"service:dev": "cd service && deno task dev"
}
} it ain't pretty, but it does run both tasks in parallel, and shut them both down with |
Beta Was this translation helpful? Give feedback.
-
Is there anyway to run multiple tasks in parallel like is possible with concurrency in node?
Beta Was this translation helpful? Give feedback.
All reactions