rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

[api-extractor] Invoking from build script always outputs to sdtout/stderr

Open JasonGore opened this issue 3 years ago • 0 comments

Summary

With the following invocation (suppressing output as much as I know how based on documentation):

  const extractorResult = Extractor.invoke(extractorConfig, {
    localBuild: false,
    showVerboseMessages: false,
    showDiagnostics: false,
    messageCallback: () => {}
  });

API extractor still shows output:

ERR! Analysis will use the bundled TypeScript version 4.6.4
ERR! *** The target project appears to use TypeScript 4.7.2 which is newer than the bundled compiler engine; consider upgrading API Extractor.
ERR! Warning: You have changed the public API signature for this project. Please copy the file "temp/loop-app-data-models.api.md" to ".api-extractor/loop-app-data-models.api.md", or perform a local build (which does this automatically). See the Git repo documentation for more info.

As I am invoking from a build script, I have other actions for users to take in this scenario and this is leading to unnecessary confusion. I don't think output should be displayed for the following reasons:

  1. I am invoking via build script / programmatic invocation, not CLI. There shouldn't be any stdout/stderr output
  2. I'm configuring invoke to suppress output and supplying a compiler message callback function

Repro steps

Expected result:

No stdout/stderr output when invoked programmatically with suppressed and message callback configuration.

Actual result:

Typescript warnings and API error with guidance that I wish to suppress.

ERR! Analysis will use the bundled TypeScript version 4.6.4
ERR! *** The target project appears to use TypeScript 4.7.2 which is newer than the bundled compiler engine; consider upgrading API Extractor.
ERR! Warning: You have changed the public API signature for this project. Please copy the file "temp/loop-app-data-models.api.md" to ".api-extractor/loop-app-data-models.api.md", or perform a local build (which does this automatically). See the Git repo documentation for more info.

Details

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/api-extractor version? 7.28.3
Operating system? Windows 10
API Extractor scenario? reporting (.api.md)
Would you consider contributing a PR? yes
TypeScript compiler version? 4.7.2
Node.js version (node -v)? 16.16.0

JasonGore avatar Jul 14 '22 23:07 JasonGore