hereby 1.3.0 → 1.4.0

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/bin/hereby.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import "../dist/cli.js";
@@ -1,11 +1,14 @@
1
1
  import chalk from "chalk";
2
2
  import commandLineUsage from "command-line-usage";
3
3
  import { stringSorter, taskSorter } from "./utils.js";
4
- export function formatTasks(tasks, defaultTask) {
4
+ export function formatTasks(format, tasks, defaultTask) {
5
5
  tasks = tasks
6
6
  .slice(0)
7
7
  .filter((task) => !task.options.hiddenFromTaskList)
8
8
  .sort(taskSorter);
9
+ if (format === "simple") {
10
+ return tasks.map((task) => task.options.name).join("\n");
11
+ }
9
12
  const sections = [];
10
13
  sections.push({
11
14
  header: "Available tasks",
@@ -15,13 +18,13 @@ export function formatTasks(tasks, defaultTask) {
15
18
  if (task.options.description) {
16
19
  descriptionParts.push(task.options.description);
17
20
  }
18
- if (task.options.dependencies && task.options.dependencies.length > 0) {
19
- const deps = task.options.dependencies
20
- .filter((task) => !task.options.hiddenFromTaskList)
21
+ const deps = task.options.dependencies?.filter((task) => !task.options.hiddenFromTaskList);
22
+ if (deps && deps.length > 0) {
23
+ const depNames = deps
21
24
  .map((task) => task.options.name)
22
25
  .sort(stringSorter)
23
26
  .map((v) => chalk.blue(v));
24
- descriptionParts.push(`Depends on: ${deps.join(", ")}`);
27
+ descriptionParts.push(`Depends on: ${depNames.join(", ")}`);
25
28
  }
26
29
  return { name, description: descriptionParts.join("\n") };
27
30
  }),
package/dist/cli/index.js CHANGED
@@ -40,10 +40,12 @@ async function mainWorker(d) {
40
40
  return;
41
41
  }
42
42
  d.chdir(path.dirname(herebyfilePath));
43
- d.log(`Using ${simplifyPath(herebyfilePath)}`);
43
+ if (!args.printTasks) {
44
+ d.log(`Using ${simplifyPath(herebyfilePath)}`);
45
+ }
44
46
  const herebyfile = await loadHerebyfile(herebyfilePath);
45
47
  if (args.printTasks) {
46
- d.log(formatTasks(herebyfile.tasks, herebyfile.defaultTask));
48
+ d.log(formatTasks(args.printTasks, herebyfile.tasks, herebyfile.defaultTask));
47
49
  return;
48
50
  }
49
51
  const tasks = selectTasks(herebyfile, args.run);
@@ -9,6 +9,7 @@ export function parseArgs(argv) {
9
9
  { name: "run", multiple: true, defaultOption: true, type: String },
10
10
  { name: "herebyfile", type: String },
11
11
  { name: "tasks", alias: "T", type: Boolean },
12
+ { name: "tasks-simple", type: Boolean },
12
13
  { name: "help", alias: "h", type: Boolean },
13
14
  { name: "version", type: Boolean },
14
15
  ], {
@@ -19,7 +20,7 @@ export function parseArgs(argv) {
19
20
  help: options["help"],
20
21
  run: options["run"],
21
22
  herebyfile: options["herebyfile"],
22
- printTasks: options["tasks"],
23
+ printTasks: options["tasks"] ? "normal" : options["tasks-simple"] ? "simple" : undefined,
23
24
  version: options["version"],
24
25
  };
25
26
  }
package/dist/cli.js CHANGED
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env node
2
1
  import { main } from "./cli/index.js";
3
2
  import { real } from "./cli/utils.js";
4
3
  await main(await real());
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "hereby",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "A simple task runner",
5
5
  "repository": "github:jakebailey/hereby",
6
6
  "type": "module",
7
- "bin": "./dist/cli.js",
7
+ "bin": "./bin/hereby.js",
8
8
  "main": "./dist/index.js",
9
9
  "types": "./dist/index.d.ts",
10
10
  "exports": {