Skip to content

Commit 3970dda

Browse files
Avi Vahlbkendall
andauthored
refactor: migrate from cli-color to colorette (firebase#4818)
* refactor: migrate from cli-color to colorette * replace spinner and ansi strip functions * docs: mention coloring library change Co-authored-by: Bryan Kendall <[email protected]>
1 parent 7064e48 commit 3970dda

File tree

164 files changed

+303
-572
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+303
-572
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Replaces underlying terminal coloring library.

CONTRIBUTING.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -277,14 +277,14 @@ logger.info("This text will be displayed to the end user.");
277277
logger.debug("This text will only show up in firebase-debug.log or running with --debug.");
278278
```
279279

280-
In addition, the [cli-color](https://www.npmjs.com/package/cli-color) Node.js
280+
In addition, the [colorette](https://www.npmjs.com/package/colorette) Node.js
281281
library should be used for color/formatting of the output:
282282

283283
```typescript
284-
import * as clc "cli-color";
284+
import { green, bold, underline } from "colorette";
285285

286286
// Generally, prefer template strings (using `backticks`), but this is a formatting example:
287-
const out = "Formatting is " + clc.bold.underline("fun") + " and " + clc.green("easy") + ".";
287+
const out = "Formatting is " + bold(underline("fun")) + " and " + green("easy") + ".";
288288
```
289289

290290
Colors will automatically be stripped from environments that do not support
@@ -306,14 +306,14 @@ file), throw a `FirebaseError` with a friendly error message. The original error
306306
may be provided as well. Here's an example:
307307

308308
```typescript
309-
import * as clc from "cli-color";
309+
import { bold } from "colorette";
310310
import { FirebaseError } from "../error";
311311

312-
async function myFunc(options: any): void {
312+
async function myFunc(projectId: string): void {
313313
try {
314-
return await somethingThatMayFail(options.projectId);
314+
return await somethingThatMayFail(projectId);
315315
} catch (err: any) {
316-
throw FirebaseError(`Project ${clc.bold(projectId)} caused an issue.', { original: err });
316+
throw FirebaseError(`Project ${bold(projectId)} caused an issue.', { original: err });
317317
}
318318
}
319319
```

0 commit comments

Comments
 (0)