11const fs = require ( 'fs' )
22const path = require ( 'path' )
3- const chalk = require ( 'chalk ' )
3+ const colors = require ( 'picocolors ' )
44const confirm = require ( '@inquirer/confirm' ) . default
55const invariant = require ( './invariant' )
66const { SERVICE_WORKER_BUILD_PATH } = require ( '../config/constants' )
@@ -34,7 +34,7 @@ module.exports = async function init(args) {
3434 // will equal to false.
3535 else if ( args . save == null ) {
3636 console . log ( `\
37- ${ chalk . cyan (
37+ ${ colors . cyan (
3838 'INFO' ,
3939 ) } In order to ease the future updates to the worker script,
4040 we recommend saving the path to the worker directory in your package.json.` )
@@ -141,20 +141,20 @@ async function copyWorkerScript(destination, cwd) {
141141 */
142142function printSuccessMessage ( paths ) {
143143 console . log ( `
144- ${ chalk . green ( 'Worker script successfully copied!' ) }
145- ${ paths . map ( ( path ) => chalk . gray ( ` - ${ path } \n` ) ) }
144+ ${ colors . green ( 'Worker script successfully copied!' ) }
145+ ${ paths . map ( ( path ) => colors . gray ( ` - ${ path } \n` ) ) }
146146Continue by describing the network in your application:
147147
148148
149- ${ chalk . cyan . bold ( 'https://mswjs.io/docs/getting-started' ) }
149+ ${ colors . red ( colors . bold ( 'https://mswjs.io/docs/getting-started' ) ) }
150150` )
151151}
152152
153153function printFailureMessage ( pathsWithErrors ) {
154154 console . error ( `\
155- ${ chalk . red ( 'Copying the worker script failed at following paths:' ) }
155+ ${ colors . red ( 'Copying the worker script failed at following paths:' ) }
156156${ pathsWithErrors
157- . map ( ( [ path , error ] ) => chalk . gray ( ` - ${ path } ` ) + '\n' + ` ${ error } ` )
157+ . map ( ( [ path , error ] ) => colors . gray ( ` - ${ path } ` ) + '\n' + ` ${ error } ` )
158158 . join ( '\n\n' ) }
159159 ` )
160160}
@@ -167,7 +167,7 @@ function saveWorkerDirectory(packageJsonPath, publicDir) {
167167 const packageJson = JSON . parse ( fs . readFileSync ( packageJsonPath , 'utf8' ) )
168168
169169 console . log (
170- chalk . gray ( 'Updating "msw.workerDirectory" at "%s"...' ) ,
170+ colors . gray ( 'Updating "msw.workerDirectory" at "%s"...' ) ,
171171 packageJsonPath ,
172172 )
173173
@@ -200,7 +200,7 @@ function saveWorkerDirectory(packageJsonPath, publicDir) {
200200function promptWorkerDirectoryUpdate ( message , packageJsonPath , publicDir ) {
201201 return confirm ( {
202202 theme : {
203- prefix : chalk . yellowBright ( '?' ) ,
203+ prefix : colors . yellowBright ( '?' ) ,
204204 } ,
205205 message,
206206 } ) . then ( ( answer ) => {
0 commit comments