@@ -45,7 +45,7 @@ const generateFile = options => new Promise((resolve, reject) => {
45
45
const template = Handlebars . compile ( content ) ;
46
46
const parsed_content = template ( data ) ;
47
47
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 $ / , '' ) ;
49
49
fs . writeFile ( generated_path , parsed_content , 'utf8' , ( err ) => {
50
50
if ( err ) return reject ( err ) ;
51
51
resolve ( ) ;
@@ -68,7 +68,7 @@ const generateOperationFile = (config, operation, operation_name) => new Promise
68
68
fs . readFile ( path . join ( config . root , config . file_name ) , 'utf8' , ( err , data ) => {
69
69
if ( err ) return reject ( err ) ;
70
70
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 $ / , '' ) ;
72
72
const target_file = path . resolve ( config . target_dir , subdir , new_filename ) ;
73
73
const template = Handlebars . compile ( data . toString ( ) ) ;
74
74
const content = template ( {
0 commit comments