Skip to content

Commit b05ff10

Browse files
devversionmmalerba
authored andcommitted
chore: less warnings for docs generation (#9864)
* Hides the warnings about unresolved TypeScript symbols for the mixin base classes. Those warnings are not fixable and are polluting the Dgeni output. * Adds missing `@deprecated` tags to entries that already have the `@deletion-target` set. * Updates to the latest version of dgeni-packages because angular/dgeni-packages@3a4e568 landed.
1 parent 82df181 commit b05ff10

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"axe-webdriverjs": "^1.1.1",
6565
"chalk": "^1.1.3",
6666
"dgeni": "^0.4.9",
67-
"dgeni-packages": "^0.22.0",
67+
"dgeni-packages": "^0.24.1",
6868
"firebase": "^4.0.0",
6969
"firebase-admin": "^5.0.0",
7070
"firebase-tools": "^3.11.0",

tools/dgeni/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {Package} from 'dgeni';
2+
import {patchLogService} from './patch-log-service';
23
import {DocsPrivateFilter} from './processors/docs-private-filter';
34
import {Categorizer} from './processors/categorizer';
45
import {FilterDuplicateExports} from './processors/filter-duplicate-exports';
@@ -79,6 +80,9 @@ apiDocsPackage.config((readFilesProcessor: any, writeFilesProcessor: any) => {
7980
writeFilesProcessor.outputFolder = outputDir;
8081
});
8182

83+
// Patches Dgeni's log service to not print warnings about unresolved mixin base symbols.
84+
apiDocsPackage.config((log: any) => patchLogService(log));
85+
8286
// Configure the output path for written files (i.e., file names).
8387
apiDocsPackage.config((computePathsProcessor: any) => {
8488
computePathsProcessor.pathTemplates = [{

tools/dgeni/patch-log-service.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
/**
3+
* Function that patches Dgeni's instantiated log service. The patch will hide warnings about
4+
* unresolved TypeScript symbols for the mixin base classes.
5+
*
6+
* ```
7+
* warn: Unresolved TypeScript symbol(s): _MatToolbarMixinBase - doc "lib/toolbar/MatToolbar"
8+
* (class) - from file "lib/toolbar/toolbar.ts" - starting at line 37, ending at line 98
9+
* ```
10+
*
11+
* Those warnings are valid, but are not fixable because the base class is created dynamically
12+
* through mixin functions and will be stored as a constant.
13+
*/
14+
export function patchLogService(log: any) {
15+
const _warnFn = log.warn;
16+
17+
log.warn = function(message: string) {
18+
if (message.includes('Unresolved TypeScript symbol') && message.includes('MixinBase')) {
19+
return;
20+
}
21+
22+
_warnFn.apply(this, [message]);
23+
};
24+
}

0 commit comments

Comments
 (0)