hereby 1.9.0 → 1.11.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/README.md CHANGED
@@ -102,6 +102,12 @@ a CommonJS project; ES modules can import CommonJS modules.
102
102
  If your package already sets `"type": "module"`, `Herebyfile.js` will work as
103
103
  well.
104
104
 
105
+ ## TypeScript support
106
+
107
+ `hereby` supports `Herebyfile.mts` and `Herebyfile.ts`, so long as your runtime
108
+ supports loading these files. This includes like Node's type stripping, `bun`,
109
+ or even a custom loader, and so on.
110
+
105
111
  ## Caveats
106
112
 
107
113
  ### No serial tasks
package/dist/cli/index.js CHANGED
@@ -49,13 +49,11 @@ async function mainWorker(d) {
49
49
  const taskNames = tasks.map((task) => pc.blue(task.options.name)).join(", ");
50
50
  d.log(`Using ${pc.yellow(d.simplifyPath(herebyfilePath))} to run ${taskNames}`);
51
51
  const start = performance.now();
52
- let errored = false;
52
+ const runner = new Runner(d);
53
53
  try {
54
- const runner = new Runner(d);
55
54
  await runner.runTasks(...tasks);
56
55
  }
57
56
  catch {
58
- errored = true;
59
57
  // We will have already printed some message here.
60
58
  // Set the error code and let the process run to completion,
61
59
  // so we don't end up with an unflushed output.
@@ -63,7 +61,12 @@ async function mainWorker(d) {
63
61
  }
64
62
  finally {
65
63
  const took = performance.now() - start;
66
- d.log(`Completed ${taskNames}${errored ? pc.red(" with errors") : ""} in ${d.prettyMilliseconds(took)}`);
64
+ const failed = runner.failedTasks.length > 0;
65
+ d.log(`Completed ${taskNames}${failed ? pc.red(" with errors") : ""} in ${d.prettyMilliseconds(took)}`);
66
+ if (failed) {
67
+ const names = runner.failedTasks.sort().map((task) => pc.red(task)).join(", ");
68
+ d.log(`Failed tasks: ${names}`);
69
+ }
67
70
  }
68
71
  }
69
72
  // Exported for testing.
@@ -4,7 +4,7 @@ import { pathToFileURL } from "node:url";
4
4
  import pc from "picocolors";
5
5
  import { Task } from "../index.js";
6
6
  import { findUp, UserError } from "./utils.js";
7
- const herebyfileRegExp = /^herebyfile\.m?js$/i;
7
+ const herebyfileRegExp = /^herebyfile\.m?[jt]s$/i;
8
8
  export function findHerebyfile(dir) {
9
9
  const result = findUp(dir, (dir) => {
10
10
  const entries = fs.readdirSync(dir, { withFileTypes: true });
@@ -4,7 +4,7 @@ export class Runner {
4
4
  constructor(_d) {
5
5
  this._d = _d;
6
6
  this._addedTasks = new Map();
7
- this._errored = false;
7
+ this.failedTasks = [];
8
8
  this._startTimes = new Map();
9
9
  }
10
10
  async runTasks(...tasks) {
@@ -44,20 +44,20 @@ export class Runner {
44
44
  }
45
45
  onTaskStart(task) {
46
46
  this._startTimes.set(task, performance.now());
47
- if (this._errored)
47
+ if (this.failedTasks.length > 0)
48
48
  return; // Skip logging.
49
49
  this._d.log(`Starting ${pc.blue(task.options.name)}`);
50
50
  }
51
51
  onTaskFinish(task) {
52
- if (this._errored)
52
+ if (this.failedTasks.length > 0)
53
53
  return; // Skip logging.
54
54
  const took = performance.now() - this._startTimes.get(task);
55
55
  this._d.log(`Finished ${pc.green(task.options.name)} in ${this._d.prettyMilliseconds(took)}`);
56
56
  }
57
57
  onTaskError(task, e) {
58
- if (this._errored)
58
+ this.failedTasks.push(task.options.name);
59
+ if (this.failedTasks.length > 1)
59
60
  return; // Skip logging.
60
- this._errored = true;
61
61
  const took = performance.now() - this._startTimes.get(task);
62
62
  this._d.error(`Error in ${pc.red(task.options.name)} in ${this._d.prettyMilliseconds(took)}\n${e}`);
63
63
  }
package/dist/cli.js CHANGED
@@ -1,6 +1,11 @@
1
- import { main } from "./cli/index.js";
2
- import { real } from "./cli/utils.js";
1
+ import module from "node:module";
2
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
3
+ if (module.enableCompileCache) {
4
+ module.enableCompileCache();
5
+ }
3
6
  async function run() {
7
+ const { main } = await import("./cli/index.js");
8
+ const { real } = await import("./cli/utils.js");
4
9
  await main(await real());
5
10
  }
6
11
  void run();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hereby",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "A simple task runner",
5
5
  "repository": "github:jakebailey/hereby",
6
6
  "type": "module",
@@ -42,32 +42,35 @@
42
42
  "command-line-usage": "^6.1.3",
43
43
  "fastest-levenshtein": "^1.0.16",
44
44
  "minimist": "^1.2.8",
45
- "picocolors": "^1.0.1",
45
+ "picocolors": "^1.1.0",
46
46
  "pretty-ms": "^8.0.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@ava/typescript": "^3.0.1",
50
- "@changesets/cli": "^2.27.7",
51
- "@tsconfig/node12": "^12.1.3",
50
+ "@changesets/cli": "^2.29.3",
51
+ "@codspeed/tinybench-plugin": "^4.0.1",
52
+ "@fast-check/ava": "2.0.1",
53
+ "@tsconfig/node12": "^12.1.4",
52
54
  "@types/command-line-usage": "^5.0.4",
53
55
  "@types/minimist": "^1.2.5",
54
- "@types/node": "^20.14.10",
56
+ "@types/node": "^22.15.17",
55
57
  "@types/tmp": "^0.2.6",
56
- "@typescript-eslint/eslint-plugin": "^7.16.1",
57
- "@typescript-eslint/parser": "^7.16.1",
58
58
  "ava": "~5.0.1",
59
- "c8": "^10.1.2",
60
- "dprint": "^0.47.2",
61
- "eslint": "^8.57.0",
62
- "eslint-plugin-ava": "^14.0.0",
59
+ "c8": "^10.1.3",
60
+ "dprint": "^0.49.1",
61
+ "eslint": "^9.26.0",
62
+ "eslint-plugin-ava": "^15.0.1",
63
63
  "eslint-plugin-simple-import-sort": "^12.1.1",
64
- "eslint-plugin-unicorn": "^54.0.0",
64
+ "eslint-plugin-unicorn": "^59.0.1",
65
65
  "execa": "^6.1.0",
66
- "monocart-coverage-reports": "^2.9.2",
66
+ "globals": "^16.1.0",
67
+ "monocart-coverage-reports": "^2.12.4",
67
68
  "moq.ts": "^10.1.0",
68
- "rimraf": "^5.0.9",
69
+ "rimraf": "^5.0.10",
70
+ "tinybench": "~2.8.0",
69
71
  "tmp": "0.2.1",
70
- "typescript": "^5.5.3"
72
+ "typescript": "^5.8.3",
73
+ "typescript-eslint": "^8.32.0"
71
74
  },
72
75
  "overrides": {
73
76
  "ava": {
@@ -84,6 +87,9 @@
84
87
  "prepack": "rimraf dist && npm run build"
85
88
  },
86
89
  "ava": {
90
+ "files": [
91
+ "**/*.test.ts"
92
+ ],
87
93
  "typescript": {
88
94
  "rewritePaths": {
89
95
  "src/": "dist/"