async generateFile(asyncapiDocument, fileName, baseDir) {
    const sourceFile = path.resolve(baseDir, fileName);
    const relativeSourceFile = path.relative(this.templateContentDir, sourceFile);
    const relativeSourceDirectory = relativeSourceFile.split(path.sep)[0] || '.';
  
    const targetFile = path.resolve(this.targetDir, this.maybeRenameSourceFile(relativeSourceFile));
    const relativeTargetFile = path.relative(this.targetDir, targetFile);
    let shouldGenerate = true;
  
    if (shouldIgnoreFile(relativeSourceFile)) return;
    
    if (!(await this.shouldOverwriteFile(relativeTargetFile))) return;

    // conditionalFiles becomes deprecated with this PR, and soon will be removed.
    // TODO: https://github.com/asyncapi/generator/issues/1553
    let conditionalPath = '';
    if (
      this.templateConfig.conditionalFiles &&
      this.templateConfig.conditionalGeneration
    ) {
      log.debug(
        'Both \'conditionalFiles\' and \'conditionalGeneration\' are defined. Ignoring \'conditionalFiles\' and using \'conditionalGeneration\' only.'
      );
    }

    if (this.templateConfig.conditionalGeneration?.[relativeSourceDirectory]) {
      conditionalPath = relativeSourceDirectory;
    } else if (this.templateConfig.conditionalGeneration?.[relativeSourceFile]) {
      conditionalPath = relativeSourceFile;
    } else
    if (this.templateConfig.conditionalFiles?.[relativeSourceFile]) {  
      // conditionalFiles becomes deprecated with this PR, and soon will be removed.
      // TODO: https://github.com/asyncapi/generator/issues/1553
      conditionalPath = relativeSourceDirectory;
    }
   
    if (conditionalPath) {
      shouldGenerate = await isGenerationConditionMet(
        this.templateConfig,
        conditionalPath,
        this.templateParams,
        asyncapiDocument
      );
    }
    
    if (!shouldGenerate) {
      if (this.templateConfig.conditionalFiles?.[relativeSourceFile]) {
        // conditionalFiles becomes deprecated with this PR, and soon will be removed.
        // TODO: https://github.com/asyncapi/generator/issues/1553
        return log.debug(logMessage.conditionalFilesMatched(relativeSourceFile));
      }
      
      return log.debug(logMessage.conditionalGenerationMatched(conditionalPath));
    }
    
    if (this.isNonRenderableFile(relativeSourceFile)) return await copyFile(sourceFile, targetFile);
    await this.renderAndWriteToFile(asyncapiDocument, sourceFile, targetFile);
    log.debug(`Successfully rendered template and wrote file ${relativeSourceFile} to location: ${targetFile}`);
  }
Generates a file.

@private
@param {AsyncAPIDocument} asyncapiDocument AsyncAPI document to use as the source.
@param {String} fileName Name of the file to generate for each channel.
@param {String} baseDir Base directory of the given file name.
@return {Promise}