diff --git a/lib/generator.js b/lib/generator.js index 0203f3a64..10efa7d69 100644 --- a/lib/generator.js +++ b/lib/generator.js @@ -168,7 +168,7 @@ class Generator { */ async generate(asyncapiDocument, parseOptions = {}) { this.validateAsyncAPIDocument(asyncapiDocument); - this.setupOutput(); + await this.setupOutput(); this.setLogLevel(); await this.installAndSetupTemplate(); @@ -200,13 +200,15 @@ class Generator { * * @example * const generator = new Generator(); - * generator.setupOutput(); - * + * await generator.setupOutput(); + * + * @async + * * @throws {Error} If 'output' is set to 'string' without providing 'entrypoint'. */ - setupOutput() { + async setupOutput() { if (this.output === 'fs') { - this.setupFSOutput(); + await this.setupFSOutput(); } else if (this.output === 'string' && this.entrypoint === undefined) { throw new Error('Parameter entrypoint is required when using output = "string"'); }