diff --git a/lib/codegen.js b/lib/codegen.js index e19efd7..d05f45e 100644 --- a/lib/codegen.js +++ b/lib/codegen.js @@ -83,7 +83,9 @@ const generateOperationFile = (config, operation, operation_name) => new Promise if (err) return reject(err); const subdir = config.root.replace(new RegExp(`${config.templates_dir}[/]?`),''); const new_filename = config.file_name.replace('___', operation_name); - const target_file = path.resolve(config.target_dir, subdir, new_filename); + const target_file_path = path.join(config.target_dir, subdir.replace(config.templates_dir, '')); + xfs.mkdirpSync(target_file_path) + const target_file = path.resolve(target_file_path, new_filename); const template = Handlebars.compile(data.toString()); const content = template({