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] config merge preserves longer array entries (reportVariants can't be reduced) #4786

Open
jason-ha opened this issue Jun 15, 2024 · 0 comments

Comments

@jason-ha
Copy link

Summary

Using a base configuration with long reportVariants such as

	"apiReport": {
		"reportVariants": ["public", "beta"]
	},

cannot be shortened in a derived config.

If the derived specifies:

	"apiReport": {
		"reportVariants": ["alpha"]
	},

The result using loadash.merge is

	"apiReport": {
		"reportVariants": ["alpha", "beta"]
	},

Workaround

Use array with duplicate entries to mask base config.
"reportVariants": ["alpha", "alpha"]

will produce internal "reportConfigs":

  "reportConfigs": [
    {
      "fileName": "fluid-framework.alpha.api.md",
      "variant": "alpha"
    },
    {
      "fileName": "fluid-framework.alpha.api.md",
      "variant": "alpha"
    }
  ],

but won't fail.

Details

Problem occurs in ExtractorConfig.ts line 614:

        // Merge extractorConfig into baseConfig, mutating baseConfig
        lodash.merge(baseConfig, configObject);
        configObject = baseConfig;

Standard questions

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

Question Answer
@microsoft/api-extractor version? 7.45.1
Operating system? Windows
API Extractor scenario? reporting (.api.md)
Would you consider contributing a PR? No
TypeScript compiler version? 5.4.2
Node.js version (node -v)? 18.20.2
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

No branches or pull requests

1 participant