@tryghost/listr-smart-renderer 0.15.2 → 0.15.4
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 +2 -2
- package/index.js +1 -3
- package/lib/smart-renderer.js +19 -6
- package/lib/utils.js +2 -7
- package/package.json +3 -5
package/README.md
CHANGED
|
@@ -104,8 +104,8 @@ Follow the instructions for the top-level repo.
|
|
|
104
104
|
|
|
105
105
|
## Test
|
|
106
106
|
|
|
107
|
-
- `pnpm
|
|
108
|
-
-
|
|
107
|
+
- `pnpm test` runs the package tests
|
|
108
|
+
- Linting and formatting are run from the repo root (`pnpm lint`, `pnpm format`)
|
|
109
109
|
|
|
110
110
|
# Copyright & License
|
|
111
111
|
|
package/index.js
CHANGED
package/lib/smart-renderer.js
CHANGED
|
@@ -71,7 +71,12 @@ const summaryRenderer = (tasks, options, level = 0) => {
|
|
|
71
71
|
if (!task.output && task.hasSubtasks()) {
|
|
72
72
|
task.output = `${chalk.red.dim(`Subtask failed ${arrowDown}`)}`;
|
|
73
73
|
}
|
|
74
|
-
output.push(
|
|
74
|
+
output.push(
|
|
75
|
+
indentString(
|
|
76
|
+
`${getSymbol(task, options)} ${taskNumber(index, tasks)}: ${task.title} - ${task.output}`,
|
|
77
|
+
level
|
|
78
|
+
)
|
|
79
|
+
);
|
|
75
80
|
} else {
|
|
76
81
|
// Handle any task data that needs to be output
|
|
77
82
|
if (isDefined(task.output)) {
|
|
@@ -102,7 +107,12 @@ const summaryRenderer = (tasks, options, level = 0) => {
|
|
|
102
107
|
}
|
|
103
108
|
});
|
|
104
109
|
|
|
105
|
-
output.push(
|
|
110
|
+
output.push(
|
|
111
|
+
indentString(
|
|
112
|
+
`Total: ${tasks.length}. Complete: ${states.complete.length}, Failed: ${states.failed.length ? chalk.red(states.failed.length) : 0}, Skipped: ${states.skipped.length}, Disabled: ${states.disabled.length}`,
|
|
113
|
+
level
|
|
114
|
+
)
|
|
115
|
+
);
|
|
106
116
|
|
|
107
117
|
return output.join('\n');
|
|
108
118
|
};
|
|
@@ -121,10 +131,13 @@ class SmartRenderer {
|
|
|
121
131
|
constructor(tasks, options) {
|
|
122
132
|
this._tasks = tasks;
|
|
123
133
|
this._mode = 'full';
|
|
124
|
-
this._options = Object.assign(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
134
|
+
this._options = Object.assign(
|
|
135
|
+
{
|
|
136
|
+
maxFullTasks: 30,
|
|
137
|
+
clearOutput: false
|
|
138
|
+
},
|
|
139
|
+
options
|
|
140
|
+
);
|
|
128
141
|
}
|
|
129
142
|
|
|
130
143
|
render() {
|
package/lib/utils.js
CHANGED
|
@@ -40,15 +40,10 @@ const indentString = (string, level) => IndentString(string, level, ' ');
|
|
|
40
40
|
const taskNumber = (index, tasks) => {
|
|
41
41
|
// Quick and dirty left pad
|
|
42
42
|
let padSize = String(tasks.length).length;
|
|
43
|
-
let padding =
|
|
43
|
+
let padding = Array.from({length: padSize}).join(0);
|
|
44
44
|
let taskNum = `${padding}${index + 1}`.slice(-padSize);
|
|
45
45
|
|
|
46
46
|
return `${taskNum}/${tasks.length}`;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
export {
|
|
50
|
-
isDefined,
|
|
51
|
-
getSymbol,
|
|
52
|
-
indentString,
|
|
53
|
-
taskNumber
|
|
54
|
-
};
|
|
49
|
+
export {isDefined, getSymbol, indentString, taskNumber};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/listr-smart-renderer",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/TryGhost/migrate.git",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"chalk": "
|
|
27
|
+
"chalk": "6.0.0",
|
|
28
28
|
"cli-truncate": "6.1.1",
|
|
29
29
|
"elegant-spinner": "3.0.0",
|
|
30
30
|
"indent-string": "5.0.0",
|
|
@@ -35,8 +35,6 @@
|
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"dev": "echo \"Implement me!\"",
|
|
38
|
-
"test": "node --test 'test/**/*.test.js'"
|
|
39
|
-
"posttest": "pnpm lint",
|
|
40
|
-
"lint": "eslint . --ext .js --cache"
|
|
38
|
+
"test": "node --test 'test/**/*.test.js'"
|
|
41
39
|
}
|
|
42
40
|
}
|