import { Project } from "ts-morph" ; import { getAutorestOptions } from "../../autorestSession" ; export function generateApiExtractorConfig ( project ) { const { generateMetadata , packageDetails , generateTest } = getAutorestOptions ( ) ; if ( ! generateMetadata ) { return ; } const config = { $schema : "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json" , mainEntryPointFilePath : generateTest ? `./dist-esm/src/index.d.ts` : `./dist-esm/index.d.ts` , docModel : { enabled : true } , apiReport : { enabled : true , reportFolder : "./review" } , dtsRollup : { enabled : true , untrimmedFilePath : "" , publicTrimmedFilePath : `./types/${ packageDetails . nameWithoutScope }.d.ts` } , messages : { tsdocMessageReporting : { default : { logLevel : "none" } } , extractorMessageReporting : { "ae-missing-release-tag" : { logLevel : "none" } , "ae-unresolved-link" : { logLevel : "none" } } } } ; project . createSourceFile ( "api-extractor.json" , JSON . stringify ( config ) , { overwrite : true } ) ; }