From b445ca7ff7cae4cdcad4de2e01c9cfcd6cfc6413 Mon Sep 17 00:00:00 2001 From: Zack_Aayush <60972989+AayushSaini101@users.noreply.github.com> Date: Tue, 19 Sep 2023 15:18:16 +0530 Subject: [PATCH] feat: improve the log and correct the path name using optimise command (#811) Co-authored-by: Aayush --- src/commands/optimize.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/commands/optimize.ts b/src/commands/optimize.ts index 8c12c2dd57a..f21f14b764f 100644 --- a/src/commands/optimize.ts +++ b/src/commands/optimize.ts @@ -99,6 +99,7 @@ export default class Optimize extends Command { const specPath = specFile.getFilePath(); let newPath = ''; + if (specPath) { const pos = specPath.lastIndexOf('.'); newPath = `${specPath.substring(0,pos) }_optimized.${ specPath.substring(pos+1)}`; @@ -113,7 +114,8 @@ export default class Optimize extends Command { this.log(`Created file ${newPath}...`); } else if (this.outputMethod === Outputs.OVERWRITE) { await writeFile(specPath ?? 'asyncapi.yaml', optimizedDocument, { encoding: 'utf8' }); - this.log(`Created file ${newPath}...`); + + this.log(`Updated file ${specPath}...`); } } catch (error) { throw new ValidationError({