From 661aa22c03f829489e2d9289dee0a8292a95227a Mon Sep 17 00:00:00 2001 From: David Sherret Date: Tue, 19 Nov 2024 07:45:09 -0500 Subject: feat(task): dependencies (#26467) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds support for "dependencies" in `deno task` subcommand: ```jsonc { "tasks": { "build": "deno run -RW build.ts", "generate": "deno run -RW generate.ts", "serve": { "command": "deno run -RN server.ts", "dependencies": ["build", "generate"] } } } ``` Executing `deno task serve` will first execute `build` and `generate` tasks (in parallel) and once both complete the `serve` task will be executed. Number of tasks run in parallel is equal to the no of cores on the machine, and respects `DENO_JOBS` env var if one is specified. Part of https://github.com/denoland/deno/issues/26462 --------- Co-authored-by: Bartek IwaƄczuk Co-authored-by: Marvin Hagemeister --- tests/specs/task/dependencies/util.js | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 tests/specs/task/dependencies/util.js (limited to 'tests/specs/task/dependencies/util.js') diff --git a/tests/specs/task/dependencies/util.js b/tests/specs/task/dependencies/util.js new file mode 100644 index 000000000..9579eb9c9 --- /dev/null +++ b/tests/specs/task/dependencies/util.js @@ -0,0 +1,4 @@ +export async function randomTimeout(min, max) { + const timeout = Math.floor(Math.random() * (max - min + 1) + min); + return new Promise((resolve) => setTimeout(resolve, timeout)); +} -- cgit v1.2.3