@@ -8,31 +8,13 @@ import {FilterDuplicateExports} from './processors/filter-duplicate-exports';
88import { MergeInheritedProperties } from './processors/merge-inherited-properties' ;
99import { EntryPointGrouper } from './processors/entry-point-grouper' ;
1010import { ReadTypeScriptModules } from 'dgeni-packages/typescript/processors/readTypeScriptModules' ;
11- import { TsParser } from 'dgeni-packages/typescript/services/TsParser' ;
1211import { TypeFormatFlags } from 'dgeni-packages/node_modules/typescript' ;
13- import { sync as globSync } from 'glob' ;
14- import * as path from 'path' ;
1512
1613// Dgeni packages that the Material docs package depends on.
1714const jsdocPackage = require ( 'dgeni-packages/jsdoc' ) ;
1815const nunjucksPackage = require ( 'dgeni-packages/nunjucks' ) ;
1916const typescriptPackage = require ( 'dgeni-packages/typescript' ) ;
2017
21- // Project configuration.
22- const projectRootDir = path . resolve ( __dirname , '../..' ) ;
23- const sourceDir = path . resolve ( projectRootDir , 'src' ) ;
24- const outputDir = path . resolve ( projectRootDir , 'dist/docs/api' ) ;
25- const templateDir = path . resolve ( __dirname , './templates' ) ;
26-
27- /** List of CDK packages that need to be documented. */
28- const cdkPackages = globSync ( path . join ( sourceDir , 'cdk' , '*/' ) )
29- . filter ( packagePath => ! packagePath . endsWith ( 'testing/' ) )
30- . map ( packagePath => path . basename ( packagePath ) ) ;
31-
32- /** List of Material packages that need to be documented. */
33- const materialPackages = globSync ( path . join ( sourceDir , 'lib' , '*/' ) )
34- . map ( packagePath => path . basename ( packagePath ) ) ;
35-
3618/**
3719 * Dgeni package for the Angular Material docs. This just defines the package, but doesn't
3820 * generate the docs yet.
@@ -71,11 +53,9 @@ apiDocsPackage.processor(new EntryPointGrouper());
7153apiDocsPackage . config ( ( log : any ) => log . level = 'info' ) ;
7254
7355// Configure the processor for reading files from the file system.
74- apiDocsPackage . config ( ( readFilesProcessor : any , writeFilesProcessor : any ) => {
75- readFilesProcessor . basePath = sourceDir ;
76- readFilesProcessor . $enabled = false ; // disable for now as we are using readTypeScriptModules
77-
78- writeFilesProcessor . outputFolder = outputDir ;
56+ apiDocsPackage . config ( ( readFilesProcessor : any ) => {
57+ // Disable we currently only use the "readTypeScriptModules" processor
58+ readFilesProcessor . $enabled = false ;
7959} ) ;
8060
8161// Patches Dgeni's log service to not print warnings about unresolved mixin base symbols.
@@ -104,32 +84,9 @@ apiDocsPackage.config((checkAnchorLinksProcessor: any) => {
10484} ) ;
10585
10686// Configure the processor for understanding TypeScript.
107- apiDocsPackage . config ( ( readTypeScriptModules : ReadTypeScriptModules , tsParser : TsParser ) => {
108- readTypeScriptModules . basePath = sourceDir ;
87+ apiDocsPackage . config ( ( readTypeScriptModules : ReadTypeScriptModules ) => {
10988 readTypeScriptModules . ignoreExportsMatching = [ / ^ _ / ] ;
11089 readTypeScriptModules . hidePrivateMembers = true ;
111-
112- const typescriptPathMap : any = { } ;
113-
114- cdkPackages . forEach ( packageName => {
115- typescriptPathMap [ `@angular/cdk/${ packageName } ` ] = [ `./cdk/${ packageName } /index.ts` ] ;
116- } ) ;
117-
118- materialPackages . forEach ( packageName => {
119- typescriptPathMap [ `@angular/material/${ packageName } ` ] = [ `./lib/${ packageName } /index.ts` ] ;
120- } ) ;
121-
122- // Add proper path mappings to the TSParser service of Dgeni. This ensures that properties
123- // from mixins (e.g. color, disabled) are showing up properly in the docs.
124- tsParser . options . paths = typescriptPathMap ;
125- tsParser . options . baseUrl = sourceDir ;
126-
127- // Entry points for docs generation. All publicly exported symbols found through these
128- // files will have docs generated.
129- readTypeScriptModules . sourceFiles = [
130- ...cdkPackages . map ( packageName => `./cdk/${ packageName } /index.ts` ) ,
131- ...materialPackages . map ( packageName => `./lib/${ packageName } /index.ts` )
132- ] ;
13390} ) ;
13491
13592apiDocsPackage . config ( ( tsHost : Host ) => {
@@ -148,9 +105,6 @@ apiDocsPackage.config((tsHost: Host) => {
148105
149106// Configure processor for finding nunjucks templates.
150107apiDocsPackage . config ( ( templateFinder : any , templateEngine : any ) => {
151- // Where to find the templates for the doc rendering
152- templateFinder . templateFolders = [ templateDir ] ;
153-
154108 // Standard patterns for matching docs to templates
155109 templateFinder . templatePatterns = [
156110 '${ doc.template }' ,
0 commit comments