@@ -3,7 +3,7 @@ import fs from 'fs';
33import path from 'path' ;
44import * as url from 'url' ;
55
6- import colors from 'ansi-colors' ;
6+ import * as colors from 'ansi-colors' ;
77import { glob } from 'fast-glob' ;
88// eslint-disable-next-line import/order -- what the actual heck, this rule bounces
99import parser from 'yargs-parser' ;
@@ -12,12 +12,11 @@ import type { OpenAPITSOptions } from 'openapi-typescript';
1212
1313import { generate } from '../index.js' ;
1414
15- const { bold, red, green, dim } = colors ;
1615const __dirname = url . fileURLToPath ( new URL ( '.' , import . meta. url ) ) ;
1716
1817/** print error message */
1918export function error ( msg : string ) {
20- console . error ( red ( ` ✘ ${ msg } ` ) ) ; // eslint-disable-line no-console
19+ console . error ( colors . red ( ` ✘ ${ msg } ` ) ) ; // eslint-disable-line no-console
2120}
2221
2322const HELP = `Usage
@@ -140,7 +139,9 @@ async function generateSchema(pathToSpec: string | typeof process.stdin) {
140139 const timeEnd = process . hrtime ( timeStart ) ;
141140 const time = timeEnd [ 0 ] + Math . round ( timeEnd [ 1 ] / 1e6 ) ;
142141 console . log (
143- `🚀 ${ green ( `${ pathToSpec } → ${ bold ( outputFilePath . toString ( ) ) } ` ) } ${ dim ( `[${ time } ms]` ) } ` ,
142+ `🚀 ${ colors . green ( `${ pathToSpec } → ${ colors . bold ( outputFilePath . toString ( ) ) } ` ) } ${ colors . dim (
143+ `[${ time } ms]` ,
144+ ) } `,
144145 ) ;
145146 } else {
146147 process . stdout . write ( result ) ;
@@ -168,7 +169,7 @@ async function main() {
168169 const outputDir = new URL ( '.' , outputFile ) ;
169170
170171 if ( output === OUTPUT_FILE )
171- console . info ( `✨ ${ bold ( `openapi-typescript ${ packageJSON . version } ` ) } ` ) ; // only log if we’re NOT writing to stdout
172+ console . info ( `✨ ${ colors . bold ( `openapi-typescript ${ packageJSON . version } ` ) } ` ) ; // only log if we’re NOT writing to stdout
172173
173174 const pathToSpec = flags . _ [ 0 ] as string ;
174175
0 commit comments