How to use the @microsoft/api-extractor.ExternalApiHelper.generateApiJson function in @microsoft/api-extractor

To help you get started, we’ve selected a few @microsoft/api-extractor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / rushstack / gulp-core-build-typescript / src / RunApiExtractorOnExternalApiTypes.ts View on Github external
public executeTask(gulp: gulp.Gulp, completeCallback?: (result?: Object) => void): void {
    let outputPath: string = path.join(this.buildConfig.rootPath, this.buildConfig.distFolder);
    if (!fs.existsSync(outputPath)) {
      fs.mkdirSync(outputPath);
    }

    outputPath = path.join(outputPath, 'external-api-json');
    if (!fs.existsSync(outputPath)) {
      fs.mkdirSync(outputPath);
    }

    for (const filePath of files) {
      const rootDir: string = path.dirname(filePath);
      const outputApiJsonFilePath: string = path.join(outputPath, `${path.basename(rootDir)}.api.json`);
      const entryPointFile: string = path.join(this.buildConfig.rootPath, filePath);
      ExternalApiHelper.generateApiJson(this.buildConfig.rootPath, entryPointFile, outputApiJsonFilePath);
    }

    completeCallback();
  }
}