Skip to content

Commit 64fcb3a

Browse files
roli-lpciclaude
andcommitted
chore: replace chalk with picocolors and remove rimraf
- Replace chalk (≈44KB) with picocolors (≈3KB) in test utility - Replace rimraf prebuild script with native fs.rmSync (Node >=18) - Net removal of 2 dependencies Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f32bd1b commit 64fcb3a

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"node": ">=18"
1010
},
1111
"scripts": {
12-
"prebuild": "rimraf dist",
12+
"prebuild": "node -e \"fs.rmSync('dist',{recursive:true,force:true})\"",
1313
"build": "npm-run-all --parallel build:main build:bundle:main build:bundle:pure",
1414
"build:bundle:main": "dotenv -e .bundle.main.env kcd-scripts build -- --bundle --no-clean --no-ts-defs",
1515
"build:bundle:pure": "dotenv -e .bundle.main.env -e .bundle.pure.env kcd-scripts build -- --bundle --no-clean --no-ts-defs",
@@ -52,14 +52,13 @@
5252
"@testing-library/jest-dom": "^5.11.6",
5353
"@types/react": "^19.0.0",
5454
"@types/react-dom": "^19.0.0",
55-
"chalk": "^4.1.2",
5655
"dotenv-cli": "^4.0.0",
5756
"jest-diff": "^29.7.0",
5857
"kcd-scripts": "^13.0.0",
5958
"npm-run-all2": "^6.2.6",
59+
"picocolors": "^1.1.1",
6060
"react": "^19.0.0",
6161
"react-dom": "^19.0.0",
62-
"rimraf": "^3.0.2",
6362
"typescript": "^5.9.3"
6463
},
6564
"peerDependencies": {

tests/failOnUnexpectedConsoleCalls.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SOFTWARE.
2525
/* eslint-disable prefer-template */
2626
/* eslint-disable func-names */
2727
const util = require('util')
28-
const chalk = require('chalk')
28+
const pc = require('picocolors')
2929
const shouldIgnoreConsoleError = require('./shouldIgnoreConsoleError')
3030

3131
const patchConsoleMethod = (methodName, unexpectedConsoleCallStacks) => {
@@ -69,23 +69,23 @@ const flushUnexpectedConsoleCalls = (
6969
if (unexpectedConsoleCallStacks.length > 0) {
7070
const messages = unexpectedConsoleCallStacks.map(
7171
([stack, message]) =>
72-
`${chalk.red(message)}\n` +
72+
`${pc.red(message)}\n` +
7373
`${stack
7474
.split('\n')
75-
.map(line => chalk.gray(line))
75+
.map(line => pc.gray(line))
7676
.join('\n')}`,
7777
)
7878

7979
const message =
80-
`Expected test not to call ${chalk.bold(
80+
`Expected test not to call ${pc.bold(
8181
`console.${methodName}()`,
8282
)}.\n\n` +
8383
'If the warning is expected, test for it explicitly by:\n' +
84-
`1. Using the ${chalk.bold('.' + expectedMatcher + '()')} ` +
84+
`1. Using the ${pc.bold('.' + expectedMatcher + '()')} ` +
8585
`matcher, or...\n` +
86-
`2. Mock it out using ${chalk.bold(
86+
`2. Mock it out using ${pc.bold(
8787
'spyOnDev',
88-
)}(console, '${methodName}') or ${chalk.bold(
88+
)}(console, '${methodName}') or ${pc.bold(
8989
'spyOnProd',
9090
)}(console, '${methodName}'), and test that the warning occurs.`
9191

0 commit comments

Comments
 (0)