Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api-extractor] Support customizing defaults when loading config #4345

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dmichon-msft
Copy link
Contributor

Summary

Adds the ability for tools consuming API-Extractor to customize the default values when loading config files.

Details

Provided custom defaults override global defaults, then the config file values are written on top of them.
 
Uses this ability in heft-api-extractor-plugin to change the default API report temp folder in the Heft task temp folder.

How it was tested

Added unit test for config file custom defaults.
Validated new location for temp api.md file in rushstack projects.

Impacted documentation

Currently none, unless something mentions the path to which heft-api-extractor-plugin writes its temp files.

@@ -16,22 +17,40 @@ function expectEqualPaths(path1: string, path2: string): void {

// Tests for expanding the "<lookup>" token for the "projectFolder" setting in api-extractor.json
describe(`${ExtractorConfig.name}.${ExtractorConfig.loadFileAndPrepare.name}`, () => {
it.only('config-lookup1: looks up ./api-extractor.json', () => {
Copy link
Collaborator

@octogonz octogonz Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🫢 We need an ESLint rule to forbid it.only() from getting merged accidentally

(not in this PR of course)

apiExtractorPackage.ExtractorConfig.loadFile(apiExtractorConfigurationFilePath);
apiExtractorPackage.ExtractorConfig.loadFile(apiExtractorConfigurationFilePath, {
apiReport: {
reportTempFolder: taskSession.tempFolderPath
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we simply set reportTempFolder in api-extractor.json in the rig?

(Generally we aim for the config file is meant to represent the tool's configuration, not an input to a mysterious black box that produces the actual configuration.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: AE/AD
Development

Successfully merging this pull request may close these issues.

None yet

2 participants