How to use the @microsoft/api-extractor.CompilerState.create 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 / build-tests / api-extractor-scenarios / src / runScenarios.ts View on Github external
}

  let compilerState: CompilerState | undefined = undefined;
  let anyErrors: boolean = false;
  process.exitCode = 1;

  for (const scenarioFolderName of buildConfig.scenarioFolderNames) {
    const apiExtractorJsonPath: string = `./temp/configs/api-extractor-${scenarioFolderName}.json`;

    console.log('Scenario: ' + scenarioFolderName);

    // Run the API Extractor command-line
    const extractorConfig: ExtractorConfig = ExtractorConfig.loadFileAndPrepare(apiExtractorJsonPath);

    if (!compilerState) {
      compilerState = CompilerState.create(extractorConfig, {
        additionalEntryPoints: entryPoints
      });
    }

    const extractorResult: ExtractorResult = Extractor.invoke(extractorConfig, {
      localBuild: true,
      showVerboseMessages: true,
      messageCallback: (message: ExtractorMessage) => {
        if (message.messageId === ConsoleMessageId.ApiReportCreated) {
          // This script deletes the outputs for a clean build, so don't issue a warning if the file gets created
          message.logLevel = ExtractorLogLevel.None;
        }
      },
      compilerState
    });
github strongloop / loopback-next / packages / tsdocs / src / monorepo-api-extractor.ts View on Github external
function invokeExtractor(
  extractorConfig: ExtractorConfig,
  options: ExtractorOptions,
) {
  const compilerState = CompilerState.create(extractorConfig, {
    // typescriptCompilerFolder: options.typescriptCompilerFolder,
  });

  /* istanbul ignore if  */
  if (options.dryRun) return;

  const extractorResult: ExtractorResult = Extractor.invoke(extractorConfig, {
    typescriptCompilerFolder: options.typescriptCompilerFolder,
    localBuild: true,
    showVerboseMessages: !options.silent,
    messageCallback: (message: ExtractorMessage) => {
      if (message.messageId === ConsoleMessageId.ApiReportCreated) {
        // This script deletes the outputs for a clean build,
        // so don't issue a warning if the file gets created
        message.logLevel = ExtractorLogLevel.None;
      }