@@ -45,7 +45,7 @@ const generateFile = options => new Promise((resolve, reject) => {
4545 const template = Handlebars . compile ( content ) ;
4646 const parsed_content = template ( data ) ;
4747 const template_path = path . relative ( templates_dir , path . resolve ( root , file_name ) ) ;
48- const generated_path = path . resolve ( target_dir , template_path ) . replace ( ' .hbs' , '' ) ;
48+ const generated_path = path . resolve ( target_dir , template_path ) . replace ( / .h b s $ / , '' ) ;
4949 fs . writeFile ( generated_path , parsed_content , 'utf8' , ( err ) => {
5050 if ( err ) return reject ( err ) ;
5151 resolve ( ) ;
@@ -68,7 +68,7 @@ const generateOperationFile = (config, operation, operation_name) => new Promise
6868 fs . readFile ( path . join ( config . root , config . file_name ) , 'utf8' , ( err , data ) => {
6969 if ( err ) return reject ( err ) ;
7070 const subdir = config . root . replace ( new RegExp ( `${ config . templates_dir } [/]?` ) , '' ) ;
71- const new_filename = config . file_name . replace ( '$$path$$' , operation_name ) . replace ( ' .hbs' , '' ) ;
71+ const new_filename = config . file_name . replace ( '$$path$$' , operation_name ) . replace ( / .h b s $ / , '' ) ;
7272 const target_file = path . resolve ( config . target_dir , subdir , new_filename ) ;
7373 const template = Handlebars . compile ( data . toString ( ) ) ;
7474 const content = template ( {
0 commit comments