Skip to content

Commit 53226c6

Browse files
committed
refactor: drop chalk usages in favor of built-in util.styleText
1 parent 8603489 commit 53226c6

File tree

12 files changed

+179
-685
lines changed

12 files changed

+179
-685
lines changed

.github/local-actions/branch-manager/main.js

Lines changed: 158 additions & 651 deletions
Large diffs are not rendered by default.

bazel/api-golden/index_npm_packages.cts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {readFileSync} from 'fs';
1313
import {testApiGolden} from './test_api_report.js';
1414
import * as fs from 'fs';
1515
import {Piscina} from 'piscina';
16+
import {styleText} from 'util';
1617

1718
/** Interface describing contents of a `package.json`. */
1819
export interface PackageJson {
@@ -36,9 +37,8 @@ async function main(
3637
) {
3738
/** Whether the goldenDir provided is actually pointing to a single file. */
3839
const singleFileMode = fs.existsSync(goldenDir) && fs.statSync(goldenDir).isFile();
39-
// TODO(ESM) This can be replaced with an actual ESM import when `ts_library` is
40-
// guaranteed to be ESM-only and supports the `mts` extension.
41-
const chalk = {red: (v: string) => v, yellow: (v: string) => v};
40+
const red = styleText.bind(null, 'red');
41+
const yellow = styleText.bind(null, 'yellow');
4242

4343
const packageJsonPath = path.join(npmPackageDir, 'package.json');
4444
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')) as PackageJson;
@@ -124,16 +124,16 @@ async function main(
124124
console.error(Array(80).fill('=').join(''));
125125
if (singleFileMode) {
126126
console.error(
127-
chalk.red(
127+
red(
128128
`The golden is out of date and can be updated by running:\n - bazel run ${process.env.TEST_TARGET}.accept`,
129129
),
130130
);
131131
} else {
132-
console.error(chalk.red(`The following goldens are outdated:`));
132+
console.error(red(`The following goldens are outdated:`));
133133
outdatedGoldens.forEach((name) => console.info(`- ${name}`));
134134
console.info();
135135
console.info(
136-
chalk.yellow(
136+
yellow(
137137
`The goldens can be updated by running:\n - bazel run ${process.env.TEST_TARGET}.accept`,
138138
),
139139
);

bazel/integration/test_runner/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ ts_project(
99
tsconfig = "//bazel:tsconfig",
1010
deps = [
1111
"//bazel:node_modules/@types/node",
12-
"//bazel:node_modules/chalk",
1312
"//bazel:node_modules/tinyglobby",
1413
"//bazel:node_modules/true-case-path",
1514
],

bazel/integration/test_runner/size-tracking.mts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@
77
*/
88

99
import {runCommandInChildProcess} from './process_utils.mjs';
10+
import {styleText} from 'node:util';
1011
import {existsSync} from 'node:fs';
1112
import fs from 'node:fs/promises';
1213
import path from 'node:path';
13-
import chalk from 'chalk';
1414
import {debug} from './debug.mjs';
1515
import {globSync} from 'tinyglobby';
1616

17-
// Convience access to chalk colors.
18-
const {red, green} = chalk;
17+
// Convience access to colors.
18+
export const red = styleText.bind(null, 'red');
19+
export const green = styleText.bind(null, 'green');
1920
/** The size discrepancy we allow in bytes. */
2021
const THRESHOLD_BYTES = 5000;
2122
/** The size discrepancy as a percentage. */

bazel/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"@types/source-map-support": "0.5.10",
1212
"@types/yargs": "17.0.35",
1313
"browser-sync": "3.0.4",
14-
"chalk": "5.6.2",
1514
"get-tsconfig": "4.13.0",
1615
"piscina": "^5.0.0",
1716
"send": "1.2.0",

ng-dev/misc/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ ts_project(
77
deps = [
88
"//ng-dev:node_modules/@types/node",
99
"//ng-dev:node_modules/@types/yargs",
10-
"//ng-dev:node_modules/chalk",
1110
"//ng-dev/release/build",
1211
"//ng-dev/release/config",
1312
"//ng-dev/utils",

ng-dev/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
"@types/yarnpkg__lockfile": "1.1.9",
4545
"@yarnpkg/lockfile": "1.1.0",
4646
"bufferutil": "4.0.9",
47-
"chalk": "5.6.2",
4847
"cli-progress": "3.12.0",
4948
"conventional-commits-filter": "5.0.0",
5049
"conventional-commits-parser": "6.2.1",

ng-dev/pr/merge/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ ts_project(
2727
"//ng-dev:node_modules/@types/node",
2828
"//ng-dev:node_modules/@types/semver",
2929
"//ng-dev:node_modules/@types/yargs",
30-
"//ng-dev:node_modules/chalk",
3130
"//ng-dev:node_modules/typed-graphqlify",
3231
"//ng-dev/commit-message",
3332
"//ng-dev/pr/common",

ng-dev/ts-circular-dependencies/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ ts_project(
77
deps = [
88
"//ng-dev:node_modules/@types/node",
99
"//ng-dev:node_modules/@types/yargs",
10-
"//ng-dev:node_modules/chalk",
1110
"//ng-dev:node_modules/fast-glob",
1211
"//ng-dev:node_modules/typescript",
1312
"//ng-dev/utils",

ng-dev/utils/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ ts_project(
5757
"//ng-dev:node_modules/@types/yargs",
5858
"//ng-dev:node_modules/@types/yarnpkg__lockfile",
5959
"//ng-dev:node_modules/@yarnpkg/lockfile",
60-
"//ng-dev:node_modules/chalk",
6160
"//ng-dev:node_modules/semver",
6261
"//ng-dev:node_modules/supports-color",
6362
"//ng-dev:node_modules/typed-graphqlify",

0 commit comments

Comments
 (0)