88import { strict as assert } from 'assert' ;
99import * as os from 'os' ;
1010import * as path from 'path' ;
11- import chalk from 'chalk' ;
1211import execa from 'execa' ;
1312import { glob } from 'glob' ;
1413import fs from 'graceful-fs' ;
1514import pLimit from 'p-limit' ;
15+ import pico from 'picocolors' ;
1616import stripJsonComments from 'strip-json-comments' ;
1717import { getPackagesWithTsConfig } from './buildUtils.mjs' ;
1818
@@ -102,7 +102,7 @@ for (const {packageDir, pkg} of packagesWithTs) {
102102
103103 if ( hasJestTestUtils ) {
104104 throw new Error (
105- chalk . red (
105+ pico . red (
106106 `Package '${ pkg . name } ' declares '@jest/test-utils' as dependency, but it must be declared as dev dependency` ,
107107 ) ,
108108 ) ;
@@ -129,7 +129,7 @@ for (const {packageDir, pkg} of packagesWithTs) {
129129
130130 if ( hasJestTestUtils && testUtilsReferences . length === 0 ) {
131131 throw new Error (
132- chalk . red (
132+ pico . red (
133133 `Package '${
134134 pkg . name
135135 } ' declares '@jest/test-utils' as dev dependency, but it is not referenced in:\n\n${ tsConfigPaths . join (
@@ -141,7 +141,7 @@ for (const {packageDir, pkg} of packagesWithTs) {
141141
142142 if ( ! hasJestTestUtils && testUtilsReferences . length > 0 ) {
143143 throw new Error (
144- chalk . red (
144+ pico . red (
145145 `Package '${
146146 pkg . name
147147 } ' does not declare '@jest/test-utils' as dev dependency, but it is referenced in:\n\n${ testUtilsReferences . join (
@@ -159,21 +159,23 @@ const args = [
159159 ...process . argv . slice ( 2 ) ,
160160] ;
161161
162- console . log ( chalk . inverse ( ' Building TypeScript definition files ' ) ) ;
162+ console . log ( pico . inverse ( ' Building TypeScript definition files ' ) ) ;
163163
164164try {
165165 await execa ( 'yarn' , args , { stdio : 'inherit' } ) ;
166166 console . log (
167- chalk . inverse . green ( ' Successfully built TypeScript definition files ' ) ,
167+ pico . inverse (
168+ pico . green ( ' Successfully built TypeScript definition files ' ) ,
169+ ) ,
168170 ) ;
169171} catch ( error ) {
170172 console . error (
171- chalk . inverse . red ( ' Unable to build TypeScript definition files ' ) ,
173+ pico . inverse ( pico . red ( ' Unable to build TypeScript definition files ' ) ) ,
172174 ) ;
173175 throw error ;
174176}
175177
176- console . log ( chalk . inverse ( ' Validating TypeScript definition files ' ) ) ;
178+ console . log ( pico . inverse ( ' Validating TypeScript definition files ' ) ) ;
177179
178180// we want to limit the number of processes we spawn
179181const cpus = Math . max (
@@ -219,8 +221,8 @@ try {
219221 . filter ( ( [ , content ] ) => content . length > 0 )
220222 . filter ( hit => hit . length > 0 )
221223 . map ( ( [ file , references ] ) =>
222- chalk . red (
223- `${ chalk . bold (
224+ pico . red (
225+ `${ pico . bold (
224226 file ,
225227 ) } has the following non-node type references:\n\n${ references } \n`,
226228 ) ,
@@ -251,12 +253,14 @@ try {
251253 ) ;
252254} catch ( error ) {
253255 console . error (
254- chalk . inverse . red ( ' Unable to validate TypeScript definition files ' ) ,
256+ pico . inverse ( pico . red ( ' Unable to validate TypeScript definition files ' ) ) ,
255257 ) ;
256258
257259 throw error ;
258260}
259261
260262console . log (
261- chalk . inverse . green ( ' Successfully validated TypeScript definition files ' ) ,
263+ pico . inverse (
264+ pico . green ( ' Successfully validated TypeScript definition files ' ) ,
265+ ) ,
262266) ;
0 commit comments