@@ -11,7 +11,7 @@ import {TsParser} from 'dgeni-packages/typescript/services/TsParser';
11
11
import { sync as globSync } from 'glob' ;
12
12
import * as path from 'path' ;
13
13
14
- // Dgeni packages
14
+ // Dgeni packages that the Material docs package depends on.
15
15
const jsdocPackage = require ( 'dgeni-packages/jsdoc' ) ;
16
16
const nunjucksPackage = require ( 'dgeni-packages/nunjucks' ) ;
17
17
const typescriptPackage = require ( 'dgeni-packages/typescript' ) ;
@@ -22,24 +22,6 @@ const sourceDir = path.resolve(projectRootDir, 'src');
22
22
const outputDir = path . resolve ( projectRootDir , 'dist/docs/api' ) ;
23
23
const templateDir = path . resolve ( __dirname , './templates' ) ;
24
24
25
- // Package definition for material2 api docs. This only *defines* the package- it does not yet
26
- // actually *run* anything.
27
- //
28
- // A dgeni package is very similar to an AngularJS module. Modules contain:
29
- // "services" (injectables)
30
- // "processors" (injectables that conform to a specific interface)
31
- // "templates": nunjucks templates that can be used to render content
32
- //
33
- // A dgeni package also has a `config` method, similar to an AngularJS module.
34
- // A config block can inject any services/processors and configure them before
35
- // docs processing begins.
36
-
37
- const dgeniPackageDeps = [
38
- jsdocPackage ,
39
- nunjucksPackage ,
40
- typescriptPackage ,
41
- ] ;
42
-
43
25
/** List of CDK packages that need to be documented. */
44
26
const cdkPackages = globSync ( path . join ( sourceDir , 'cdk' , '*/' ) )
45
27
. filter ( packagePath => ! packagePath . endsWith ( 'testing/' ) )
@@ -49,7 +31,24 @@ const cdkPackages = globSync(path.join(sourceDir, 'cdk', '*/'))
49
31
const materialPackages = globSync ( path . join ( sourceDir , 'lib' , '*/' ) )
50
32
. map ( packagePath => path . basename ( packagePath ) ) ;
51
33
52
- export const apiDocsPackage = new Package ( 'material2-api-docs' , dgeniPackageDeps ) ;
34
+ /**
35
+ * Dgeni package for the Angular Material docs. This just defines the package, but doesn't
36
+ * generate the docs yet.
37
+ *
38
+ * Dgeni packages are very similar to AngularJS modules. Those can contain:
39
+ *
40
+ * - Services that can be injected
41
+ * - Templates that are used to convert the data into HTML output.
42
+ * - Processors that can modify the doc items (like a build pipeline).
43
+ *
44
+ * Similar to AngularJS, there is also a `config` lifecycle hook, that can be used to
45
+ * configure specific processors, services before the procession begins.
46
+ */
47
+ export const apiDocsPackage = new Package ( 'material2-api-docs' , [
48
+ jsdocPackage ,
49
+ nunjucksPackage ,
50
+ typescriptPackage ,
51
+ ] ) ;
53
52
54
53
// Processor that filters out duplicate exports that should not be shown in the docs.
55
54
apiDocsPackage . processor ( new FilterDuplicateExports ( ) ) ;
@@ -121,7 +120,7 @@ apiDocsPackage.config((readTypeScriptModules: ReadTypeScriptModules, tsParser: T
121
120
tsParser . options . paths = typescriptPathMap ;
122
121
tsParser . options . baseUrl = sourceDir ;
123
122
124
- // Entry points for docs generation. All publically exported symbols found through these
123
+ // Entry points for docs generation. All publicly exported symbols found through these
125
124
// files will have docs generated.
126
125
readTypeScriptModules . sourceFiles = [
127
126
...cdkPackages . map ( packageName => `./cdk/${ packageName } /index.ts` ) ,
@@ -149,7 +148,7 @@ apiDocsPackage.config((templateFinder: any, templateEngine: any) => {
149
148
'common.template.html'
150
149
] ;
151
150
152
- // dgeni disables autoescape by default, but we want this turned on.
151
+ // Dgeni disables autoescape by default, but we want this turned on.
153
152
templateEngine . config . autoescape = true ;
154
153
155
154
// Nunjucks and Angular conflict in their template bindings so change Nunjucks
0 commit comments