hereby 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/formatTasks.js +9 -6
- package/dist/index.d.ts +4 -0
- package/package.json +1 -1
package/dist/cli/formatTasks.js
CHANGED
|
@@ -2,23 +2,26 @@ import chalk from "chalk";
|
|
|
2
2
|
import commandLineUsage from "command-line-usage";
|
|
3
3
|
import { stringSorter, taskSorter } from "./utils.js";
|
|
4
4
|
export function formatTasks(tasks, defaultTask) {
|
|
5
|
-
tasks = tasks
|
|
5
|
+
tasks = tasks
|
|
6
|
+
.slice(0)
|
|
7
|
+
.filter((task) => !task.options.hiddenFromTaskList)
|
|
8
|
+
.sort(taskSorter);
|
|
6
9
|
const sections = [];
|
|
7
10
|
sections.push({
|
|
8
11
|
header: "Available tasks",
|
|
9
12
|
content: tasks.map((task) => {
|
|
10
|
-
const
|
|
11
|
-
const name = task !== defaultTask ? blueName : `${blueName} (default)`;
|
|
13
|
+
const name = task !== defaultTask ? chalk.blue(task.options.name) : `${chalk.green(task.options.name)} (default)`;
|
|
12
14
|
const descriptionParts = [];
|
|
13
15
|
if (task.options.description) {
|
|
14
16
|
descriptionParts.push(task.options.description);
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
const deps = task.options.dependencies?.filter((task) => !task.options.hiddenFromTaskList);
|
|
19
|
+
if (deps && deps.length > 0) {
|
|
20
|
+
const depNames = deps
|
|
18
21
|
.map((task) => task.options.name)
|
|
19
22
|
.sort(stringSorter)
|
|
20
23
|
.map((v) => chalk.blue(v));
|
|
21
|
-
descriptionParts.push(`Depends on: ${
|
|
24
|
+
descriptionParts.push(`Depends on: ${depNames.join(", ")}`);
|
|
22
25
|
}
|
|
23
26
|
return { name, description: descriptionParts.join("\n") };
|
|
24
27
|
}),
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,10 @@ export interface TaskOptions {
|
|
|
21
21
|
* that promise resolves.
|
|
22
22
|
*/
|
|
23
23
|
run?: (() => void) | (() => PromiseLike<void>) | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* If true, this task will be hidden from `hereby --tasks`.
|
|
26
|
+
*/
|
|
27
|
+
hiddenFromTaskList?: boolean | undefined;
|
|
24
28
|
}
|
|
25
29
|
/**
|
|
26
30
|
* A hereby Task. To get an instance, call `test`.
|