Skip to content

Commit e69194f

Browse files
authored
chore: replace chalk with yoctocolors (#1889)
1 parent 93edc33 commit e69194f

File tree

5 files changed

+19
-15
lines changed

5 files changed

+19
-15
lines changed

CONTRIBUTING.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,7 @@ via the [Dependency Dashboard].
309309
side or make things more complicated to maintain. An example of us holding
310310
back is the [`uuid`][] package; as of writing, the latest version is 9.x but
311311
we're on 8.x still because that's the version being used by most of our
312-
dependencies. Another example is [`chalk`][]; we are stuck on 4.x until
313-
`@react-native-community/cli` migrates to ESM.
312+
dependencies.
314313

315314
### Development Dependencies
316315

@@ -356,7 +355,6 @@ additions.
356355
https://github.com/microsoft/rnx-kit/tree/main/packages/align-deps#contribution
357356
[`@rnx-kit/react-native-host`]:
358357
https://github.com/microsoft/rnx-kit/tree/main/packages/react-native-host#readme
359-
[`chalk`]: https://github.com/chalk/chalk
360358
[`dependencies.gradle`]:
361359
https://github.com/microsoft/react-native-test-app/blob/trunk/android/dependencies.gradle
362360
[`package.json`]:

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@
8686
"dependencies": {
8787
"@rnx-kit/react-native-host": "^0.4.4",
8888
"ajv": "^8.0.0",
89-
"chalk": "^4.1.0",
9089
"cliui": "^8.0.0",
9190
"fast-xml-parser": "^4.0.0",
9291
"prompts": "^2.4.0",
9392
"semver": "^7.3.5",
94-
"uuid": "^8.3.2"
93+
"uuid": "^8.3.2",
94+
"yoctocolors": "^2.0.0"
9595
},
9696
"peerDependencies": {
9797
"@expo/config-plugins": ">=5.0",

scripts/configure.mjs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env node
22
// @ts-check
3-
import chalk from "chalk";
43
import * as nodefs from "node:fs";
54
import { createRequire } from "node:module";
65
import * as path from "node:path";
76
import { fileURLToPath } from "node:url";
87
import semverCoerce from "semver/functions/coerce.js";
98
import semverSatisfies from "semver/functions/satisfies.js";
9+
import * as colors from "yoctocolors";
1010
import { cliPlatformIOSVersion } from "./configure-projects.js";
1111
import {
1212
getPackageVersion,
@@ -62,7 +62,7 @@ function readManifest() {
6262
* @param {string} message
6363
*/
6464
export function error(message) {
65-
console.error(chalk.red(`[!] ${message}`));
65+
console.error(colors.red(`[!] ${message}`));
6666
}
6767

6868
/**
@@ -134,7 +134,7 @@ export function sortByKeys(obj) {
134134
* @param {string=} tag
135135
*/
136136
export function warn(message, tag = "[!]") {
137-
console.warn(chalk.yellow(`${tag} ${message}`));
137+
console.warn(colors.yellow(`${tag} ${message}`));
138138
}
139139

140140
/**
@@ -661,7 +661,7 @@ export function configure(params, fs = nodefs) {
661661
if (!force && isDestructive(packagePath, config)) {
662662
error("Destructive file operations are required.");
663663
console.log(
664-
`Re-run with ${chalk.bold("--force")} if you're fine with this.`
664+
`Re-run with ${colors.bold("--force")} if you're fine with this.`
665665
);
666666
return 1;
667667
}

scripts/init.mjs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env node
22
// @ts-check
3-
import chalk from "chalk";
43
import { spawnSync } from "node:child_process";
54
import * as fs from "node:fs";
65
import * as https from "node:https";
@@ -9,6 +8,7 @@ import * as os from "node:os";
98
import * as path from "node:path";
109
import { fileURLToPath } from "node:url";
1110
import prompts from "prompts";
11+
import * as colors from "yoctocolors";
1212
import { configure, getDefaultPlatformPackageName } from "./configure.mjs";
1313
import { npm as npmSync, readJSONFile } from "./helpers.js";
1414
import { parseArgs } from "./parseargs.mjs";
@@ -121,11 +121,10 @@ function getVersion(platforms) {
121121

122122
/** @type {(version: string, reason: string) => void} */
123123
const logVersion = (version, reason) => {
124-
const fmtVersionFlag = chalk.bold("--version");
125-
const fmtTarget = chalk.bold(version);
124+
const bVersionFlag = colors.bold("--version");
125+
const bTarget = colors.bold(version);
126126
console.log(
127-
`Using ${fmtTarget} because ${reason} (use ${fmtVersionFlag} to ` +
128-
`specify another version)`
127+
`Using ${bTarget} because ${reason} (use ${bVersionFlag} to specify another version)`
129128
);
130129
};
131130

yarn.lock

+8-1
Original file line numberDiff line numberDiff line change
@@ -12103,7 +12103,6 @@ __metadata:
1210312103
"@types/semver": "npm:^7.3.6"
1210412104
"@types/uuid": "npm:^8.3.1"
1210512105
ajv: "npm:^8.0.0"
12106-
chalk: "npm:^4.1.0"
1210712106
cliui: "npm:^8.0.0"
1210812107
eslint: "npm:^8.0.0"
1210912108
eslint-plugin-wdio: "npm:^8.20.0"
@@ -12122,6 +12121,7 @@ __metadata:
1212212121
suggestion-bot: "npm:^2.0.0"
1212312122
typescript: "npm:^5.0.0"
1212412123
uuid: "npm:^8.3.2"
12124+
yoctocolors: "npm:^2.0.0"
1212512125
peerDependencies:
1212612126
"@expo/config-plugins": ">=5.0"
1212712127
react: 17.0.1 - 18.2
@@ -15091,6 +15091,13 @@ __metadata:
1509115091
languageName: node
1509215092
linkType: hard
1509315093

15094+
"yoctocolors@npm:^2.0.0":
15095+
version: 2.0.0
15096+
resolution: "yoctocolors@npm:2.0.0"
15097+
checksum: 10c0/994f5d99e7647a1b333331ffecbbf7c4463d9c2823e371b44e21146a4496cad0f14fbe2f73f44383312a6f843d93523f830f1360009f0ac93027b167ef5c63be
15098+
languageName: node
15099+
linkType: hard
15100+
1509415101
"zip-stream@npm:^5.0.1":
1509515102
version: 5.0.1
1509615103
resolution: "zip-stream@npm:5.0.1"

0 commit comments

Comments
 (0)