hereby 1.0.5 → 1.0.6

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/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import chalk from "chalk";
2
+ import { closest, distance } from "fastest-levenshtein";
2
3
  import path from "path";
3
4
  import { formatTasks } from "./formatTasks.js";
4
5
  import { findHerebyfile, loadHerebyfile } from "./loadHerebyfile.js";
@@ -62,7 +63,12 @@ export function selectTasks(herebyfile, taskNames) {
62
63
  return taskNames.map((name) => {
63
64
  const task = allTasks.get(name);
64
65
  if (!task) {
65
- throw new UserError(`Task "${name}" does not exist or is not exported in the Herebyfile.`);
66
+ let message = `Task "${name}" does not exist or is not exported in the Herebyfile.`;
67
+ const candidate = closest(name, Array.from(allTasks.keys()));
68
+ if (distance(name, candidate) < name.length * 0.4) {
69
+ message += ` Did you mean "${candidate}?"`;
70
+ }
71
+ throw new UserError(message);
66
72
  }
67
73
  return task;
68
74
  });
package/dist/cli/utils.js CHANGED
@@ -36,11 +36,11 @@ export class ExitCodeError {
36
36
  this.reason = reason;
37
37
  }
38
38
  }
39
- /* eslint-disable no-restricted-globals */
40
39
  export async function real() {
41
40
  const { default: foregroundChild } = await import("foreground-child");
42
41
  const { resolve } = await import("import-meta-resolve");
43
42
  const { default: prettyMilliseconds } = await import("pretty-ms");
43
+ /* eslint-disable no-restricted-globals */
44
44
  return {
45
45
  log: console.log,
46
46
  error: console.error,
@@ -59,6 +59,6 @@ export async function real() {
59
59
  resolve,
60
60
  prettyMilliseconds,
61
61
  };
62
+ /* eslint-enable no-restricted-globals */
62
63
  }
63
- /* eslint-enable no-restricted-globals */
64
64
  //# sourceMappingURL=utils.js.map
package/dist/runner.js CHANGED
@@ -1,8 +1,12 @@
1
- import PQueue from "p-queue";
1
+ import pLimit from "p-limit";
2
2
  export class Runner {
3
3
  constructor(options) {
4
4
  this._addedTasks = new WeakMap();
5
- this._queue = new PQueue({ concurrency: options?.concurrency ?? Infinity });
5
+ this._limiter = (fn) => fn();
6
+ const concurrency = options?.concurrency;
7
+ if (concurrency !== undefined) {
8
+ this._limiter = pLimit(concurrency);
9
+ }
6
10
  }
7
11
  async runTasks(...tasks) {
8
12
  await Promise.all(tasks.map((task) => {
@@ -24,7 +28,7 @@ export class Runner {
24
28
  if (!run) {
25
29
  return;
26
30
  }
27
- return this._queue.add(async () => {
31
+ return this._limiter(async () => {
28
32
  try {
29
33
  this.onTaskStart?.(task);
30
34
  await run();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hereby",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "A simple task runner",
5
5
  "repository": "github:jakebailey/hereby",
6
6
  "type": "module",
@@ -41,9 +41,10 @@
41
41
  "chalk": "^5.0.1",
42
42
  "command-line-args": "^5.2.1",
43
43
  "command-line-usage": "^6.1.3",
44
+ "fastest-levenshtein": "^1.0.16",
44
45
  "foreground-child": "^2.0.0",
45
46
  "import-meta-resolve": "^2.1.0",
46
- "p-queue": "^7.3.0",
47
+ "p-limit": "^4.0.0",
47
48
  "pretty-ms": "^8.0.0"
48
49
  },
49
50
  "devDependencies": {
@@ -51,22 +52,22 @@
51
52
  "@tsconfig/node14": "^1.0.3",
52
53
  "@types/command-line-args": "^5.2.0",
53
54
  "@types/command-line-usage": "^5.0.2",
54
- "@types/node": "^14.18.24",
55
- "@typescript-eslint/eslint-plugin": "^5.33.1",
56
- "@typescript-eslint/parser": "^5.33.1",
57
- "ava": "^4.3.1",
55
+ "@types/node": "^14.18.28",
56
+ "@typescript-eslint/eslint-plugin": "^5.36.2",
57
+ "@typescript-eslint/parser": "^5.36.2",
58
+ "ava": "^4.3.3",
58
59
  "c8": "^7.12.0",
59
- "eslint": "^8.22.0",
60
+ "eslint": "^8.23.0",
60
61
  "eslint-config-prettier": "^8.5.0",
61
62
  "eslint-plugin-ava": "^13.2.0",
62
- "eslint-plugin-simple-import-sort": "^7.0.0",
63
+ "eslint-plugin-simple-import-sort": "^8.0.0",
63
64
  "execa": "^6.1.0",
64
65
  "moq.ts": "^9.0.2",
65
66
  "prettier": "^2.7.1",
66
- "release-it": "^15.3.0",
67
+ "release-it": "^15.4.1",
67
68
  "rimraf": "^3.0.2",
68
69
  "tempy": "^3.0.0",
69
- "typescript": "^4.7.4"
70
+ "typescript": "~4.8.3"
70
71
  },
71
72
  "packageManager": "npm@8.17.0",
72
73
  "volta": {