Skip to content

Commit 7568d4f

Browse files
committed
feat: move non-tasks outside Listr2
1 parent 8289e60 commit 7568d4f

16 files changed

Lines changed: 428 additions & 220 deletions

‎.changeset/metal-gifts-invite.md‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
'lint-staged': minor
3+
---
4+
5+
The console output of _lint-staged_ has been simplified so that there's less interactive spinners and more explicit messages like _"Started…_" -> "_Done!_". The goal of this is to reduce the usage of [`Listr2`](https://github.com/listr2/listr2), a very large dependency.
6+
7+
**Before:**
8+
9+
```shell
10+
✔ Backed up original state in git stash (0b191303)
11+
✔ Running tasks for staged files...
12+
✔ Staging changes from tasks...
13+
✔ Cleaning up temporary files...
14+
```
15+
16+
**After:**
17+
18+
```shell
19+
⋯ Backing up original state…
20+
✔ Done backing up original state (b54719f3)!
21+
✔ Running tasks for staged files...
22+
⋯ Staging changes from tasks…
23+
✔ Done staging changes from tasks!
24+
⋯ Cleaning up temporary files…
25+
✔ Done cleaning up temporary files!
26+
```

‎lib/colors.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ import util from 'node:util'
44

55
export const SUPPORTS_COLOR = !!process.stdout.hasColors?.()
66

7+
export const green = (text) => (SUPPORTS_COLOR ? util.styleText('green', text) : text)
8+
79
export const red = (text) => (SUPPORTS_COLOR ? util.styleText('red', text) : text)
10+
811
export const yellow = (text) => (SUPPORTS_COLOR ? util.styleText('yellow', text) : text)
12+
913
export const blue = (text) => (SUPPORTS_COLOR ? util.styleText('blue', text) : text)
14+
1015
export const dim = (text) => (SUPPORTS_COLOR ? util.styleText('dim', text) : text)
16+
1117
export const bold = (text) => (SUPPORTS_COLOR ? util.styleText('bold', text) : text)

‎lib/figures.js‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
import { figures } from 'listr2'
1+
import { blue, dim, green, red, yellow } from './colors.js'
22

3-
import { blue, red, yellow } from './colors.js'
3+
export const wip = blue('⋯')
44

5-
export const info = blue(figures.arrowRight)
5+
export const done = green('✔')
66

7-
export const error = red(figures.cross)
7+
export const info = blue('→')
88

9-
export const warning = yellow(figures.warning)
9+
export const error = red('✖')
10+
11+
export const warning = yellow('⚠')
12+
13+
export const cancelled = dim('↓')

0 commit comments

Comments
 (0)