11/* eslint-disable no-console */
22'use strict' ;
33
4- const chalk = require ( 'chalk ' ) ;
4+ const { styleText } = require ( 'node:util ' ) ;
55const fs = require ( 'fs' ) ;
66const globSync = require ( 'glob' ) . globSync ;
77const mkdirp = require ( 'mkdirp' ) ;
@@ -38,8 +38,10 @@ module.exports = {
3838 if ( podModulePrefix ) {
3939 if ( ! modulePrefix || ! podModulePrefix . startsWith ( `${ modulePrefix } /` ) ) {
4040 console . log (
41- chalk . yellow (
42- `${ chalk . bold (
41+ styleText (
42+ 'yellow' ,
43+ `${ styleText (
44+ 'bold' ,
4345 'Note:'
4446 ) } There is an automated refactor script available for this feature, but your \`podModulePrefix\` could not be processed correctly.\n`
4547 )
@@ -50,8 +52,10 @@ module.exports = {
5052 podsFolder = podModulePrefix . slice ( modulePrefix . length + 1 ) ;
5153 if ( ! podsFolder ) {
5254 console . log (
53- chalk . yellow (
54- `${ chalk . bold (
55+ styleText (
56+ 'yellow' ,
57+ `${ styleText (
58+ 'bold' ,
5559 'Note:'
5660 ) } There is an automated refactor script available for this feature, but your \`podModulePrefix\` could not be processed correctly.\n`
5761 )
@@ -144,7 +148,7 @@ module.exports = {
144148
145149 if ( shouldRunCodemod === undefined ) {
146150 console . log ( strip `
147- Enabling ${ chalk . bold ( 'template-only-glimmer-components' ) } ...
151+ Enabling ${ styleText ( 'bold' , 'template-only-glimmer-components' ) } ...
148152
149153 This will change the semantics for template-only components (components without a \`.js\` file).
150154
@@ -156,13 +160,16 @@ module.exports = {
156160
157161 - Passing classes in the invocation (i.e. \`{{my-component class="..."}}\`) will not work, since there is no wrapper element to apply the classes to.
158162
159- For more information, see ${ chalk . underline (
163+ For more information, see ${ styleText (
164+ 'underline' ,
160165 'https://github.com/emberjs/rfcs/pull/278'
161166 ) } .
162167
163- While these changes may be desirable for ${ chalk . italic (
168+ While these changes may be desirable for ${ styleText (
169+ 'italic' ,
164170 'new components'
165- ) } , they may unexpectedly break the styling or runtime behavior of your ${ chalk . italic (
171+ ) } , they may unexpectedly break the styling or runtime behavior of your ${ styleText (
172+ 'italic' ,
166173 'existing components'
167174 ) } .
168175
@@ -173,9 +180,13 @@ module.exports = {
173180 for ( let i = 0 ; i < templates . length ; i ++ ) {
174181 console . log ( strip `
175182 ${ INDENT_START }
176- - ${ chalk . underline ( templates [ i ] ) }
177- ${ chalk . gray (
178- `(Recommendation: add ${ chalk . cyan . underline ( components [ i ] ) } )`
183+ - ${ styleText ( 'underline' , templates [ i ] ) }
184+ ${ styleText (
185+ 'gray' ,
186+ `(Recommendation: add ${ styleText (
187+ 'cyan' ,
188+ styleText ( 'underline' , components [ i ] )
189+ ) } )`
179190 ) }
180191 ` ) ;
181192 }
@@ -195,7 +206,7 @@ module.exports = {
195206 if ( shouldRunCodemod ) {
196207 for ( let i = 0 ; i < components . length ; i ++ ) {
197208 let componentPath = components [ i ] ;
198- console . log ( ` ${ chalk . green ( 'create' ) } ${ componentPath } ` ) ;
209+ console . log ( ` ${ styleText ( 'green' , 'create' ) } ${ componentPath } ` ) ;
199210 let absolutePath = path . join ( project . root , componentPath ) ;
200211 await mkdirp ( path . dirname ( absolutePath ) ) ;
201212 await p ( fs . writeFile ) ( absolutePath , ComponentFile , {
0 commit comments