1+ import { consola } from "consola" ;
12import lodash from "lodash" ;
23import * as typescript from "typescript" ;
34import { CodeFormatter } from "./code-formatter.js" ;
@@ -12,7 +13,6 @@ import { JavascriptTranslator } from "./translators/javascript.js";
1213import { TypeNameFormatter } from "./type-name-formatter.js" ;
1314import { FileSystem } from "./util/file-system.js" ;
1415import { internalCase } from "./util/internal-case.js" ;
15- import { Logger } from "./util/logger.js" ;
1616import { NameResolver } from "./util/name-resolver.js" ;
1717import { pascalCase } from "./util/pascal-case.js" ;
1818import { sortByProperty } from "./util/sort-by-property.js" ;
@@ -36,8 +36,6 @@ class CodeGenProcess {
3636 swaggerSchemaResolver ;
3737 /** @type {SchemaComponentsMap } */
3838 schemaComponentsMap ;
39- /** @type {Logger } */
40- logger ;
4139 /** @type {TypeNameFormatter } */
4240 typeNameFormatter ;
4341 /** @type {SchemaParserFabric } */
@@ -61,7 +59,6 @@ class CodeGenProcess {
6159 */
6260 constructor ( config ) {
6361 this . config = new CodeGenConfig ( config ) ;
64- this . logger = new Logger ( this ) ;
6562 this . fileSystem = new FileSystem ( this ) ;
6663 this . schemaWalker = new SchemaWalker ( this ) ;
6764 this . swaggerSchemaResolver = new SwaggerSchemaResolver ( this ) ;
@@ -72,7 +69,6 @@ class CodeGenProcess {
7269 this . schemaParserFabric = new SchemaParserFabric ( this ) ;
7370 this . schemaRoutes = new SchemaRoutes ( this ) ;
7471 this . javascriptTranslator = new JavascriptTranslator ( this ) ;
75- this . config . componentTypeNameResolver . logger = this . logger ;
7672 }
7773
7874 async start ( ) {
@@ -95,7 +91,7 @@ class CodeGenProcess {
9591 this . schemaWalker . addSchema ( "$usage" , swagger . usageSchema ) ;
9692 this . schemaWalker . addSchema ( "$original" , swagger . originalSchema ) ;
9793
98- this . logger . event ( "start generating your typescript api" ) ;
94+ consola . info ( "start generating your typescript api" ) ;
9995
10096 this . config . update (
10197 this . config . hooks . onInit ( this . config , this ) || this . config ,
@@ -160,11 +156,11 @@ class CodeGenProcess {
160156
161157 if ( this . fileSystem . pathIsExist ( this . config . output ) ) {
162158 if ( this . config . cleanOutput ) {
163- this . logger . debug ( ` cleaning dir ${ this . config . output } ` ) ;
159+ consola . debug ( " cleaning dir" , this . config . output ) ;
164160 this . fileSystem . cleanDir ( this . config . output ) ;
165161 }
166162 } else {
167- this . logger . debug (
163+ consola . debug (
168164 `path ${ this . config . output } is not exist. creating dir by this path` ,
169165 ) ;
170166 this . fileSystem . createDir ( this . config . output ) ;
@@ -185,7 +181,7 @@ class CodeGenProcess {
185181 withPrefix : true ,
186182 } ) ;
187183
188- this . logger . success (
184+ consola . success (
189185 "api file" ,
190186 `"${ file . fileName } ${ file . fileExtension } "` ,
191187 `created in ${ this . config . output } ` ,
@@ -510,7 +506,7 @@ class CodeGenProcess {
510506 const fileExtension = typescript . Extension . Ts ;
511507
512508 if ( configuration . translateToJavaScript ) {
513- this . logger . debug ( "using js translator for" , fileName ) ;
509+ consola . debug ( "using js translator for" , fileName ) ;
514510 return await this . javascriptTranslator . translate ( {
515511 fileName : fileName ,
516512 fileExtension : fileExtension ,
@@ -519,15 +515,15 @@ class CodeGenProcess {
519515 }
520516
521517 if ( configuration . customTranslator ) {
522- this . logger . debug ( "using custom translator for" , fileName ) ;
518+ consola . debug ( "using custom translator for" , fileName ) ;
523519 return await configuration . customTranslator . translate ( {
524520 fileName : fileName ,
525521 fileExtension : fileExtension ,
526522 fileContent : content ,
527523 } ) ;
528524 }
529525
530- this . logger . debug ( "generating output for" , `${ fileName } ${ fileExtension } ` ) ;
526+ consola . debug ( "generating output for" , `${ fileName } ${ fileExtension } ` ) ;
531527
532528 return [
533529 {
0 commit comments