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({