@@ -3,7 +3,7 @@ import fs from 'fs';
3
3
import path from 'path' ;
4
4
import * as url from 'url' ;
5
5
6
- import colors from 'ansi-colors' ;
6
+ import * as colors from 'ansi-colors' ;
7
7
import { glob } from 'fast-glob' ;
8
8
// eslint-disable-next-line import/order -- what the actual heck, this rule bounces
9
9
import parser from 'yargs-parser' ;
@@ -12,12 +12,11 @@ import type { OpenAPITSOptions } from 'openapi-typescript';
12
12
13
13
import { generate } from '../index.js' ;
14
14
15
- const { bold, red, green, dim } = colors ;
16
15
const __dirname = url . fileURLToPath ( new URL ( '.' , import . meta. url ) ) ;
17
16
18
17
/** print error message */
19
18
export 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
21
20
}
22
21
23
22
const HELP = `Usage
@@ -140,7 +139,9 @@ async function generateSchema(pathToSpec: string | typeof process.stdin) {
140
139
const timeEnd = process . hrtime ( timeStart ) ;
141
140
const time = timeEnd [ 0 ] + Math . round ( timeEnd [ 1 ] / 1e6 ) ;
142
141
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
+ ) } `,
144
145
) ;
145
146
} else {
146
147
process . stdout . write ( result ) ;
@@ -168,7 +169,7 @@ async function main() {
168
169
const outputDir = new URL ( '.' , outputFile ) ;
169
170
170
171
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
172
173
173
174
const pathToSpec = flags . _ [ 0 ] as string ;
174
175
0 commit comments