@tryghost/listr-smart-renderer 0.4.1 → 0.4.2
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 +6 -4
- package/lib/task-runner.js +1 -1
- package/lib/utils.js +2 -2
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Listr Smart Renderer
|
|
2
2
|
|
|
3
|
-
A renderer for [Listr](https://github.com/SamVerschueren/listr) that handles extremely long lists of tasks by collapsing into a summary view.
|
|
3
|
+
A renderer for [Listr](https://github.com/SamVerschueren/listr) & [listr2](https://github.com/cenk1cenk2/listr2) that handles extremely long lists of tasks by collapsing into a summary view.
|
|
4
4
|
|
|
5
5
|
Pass in `maxFullTasks` to tell the renderer when to collapse into summary view.
|
|
6
6
|
The summary outputs one line for each task that is currently being executed, one line for each task that fails and a final summary line.
|
|
@@ -20,8 +20,10 @@ or
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
22
|
```js
|
|
23
|
-
|
|
23
|
+
// Either of these 2 will work
|
|
24
24
|
import Listr from 'listr';
|
|
25
|
+
import {Listr} from 'listr2';
|
|
26
|
+
import SmartRenderer from '@tryghost/listr-smart-renderer';
|
|
25
27
|
|
|
26
28
|
const list = new Listr([
|
|
27
29
|
{
|
|
@@ -36,7 +38,7 @@ const list = new Listr([
|
|
|
36
38
|
list.run();
|
|
37
39
|
```
|
|
38
40
|
|
|
39
|
-
This package also exports a `makeTaskRunner` method that simplifies your script
|
|
41
|
+
This package also exports a `makeTaskRunner` method that simplifies your script. `listr2` is used here.
|
|
40
42
|
|
|
41
43
|
```js
|
|
42
44
|
import {makeTaskRunner} from '@tryghost/listr-smart-renderer';
|
|
@@ -63,7 +65,7 @@ await taskRunner.run();
|
|
|
63
65
|
|
|
64
66
|
## Options
|
|
65
67
|
|
|
66
|
-
These options should be provided in the
|
|
68
|
+
These options should be provided in the[Listr](https://github.com/SamVerschueren/listr) or [listr2](https://listr2.kilic.dev/getting-started/task-object) options object.
|
|
67
69
|
|
|
68
70
|
### maxFullTasks
|
|
69
71
|
|
package/lib/task-runner.js
CHANGED
package/lib/utils.js
CHANGED
|
@@ -14,7 +14,7 @@ const getSymbol = (task, options) => {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
if (task.isPending()) {
|
|
17
|
-
return options.showSubtasks !== false && task.subtasks
|
|
17
|
+
return options.showSubtasks !== false && task.subtasks?.length > 0 ? pointer : chalk.yellow(task.spinner());
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
if (task.isCompleted()) {
|
|
@@ -22,7 +22,7 @@ const getSymbol = (task, options) => {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
if (task.hasFailed()) {
|
|
25
|
-
return task.subtasks
|
|
25
|
+
return task.subtasks?.length > 0 ? pointer : logSymbols.error;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
if (task.isSkipped()) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/listr-smart-renderer",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"repository": "https://github.com/TryGhost/migrate/tree/main/packages/listr-smart-renderer",
|
|
5
5
|
"author": "Ghost Foundation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"jest": "29.1
|
|
29
|
+
"jest": "29.2.1",
|
|
30
30
|
"jest-extended": "3.1.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
@@ -34,9 +34,10 @@
|
|
|
34
34
|
"cli-truncate": "^3.0.0",
|
|
35
35
|
"elegant-spinner": "^3.0.0",
|
|
36
36
|
"indent-string": "^5.0.0",
|
|
37
|
+
"listr2": "5.0.5",
|
|
37
38
|
"log-symbols": "5.1.0",
|
|
38
39
|
"log-update": "^5.0.0",
|
|
39
40
|
"strip-ansi": "^6.0.0"
|
|
40
41
|
},
|
|
41
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "001ab9a8a73dd714fb15220efbe8add099780d11"
|
|
42
43
|
}
|