From 84e12386480d76e97ad85d9c5314168e7ab03e04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sat, 16 Nov 2024 11:18:17 +0000 Subject: feat(task): support object notation, remove support for JSDocs (#26886) This commit changes three aspects of `deno task`: 1. Tasks can now be written using object notation like so: ```jsonc { "tasks": { "foo": "deno run foo.js", "bar": { "command": "deno run bar.js" } } ``` 2. Support for comments for tasks is now removed. Comments above tasks will no longer be printed when running `deno task`. 3. Tasks written using object notation can have "description" field that replaces support for comments above tasks: ```jsonc { "tasks": { "bar": { "description": "This is a bar task" "command": "deno run bar.js" } } ``` ``` $ deno task Available tasks: - bar // This is a bar task deno run bar.js ``` Pulled most of the changes from https://github.com/denoland/deno/pull/26467 to support "dependencies" in tasks. Additionally some cleanup was performed to make code easier to read. --------- Co-authored-by: David Sherret --- tests/specs/task/description/__test__.jsonc | 4 ++++ tests/specs/task/description/deno.json | 8 ++++++++ tests/specs/task/description/main.out | 4 ++++ 3 files changed, 16 insertions(+) create mode 100644 tests/specs/task/description/__test__.jsonc create mode 100644 tests/specs/task/description/deno.json create mode 100644 tests/specs/task/description/main.out (limited to 'tests/specs/task/description') diff --git a/tests/specs/task/description/__test__.jsonc b/tests/specs/task/description/__test__.jsonc new file mode 100644 index 000000000..100550de0 --- /dev/null +++ b/tests/specs/task/description/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "task", + "output": "main.out" +} diff --git a/tests/specs/task/description/deno.json b/tests/specs/task/description/deno.json new file mode 100644 index 000000000..a86b7a5dc --- /dev/null +++ b/tests/specs/task/description/deno.json @@ -0,0 +1,8 @@ +{ + "tasks": { + "echo_emoji": { + "description": "This is some task", + "command": "echo 1" + } + } +} diff --git a/tests/specs/task/description/main.out b/tests/specs/task/description/main.out new file mode 100644 index 000000000..ed2850656 --- /dev/null +++ b/tests/specs/task/description/main.out @@ -0,0 +1,4 @@ +Available tasks: +- echo_emoji + // This is some task + echo 1 -- cgit v1.2.3