hereby 1.13.0 → 1.14.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/dist/cli/formatTasks.js +25 -3
- package/dist/cli/index.js +1 -1
- package/package.json +4 -8
package/dist/cli/formatTasks.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import pc from "picocolors";
|
|
2
|
-
import Wordwrap from "wordwrapjs";
|
|
3
2
|
import { compareTaskNames } from "./utils.js";
|
|
4
3
|
export function formatTasks(format, tasks, defaultTask, columns) {
|
|
5
4
|
const visibleTasks = [...tasks].filter(isTaskVisible).sort(compareTaskNames);
|
|
@@ -41,7 +40,7 @@ function formatAsColumns(indent, leftText, leftWidth, rightText, rightWidth) {
|
|
|
41
40
|
for (let i = 0; i < maxLines; i++) {
|
|
42
41
|
const leftPart = leftLines[i] || "";
|
|
43
42
|
const rightPart = rightLines[i] || "";
|
|
44
|
-
const paddedLeft = leftPart.
|
|
43
|
+
const paddedLeft = leftPart + " ".repeat(Math.max(0, leftWidth - visibleLength(leftPart)));
|
|
45
44
|
result += `${indent}${paddedLeft} ${rightPart}\n`;
|
|
46
45
|
}
|
|
47
46
|
return result;
|
|
@@ -51,7 +50,30 @@ const ANSI_REGEX = /\u001B\[([0-9]{1,2})m/g;
|
|
|
51
50
|
function visibleLength(str) {
|
|
52
51
|
return str.replace(ANSI_REGEX, "").length;
|
|
53
52
|
}
|
|
53
|
+
const TOKEN_REGEX = /[^\s-]+?-\b|\S+|\s+/g;
|
|
54
54
|
function wrapText(text, maxWidth) {
|
|
55
|
-
|
|
55
|
+
var _a;
|
|
56
|
+
const result = [];
|
|
57
|
+
for (const line of text.split(/\r?\n/)) {
|
|
58
|
+
let current = "";
|
|
59
|
+
for (const token of (_a = line.match(TOKEN_REGEX)) !== null && _a !== void 0 ? _a : []) {
|
|
60
|
+
if (visibleLength(current) + visibleLength(token) > maxWidth && current.trim()) {
|
|
61
|
+
result.push(current.trim());
|
|
62
|
+
current = "";
|
|
63
|
+
}
|
|
64
|
+
if (visibleLength(token) > maxWidth) {
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-spread
|
|
66
|
+
const chars = [...token];
|
|
67
|
+
while (chars.length > 0)
|
|
68
|
+
result.push(chars.splice(0, maxWidth).join(""));
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
current += /^\s/.test(token) && !current ? "" : token;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (current.trim())
|
|
75
|
+
result.push(current.trim());
|
|
76
|
+
}
|
|
77
|
+
return result.length > 0 ? result : [""];
|
|
56
78
|
}
|
|
57
79
|
//# sourceMappingURL=formatTasks.js.map
|
package/dist/cli/index.js
CHANGED
|
@@ -2,7 +2,6 @@ import path from "node:path";
|
|
|
2
2
|
import { performance } from "node:perf_hooks";
|
|
3
3
|
import { types } from "node:util";
|
|
4
4
|
import pc from "picocolors";
|
|
5
|
-
import { formatTasks } from "./formatTasks.js";
|
|
6
5
|
import { findHerebyfile, loadHerebyfile } from "./loadHerebyfile.js";
|
|
7
6
|
import { getUsage, parseArgs } from "./parseArgs.js";
|
|
8
7
|
import { reexec } from "./reexec.js";
|
|
@@ -42,6 +41,7 @@ async function mainWorker(d) {
|
|
|
42
41
|
d.chdir(path.dirname(herebyfilePath));
|
|
43
42
|
const herebyfile = await loadHerebyfile(herebyfilePath);
|
|
44
43
|
if (args.printTasks) {
|
|
44
|
+
const { formatTasks } = await import("./formatTasks.js");
|
|
45
45
|
d.log(formatTasks(args.printTasks, herebyfile.tasks.values(), herebyfile.defaultTask, d.columns()));
|
|
46
46
|
return;
|
|
47
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hereby",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "A simple task runner",
|
|
5
5
|
"repository": "github:jakebailey/hereby",
|
|
6
6
|
"type": "module",
|
|
@@ -41,8 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"fastest-levenshtein": "^1.0.16",
|
|
43
43
|
"minimist": "^1.2.8",
|
|
44
|
-
"picocolors": "^1.1.
|
|
45
|
-
"wordwrapjs": "^5.1.1"
|
|
44
|
+
"picocolors": "^1.1.1"
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|
|
48
47
|
"@ava/typescript": "^3.0.1",
|
|
@@ -50,9 +49,7 @@
|
|
|
50
49
|
"@eslint/js": "^10.0.1",
|
|
51
50
|
"@tsconfig/node12": "^12.1.7",
|
|
52
51
|
"@types/minimist": "^1.2.5",
|
|
53
|
-
"@types/node": "^25.3.
|
|
54
|
-
"@types/tmp": "^0.2.6",
|
|
55
|
-
"@types/wordwrapjs": "^5.1.2",
|
|
52
|
+
"@types/node": "^25.3.5",
|
|
56
53
|
"ava": "~5.0.1",
|
|
57
54
|
"c8": "^11.0.0",
|
|
58
55
|
"dprint": "^0.52.0",
|
|
@@ -64,8 +61,7 @@
|
|
|
64
61
|
"globals": "^17.4.0",
|
|
65
62
|
"monocart-coverage-reports": "^2.12.9",
|
|
66
63
|
"moq.ts": "^10.1.0",
|
|
67
|
-
"rimraf": "^
|
|
68
|
-
"tmp": "0.2.1",
|
|
64
|
+
"rimraf": "^6.1.3",
|
|
69
65
|
"typescript": "^5.9.3",
|
|
70
66
|
"typescript-eslint": "^8.56.1"
|
|
71
67
|
},
|