Skip to content

Commit 4febe15

Browse files
authored
Display package versions in descending instead of ascending order (#189)
1 parent d23eab9 commit 4febe15

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ Found 2 dependencies with mismatching versions across the workspace.
4646
╔════════╤════════╤═════════════════════════════╗
4747
║ eslint │ Usages │ Packages ║
4848
╟────────┼────────┼─────────────────────────────╢
49-
║ ^7.0.0 │ 5 │ foo, bar, baz, and 2 others ║
50-
╟────────┼────────┼─────────────────────────────╢
5149
║ ^8.0.0 │ 1 │ @some-scope/package-name ║
50+
╟────────┼────────┼─────────────────────────────╢
51+
║ ^7.0.0 │ 5 │ foo, bar, baz, and 2 others ║
5252
╚════════╧══════════════════════════════════════╝
5353
╔═════════╤════════╤════════════════════════════════════════╗
5454
║ globby │ Usages │ Packages ║
5555
╟─────────┼────────┼────────────────────────────────────────╢
56-
║ ^7.1.1 │ 1 │ packages/my-favorite-package ║
57-
╟─────────┼────────┼────────────────────────────────────────╢
5856
║ ^11.0.0 │ 2 │ packages/hello-world, packages/foo-bar ║
57+
╟─────────┼────────┼────────────────────────────────────────╢
58+
║ ^7.1.1 │ 1 │ packages/my-favorite-package ║
5959
╚═════════╧════════╧════════════════════════════════════════╝
6060
```
6161

lib/output.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function mismatchingVersionsToOutput(
1414
.map((obj) => {
1515
const headers = [chalk.bold(obj.dependency), 'Usages', 'Packages'];
1616
const rows = obj.versions
17-
.sort((a, b) => compareRanges(a.version, b.version))
17+
.sort((a, b) => compareRanges(b.version, a.version))
1818
.map((versionObj) => {
1919
const packages =
2020
versionObj.packages.length > 3

test/lib/output.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,25 @@ describe('Utils | output', function () {
5555
╔═══════╤════════╤══════════╗
5656
║ \u001B[1mfoo\u001B[22m │ Usages │ Packages ║
5757
╟───────┼────────┼──────────╢
58-
║ \u001B[91m1.2.3\u001B[39m │ 1 │ foo ║
59-
╟───────┼────────┼──────────╢
6058
║ \u001B[91m4.5.6\u001B[39m │ 2 │ bar, baz ║
59+
╟───────┼────────┼──────────╢
60+
║ \u001B[91m1.2.3\u001B[39m │ 1 │ foo ║
6161
╚═══════╧════════╧══════════╝
6262
╔═══════╤════════╤════════════════════════════════════════════╗
6363
║ \u001B[1mbar\u001B[22m │ Usages │ Packages ║
6464
╟───────┼────────┼────────────────────────────────────────────╢
65-
║ \u001B[91m1.4.0\u001B[39m │ 5 │ package5, package6, package7, and 2 others ║
66-
╟───────┼────────┼────────────────────────────────────────────╢
6765
║ \u001B[91m2.0.0\u001B[39m │ 4 │ package1, package2, package3, and 1 other ║
66+
╟───────┼────────┼────────────────────────────────────────────╢
67+
║ \u001B[91m1.4.0\u001B[39m │ 5 │ package5, package6, package7, and 2 others ║
6868
╚═══════╧════════╧════════════════════════════════════════════╝
6969
╔════════╤════════╤══════════╗
7070
║ \u001B[1mbaz\u001B[22m │ Usages │ Packages ║
7171
╟────────┼────────┼──────────╢
72-
║ \u001B[91m^1.0.0\u001B[39m │ 1 │ package3
72+
║ \u001B[91m^2.0.0\u001B[39m │ 1 │ package1
7373
╟────────┼────────┼──────────╢
7474
║ \u001B[91m~2.0.0\u001B[39m │ 1 │ package2 ║
7575
╟────────┼────────┼──────────╢
76-
║ \u001B[91m^2.0.0\u001B[39m │ 1 │ package1
76+
║ \u001B[91m^1.0.0\u001B[39m │ 1 │ package3
7777
╚════════╧════════╧══════════╝
7878
`
7979
);

0 commit comments

Comments
 (0)