fix(api-markdown-documenter): Fix issue that caused packages skipped via `skipPackage` option to still be listed on root "model" page (#22772)

See updated test collateral for an example
This commit is contained in:
Joshua Smithrud 2024-10-09 15:59:47 -07:00 коммит произвёл GitHub
Родитель a1146fc590
Коммит 6c06bbd686
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
14 изменённых файлов: 11 добавлений и 132 удалений

Просмотреть файл

@ -4,6 +4,7 @@
- Updates `TSDoc` node handling to emit a _warning_ in place of an _error_ when an embedded `HTML` tag is encountered.
Also updates the logged notice to include the tag that was encountered.
- Fixes a bug where the default transformation for the `API Model` page did not correctly account for the `skipPackage` configuration, and would list packages that were not intended for inclusion in the generated docs suite.
## 0.17.0

Просмотреть файл

@ -106,7 +106,6 @@
"eslint-plugin-chai-friendly": "^0.7.2",
"good-fences": "^1.2.0",
"mocha": "^10.2.0",
"mocha-multi-reporters": "^1.5.1",
"moment": "^2.29.4",
"prettier": "~3.0.3",

Просмотреть файл

@ -139,8 +139,8 @@ export interface ApiItemTransformationOptions {
* @remarks
*
* Note that this is a {@link TransformApiItemWithoutChildren} only because we handle `Model`
* and `Package` items specially. We never render `Package` child details directly to the `Modal` document.
* These are always rendered to seperate documents from each other.
* and `Package` items specially. We never render `Package` child details directly to the `Model` document.
* These are always rendered to separate documents from each other.
*/
transformApiModel?: TransformApiItemWithoutChildren<ApiModel>;

Просмотреть файл

@ -29,12 +29,17 @@ export function transformApiModel(
];
}
// Filter out packages not wanted per user config
const filteredPackages = apiModel.packages.filter(
(apiPackage) => !config.skipPackage(apiPackage),
);
// Render packages table
const packagesTableSection = createTableWithHeading(
{
headingTitle: "Packages",
itemKind: ApiItemKind.Package,
items: apiModel.packages,
items: filteredPackages,
},
config,
);

Просмотреть файл

@ -107,6 +107,7 @@ const testConfigs: EndToEndTestConfig<RenderDocumentAsHtmlConfig>[] = [
],
hierarchyBoundaries: [], // No additional hierarchy beyond the package level
minimumReleaseLevel: ReleaseTag.Public, // Only include `@public` items in the docs suite
skipPackage: (apiPackage) => apiPackage.name === "test-suite-b", // Skip test-suite-b package
},
renderConfig: {
startingHeadingLevel: 2,

Просмотреть файл

@ -107,6 +107,7 @@ const testConfigs: EndToEndTestConfig<MarkdownRenderConfiguration>[] = [
],
hierarchyBoundaries: [], // No additional hierarchy beyond the package level
minimumReleaseLevel: ReleaseTag.Public, // Only include `@public` items in the docs suite
skipPackage: (apiPackage) => apiPackage.name === "test-suite-b", // Skip test-suite-b package
},
renderConfig: {
startingHeadingLevel: 2,

Просмотреть файл

@ -20,10 +20,6 @@
<td><a href="docs/test-suite-a">test-suite-a</a></td>
<td>Test package</td>
</tr>
<tr>
<td><a href="docs/test-suite-b">test-suite-b</a></td>
<td></td>
</tr>
</tbody>
</table>
</section>

Просмотреть файл

@ -1,28 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<section>
<h2>test-suite-b</h2>
<section>
<h3>Interfaces</h3>
<table>
<thead>
<tr>
<th>Interface</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="docs/test-suite-b/foo-interface">Foo</a></td>
<td>Bar</td>
</tr>
</tbody>
</table>
</section>
</section>
</body>
</html>

Просмотреть файл

@ -1,22 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<section>
<h2>bar</h2>
<section>
<p>Test Enum</p>
</section>
<section>
<h3 id="bar-signature">Signature</h3><code>bar: TestEnum;</code>
<p><span><span><b>Type: </b></span><span><a href="docs/test-suite-a/testenum-enum">TestEnum</a></span></span></p>
</section>
<section>
<h3 id="bar-remarks">Remarks</h3>
<p>Here are some remarks about the enum</p>
</section>
</section>
</body>
</html>

Просмотреть файл

@ -1,36 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<section>
<h2>Foo</h2>
<section>
<p>Bar</p>
</section>
<section>
<h3 id="foo-signature">Signature</h3><code>export interface Foo</code>
</section>
<section>
<h3>Properties</h3>
<table>
<thead>
<tr>
<th>Property</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="docs/test-suite-b/foo-bar-propertysignature">bar</a></td>
<td><span><a href="docs/test-suite-a/testenum-enum">TestEnum</a></span></td>
<td>Test Enum</td>
</tr>
</tbody>
</table>
</section>
</section>
</body>
</html>

Просмотреть файл

@ -5,4 +5,3 @@
| Package | Description |
| --- | --- |
| [test-suite-a](docs/test-suite-a) | Test package |
| [test-suite-b](docs/test-suite-b) | |

Просмотреть файл

@ -1,7 +0,0 @@
## test-suite-b
### Interfaces
| Interface | Description |
| --- | --- |
| [Foo](docs/test-suite-b/foo-interface) | Bar |

Просмотреть файл

@ -1,15 +0,0 @@
## bar
Test Enum
### Signature {#bar-signature}
```typescript
bar: TestEnum;
```
**Type:** [TestEnum](docs/test-suite-a/testenum-enum)
### Remarks {#bar-remarks}
Here are some remarks about the enum

Просмотреть файл

@ -1,15 +0,0 @@
## Foo
Bar
### Signature {#foo-signature}
```typescript
export interface Foo
```
### Properties
| Property | Type | Description |
| --- | --- | --- |
| [bar](docs/test-suite-b/foo-bar-propertysignature) | [TestEnum](docs/test-suite-a/testenum-enum) | Test Enum |