Skip to content

Commit e92cb9a

Browse files
committed
Replace colors with chalk due to malicious version of colors
The maintainer of colors has purposely introduced an infinite loop in the latest version of colors. Therefore we need to ditch this dependency. cli-table must also be updated in order to get rid of the colors dependency entirely. There is a PR: Automattic/cli-table#166 Or maybe an alternative table lib should be considered as well?
1 parent a5afc47 commit e92cb9a

File tree

3 files changed

+65
-22
lines changed

3 files changed

+65
-22
lines changed

package-lock.json

Lines changed: 57 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
"prepublishOnly": "npm run build"
3535
},
3636
"dependencies": {
37+
"chalk": "^4.1.2",
3738
"cli-table": "^0.3.1",
38-
"colors": "^1.1.2",
3939
"yargs": "^17.3.0"
4040
},
4141
"devDependencies": {

src/ditched.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import path from "path";
33
import fs from "fs";
44
import https from "https";
55
import CliTable from "cli-table";
6-
import colors from "colors/safe";
6+
import chalk from "chalk";
77
import yargs from "yargs/yargs";
88
import { hideBin } from "yargs/helpers";
99

@@ -76,9 +76,9 @@ function printInfoTable(
7676

7777
const table = new CliTable({
7878
head: [
79-
colors.gray("Package"),
80-
colors.gray("Last Modified"),
81-
colors.gray("Ditched?"),
79+
chalk.gray("Package"),
80+
chalk.gray("Last Modified"),
81+
chalk.gray("Ditched?"),
8282
],
8383
colWidths: [30, 40, 15],
8484
});
@@ -96,11 +96,11 @@ function printInfoTable(
9696
? formatTimeSince(modifiedDate)
9797
: "No package info found.";
9898

99-
let ditchedInfo = colors.red("?");
99+
let ditchedInfo = chalk.red("?");
100100
if (modifiedDate) {
101101
ditchedInfo = isDitched(packageInfo, ditchDays)
102-
? colors.red("Yes")
103-
: colors.green("No");
102+
? chalk.red("Yes")
103+
: chalk.green("No");
104104
}
105105

106106
table.push([name, formattedTime, ditchedInfo]);

0 commit comments

Comments
 (0)