hereby 1.5.0 → 1.6.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/README.md CHANGED
@@ -6,6 +6,8 @@
6
6
  [![ci](https://github.com/jakebailey/hereby/actions/workflows/ci.yml/badge.svg)](https://github.com/jakebailey/hereby/actions/workflows/ci.yml)
7
7
  [![codecov](https://codecov.io/gh/jakebailey/hereby/branch/main/graph/badge.svg?token=YL2Z1uk5dh)](https://codecov.io/gh/jakebailey/hereby)
8
8
 
9
+ > _I hereby declare thee built._
10
+
9
11
  `hereby` is a simple task runner.
10
12
 
11
13
  ```
@@ -60,7 +62,7 @@ export const bundle = task({
60
62
  await execa("esbuild", [
61
63
  "--bundle",
62
64
  "./out/index.js",
63
- "--outfile", "./out/bundled.js",
65
+ "--outfile=./out/bundled.js",
64
66
  ]);
65
67
  },
66
68
  });
@@ -13,6 +13,7 @@ export function formatTasks(format, tasks, defaultTask) {
13
13
  sections.push({
14
14
  header: "Available tasks",
15
15
  content: tasks.map((task) => {
16
+ var _a;
16
17
  const name = task !== defaultTask
17
18
  ? chalk.blue(task.options.name)
18
19
  : `${chalk.green(task.options.name)} (default)`;
@@ -20,7 +21,7 @@ export function formatTasks(format, tasks, defaultTask) {
20
21
  if (task.options.description) {
21
22
  descriptionParts.push(task.options.description);
22
23
  }
23
- const deps = task.options.dependencies?.filter((task) => !task.options.hiddenFromTaskList);
24
+ const deps = (_a = task.options.dependencies) === null || _a === void 0 ? void 0 : _a.filter((task) => !task.options.hiddenFromTaskList);
24
25
  if (deps && deps.length > 0) {
25
26
  const depNames = deps
26
27
  .map((task) => task.options.name)
package/dist/cli/index.js CHANGED
@@ -25,12 +25,13 @@ export async function main(d) {
25
25
  }
26
26
  }
27
27
  async function mainWorker(d) {
28
+ var _a;
28
29
  const args = parseArgs(d.argv.slice(2));
29
30
  if (args.help) {
30
31
  d.log(getUsage());
31
32
  return;
32
33
  }
33
- let herebyfilePath = args.herebyfile ?? (await findHerebyfile(d.cwd()));
34
+ let herebyfilePath = (_a = args.herebyfile) !== null && _a !== void 0 ? _a : (await findHerebyfile(d.cwd()));
34
35
  herebyfilePath = path.resolve(d.cwd(), herebyfilePath);
35
36
  if (await reexec(d, herebyfilePath)) {
36
37
  return;
@@ -1,5 +1,5 @@
1
1
  import chalk from "chalk";
2
- import fs from "fs/promises";
2
+ import { promises as fs } from "fs";
3
3
  import path from "path";
4
4
  import { pathToFileURL } from "url";
5
5
  import { Task } from "../index.js";
@@ -1,12 +1,10 @@
1
1
  import assert from "assert";
2
2
  import chalk from "chalk";
3
- import pLimit from "p-limit";
4
3
  export class Runner {
5
- constructor(d, limiter) {
4
+ constructor(d) {
6
5
  this._addedTasks = new WeakMap();
7
6
  this._errored = false;
8
7
  this._startTimes = new WeakMap();
9
- this._limiter = limiter ?? pLimit(d.numCPUs);
10
8
  this._d = d;
11
9
  }
12
10
  async runTasks(...tasks) {
@@ -28,17 +26,15 @@ export class Runner {
28
26
  if (!run) {
29
27
  return;
30
28
  }
31
- return this._limiter(async () => {
32
- try {
33
- this.onTaskStart(task);
34
- await run();
35
- this.onTaskFinish(task);
36
- }
37
- catch (e) {
38
- this.onTaskError(task, e);
39
- throw e;
40
- }
41
- });
29
+ try {
30
+ this.onTaskStart(task);
31
+ await run();
32
+ this.onTaskFinish(task);
33
+ }
34
+ catch (e) {
35
+ this.onTaskError(task, e);
36
+ throw e;
37
+ }
42
38
  }
43
39
  onTaskStart(task) {
44
40
  this._startTimes.set(task, Date.now());
package/dist/cli/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- import fs from "fs/promises";
1
+ import { promises as fs } from "fs";
2
2
  import os from "os";
3
3
  import path from "path";
4
4
  import { fileURLToPath } from "url";
@@ -61,7 +61,6 @@ export async function real() {
61
61
  setExitCode: (code) => {
62
62
  process.exitCode = code;
63
63
  },
64
- numCPUs: os.cpus().length,
65
64
  version,
66
65
  foregroundChild,
67
66
  resolve,
package/dist/cli.js CHANGED
@@ -1,4 +1,7 @@
1
1
  import { main } from "./cli/index.js";
2
2
  import { real } from "./cli/utils.js";
3
- await main(await real());
3
+ async function run() {
4
+ await main(await real());
5
+ }
6
+ void run();
4
7
  //# sourceMappingURL=cli.js.map
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ export class Task {
5
5
  constructor(options) {
6
6
  // Runtime typecheck; consumers of hereby may not have enabled
7
7
  // typechecking, so this is helpful.
8
+ var _a;
8
9
  if (typeof options.name !== "string") {
9
10
  throw new Error("Task name is not a string.");
10
11
  }
@@ -31,7 +32,7 @@ export class Task {
31
32
  if (options.name.startsWith("-")) {
32
33
  throw new Error('Task name must not start with "-".');
33
34
  }
34
- if (!options.dependencies?.length && !options.run) {
35
+ if (!((_a = options.dependencies) === null || _a === void 0 ? void 0 : _a.length) && !options.run) {
35
36
  throw new Error("Task must have at run function or dependencies.");
36
37
  }
37
38
  this._options = options;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hereby",
3
- "version": "1.5.0",
3
+ "version": "1.6.1",
4
4
  "description": "A simple task runner",
5
5
  "repository": "github:jakebailey/hereby",
6
6
  "type": "module",
@@ -28,7 +28,7 @@
28
28
  "makefile"
29
29
  ],
30
30
  "engines": {
31
- "node": ">= 14.16"
31
+ "node": ">= 12.20"
32
32
  },
33
33
  "files": [
34
34
  "README.md",
@@ -38,34 +38,34 @@
38
38
  "./dist/index.d.ts"
39
39
  ],
40
40
  "dependencies": {
41
- "chalk": "^5.0.1",
41
+ "chalk": "^5.1.2",
42
42
  "command-line-args": "^5.2.1",
43
43
  "command-line-usage": "^6.1.3",
44
44
  "fastest-levenshtein": "^1.0.16",
45
45
  "foreground-child": "^2.0.0",
46
46
  "import-meta-resolve": "^2.1.0",
47
- "p-limit": "^4.0.0",
48
47
  "pretty-ms": "^8.0.0"
49
48
  },
50
49
  "devDependencies": {
51
50
  "@ava/typescript": "^3.0.1",
52
- "@tsconfig/node14": "^1.0.3",
51
+ "@tsconfig/node12": "^1.0.11",
53
52
  "@types/command-line-args": "^5.2.0",
54
53
  "@types/command-line-usage": "^5.0.2",
55
- "@types/node": "^14.18.31",
56
- "@typescript-eslint/eslint-plugin": "^5.39.0",
57
- "@typescript-eslint/parser": "^5.39.0",
58
- "ava": "^4.3.3",
54
+ "@types/node": "^14.18.32",
55
+ "@types/tmp": "^0.2.3",
56
+ "@typescript-eslint/eslint-plugin": "^5.40.1",
57
+ "@typescript-eslint/parser": "^5.40.1",
58
+ "ava": "^5.0.1",
59
59
  "c8": "^7.12.0",
60
- "dprint": "^0.32.1",
61
- "eslint": "^8.24.0",
60
+ "dprint": "^0.32.2",
61
+ "eslint": "^8.26.0",
62
62
  "eslint-plugin-ava": "^13.2.0",
63
63
  "eslint-plugin-simple-import-sort": "^8.0.0",
64
64
  "execa": "^6.1.0",
65
65
  "moq.ts": "^9.0.2",
66
- "release-it": "^15.4.3",
66
+ "release-it": "^15.5.0",
67
67
  "rimraf": "^3.0.2",
68
- "tempy": "^3.0.0",
68
+ "tmp": "^0.2.1",
69
69
  "typescript": "~4.8.4"
70
70
  },
71
71
  "packageManager": "npm@8.17.0",