From 23182a7b0037d9d2816096a0905cde210dfcdc26 Mon Sep 17 00:00:00 2001 From: Aayush Date: Tue, 19 Sep 2023 13:12:52 +0530 Subject: [PATCH] Improve the log and correct the path --- src/commands/optimize.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/commands/optimize.ts b/src/commands/optimize.ts index 8c12c2dd57a..8b5a8be2156 100644 --- a/src/commands/optimize.ts +++ b/src/commands/optimize.ts @@ -99,9 +99,12 @@ export default class Optimize extends Command { const specPath = specFile.getFilePath(); let newPath = ''; + let originalPath = ''; + if (specPath) { const pos = specPath.lastIndexOf('.'); newPath = `${specPath.substring(0,pos) }_optimized.${ specPath.substring(pos+1)}`; + } else { newPath = 'optimized-asyncapi.yaml'; } @@ -113,7 +116,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({