* Runs the API Extractor to check if the API report matches the API. * Exits with status code 1 if it does not match. * @param config {ExtractorConfig}
(config)
| 19 | * @param config {ExtractorConfig} |
| 20 | */ |
| 21 | function checkReportMatchesApi(config) { |
| 22 | const result = Extractor.invoke(config, { |
| 23 | localBuild: false, // validate report, fail on warnings or errors |
| 24 | messageCallback: (message) => { |
| 25 | // suppress all error or warnings |
| 26 | message.handled = true; |
| 27 | }, |
| 28 | }); |
| 29 | |
| 30 | if (result.apiReportChanged) { |
| 31 | exit( |
| 32 | `The API Extractor report does not match the exported API.`, |
| 33 | `Please run \`${API_EXTRACTOR_YARN_COMMAND}\` to generate an`, |
| 34 | `updated report and commit it.`, |
| 35 | ); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Runs the API Extractor. |