File tree Expand file tree Collapse file tree
packages/router-generator/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,21 +41,37 @@ export function trimPathLeft(path: string) {
4141}
4242
4343export function logging ( config : { disabled : boolean } ) {
44+ function stripEmojis ( str : string ) {
45+ return str . replace (
46+ / [ \p{ Emoji_Presentation} \p{ Extended_Pictographic} ] / gu,
47+ '' ,
48+ )
49+ }
50+
51+ function formatLogArgs ( args : Array < any > ) : Array < any > {
52+ if ( process . env . CI ) {
53+ return args . map ( ( arg ) =>
54+ typeof arg === 'string' ? stripEmojis ( arg ) : arg ,
55+ )
56+ }
57+ return args
58+ }
59+
4460 return {
4561 log : ( ...args : Array < any > ) => {
46- if ( ! config . disabled ) console [ ' log' ] ( ...args )
62+ if ( ! config . disabled ) console . log ( ...formatLogArgs ( args ) )
4763 } ,
4864 debug : ( ...args : Array < any > ) => {
49- if ( ! config . disabled ) console . debug ( ...args )
65+ if ( ! config . disabled ) console . debug ( ...formatLogArgs ( args ) )
5066 } ,
5167 info : ( ...args : Array < any > ) => {
52- if ( ! config . disabled ) console . info ( ...args )
68+ if ( ! config . disabled ) console . info ( ...formatLogArgs ( args ) )
5369 } ,
5470 warn : ( ...args : Array < any > ) => {
55- if ( ! config . disabled ) console . warn ( ...args )
71+ if ( ! config . disabled ) console . warn ( ...formatLogArgs ( args ) )
5672 } ,
5773 error : ( ...args : Array < any > ) => {
58- if ( ! config . disabled ) console . error ( ...args )
74+ if ( ! config . disabled ) console . error ( ...formatLogArgs ( args ) )
5975 } ,
6076 }
6177}
You can’t perform that action at this time.
0 commit comments