build: remove unused dgeni package configurations (#14909)

* Removes some configuration parts of the Dgeni docs package which are overwritten by Bazel using the `apiDocsPackage`. Globs do not work within Bazel.
This commit is contained in:
Paul Gschwendtner
2019-01-23 20:17:14 +01:00
committed by Andrew Seguin
parent e2f68dcb53
commit e1b9c2d4ec
4 changed files with 9 additions and 63 deletions
-1
View File
@@ -19,7 +19,6 @@ ts_library(
srcs = glob(["**/*.ts"]),
deps = [
"@matdeps//@types/node",
"@matdeps//@types/glob",
"@matdeps//dgeni",
"@matdeps//dgeni-packages",
"//tools/highlight-files:sources",
+5 -1
View File
@@ -3,7 +3,7 @@ import {ReadTypeScriptModules} from 'dgeni-packages/typescript/processors/readTy
import {TsParser} from 'dgeni-packages/typescript/services/TsParser';
import {readFileSync} from 'fs';
import {join, relative} from 'path';
import {apiDocsPackage} from './index';
import {apiDocsPackage} from './docs-package';
/**
* Determines the command line arguments for the current Bazel action. Since this action can
@@ -52,6 +52,10 @@ if (require.main === module) {
// custom processors (such as the `entry-point-grouper) to compute entry-point paths.
readTypeScriptModules.basePath = packagePath;
// Initialize the "tsParser" path mappings. These will be passed to the TypeScript program
// and therefore use the same syntax as the "paths" option in a tsconfig.
tsParser.options.paths = {};
// For each package we want to setup all entry points in Dgeni so that their API
// will be generated. Packages and their associated entry points are passed in pairs.
// The first argument will be always the package name, and the second argument will be a
@@ -8,31 +8,13 @@ import {FilterDuplicateExports} from './processors/filter-duplicate-exports';
import {MergeInheritedProperties} from './processors/merge-inherited-properties';
import {EntryPointGrouper} from './processors/entry-point-grouper';
import {ReadTypeScriptModules} from 'dgeni-packages/typescript/processors/readTypeScriptModules';
import {TsParser} from 'dgeni-packages/typescript/services/TsParser';
import {TypeFormatFlags} from 'dgeni-packages/node_modules/typescript';
import {sync as globSync} from 'glob';
import * as path from 'path';
// Dgeni packages that the Material docs package depends on.
const jsdocPackage = require('dgeni-packages/jsdoc');
const nunjucksPackage = require('dgeni-packages/nunjucks');
const typescriptPackage = require('dgeni-packages/typescript');
// Project configuration.
const projectRootDir = path.resolve(__dirname, '../..');
const sourceDir = path.resolve(projectRootDir, 'src');
const outputDir = path.resolve(projectRootDir, 'dist/docs/api');
const templateDir = path.resolve(__dirname, './templates');
/** List of CDK packages that need to be documented. */
const cdkPackages = globSync(path.join(sourceDir, 'cdk', '*/'))
.filter(packagePath => !packagePath.endsWith('testing/'))
.map(packagePath => path.basename(packagePath));
/** List of Material packages that need to be documented. */
const materialPackages = globSync(path.join(sourceDir, 'lib', '*/'))
.map(packagePath => path.basename(packagePath));
/**
* Dgeni package for the Angular Material docs. This just defines the package, but doesn't
* generate the docs yet.
@@ -71,11 +53,9 @@ apiDocsPackage.processor(new EntryPointGrouper());
apiDocsPackage.config((log: any) => log.level = 'info');
// Configure the processor for reading files from the file system.
apiDocsPackage.config((readFilesProcessor: any, writeFilesProcessor: any) => {
readFilesProcessor.basePath = sourceDir;
readFilesProcessor.$enabled = false; // disable for now as we are using readTypeScriptModules
writeFilesProcessor.outputFolder = outputDir;
apiDocsPackage.config((readFilesProcessor: any) => {
// Disable we currently only use the "readTypeScriptModules" processor
readFilesProcessor.$enabled = false;
});
// Patches Dgeni's log service to not print warnings about unresolved mixin base symbols.
@@ -104,32 +84,9 @@ apiDocsPackage.config((checkAnchorLinksProcessor: any) => {
});
// Configure the processor for understanding TypeScript.
apiDocsPackage.config((readTypeScriptModules: ReadTypeScriptModules, tsParser: TsParser) => {
readTypeScriptModules.basePath = sourceDir;
apiDocsPackage.config((readTypeScriptModules: ReadTypeScriptModules) => {
readTypeScriptModules.ignoreExportsMatching = [/^_/];
readTypeScriptModules.hidePrivateMembers = true;
const typescriptPathMap: any = {};
cdkPackages.forEach(packageName => {
typescriptPathMap[`@angular/cdk/${packageName}`] = [`./cdk/${packageName}/index.ts`];
});
materialPackages.forEach(packageName => {
typescriptPathMap[`@angular/material/${packageName}`] = [`./lib/${packageName}/index.ts`];
});
// Add proper path mappings to the TSParser service of Dgeni. This ensures that properties
// from mixins (e.g. color, disabled) are showing up properly in the docs.
tsParser.options.paths = typescriptPathMap;
tsParser.options.baseUrl = sourceDir;
// Entry points for docs generation. All publicly exported symbols found through these
// files will have docs generated.
readTypeScriptModules.sourceFiles = [
...cdkPackages.map(packageName => `./cdk/${packageName}/index.ts`),
...materialPackages.map(packageName => `./lib/${packageName}/index.ts`)
];
});
apiDocsPackage.config((tsHost: Host) => {
@@ -148,9 +105,6 @@ apiDocsPackage.config((tsHost: Host) => {
// Configure processor for finding nunjucks templates.
apiDocsPackage.config((templateFinder: any, templateEngine: any) => {
// Where to find the templates for the doc rendering
templateFinder.templateFolders = [templateDir];
// Standard patterns for matching docs to templates
templateFinder.templatePatterns = [
'${ doc.template }',
-11
View File
@@ -1,26 +1,15 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"noUnusedParameters": true,
"noUnusedLocals": true,
"lib": ["es2015", "dom", "es2016.array.include"],
"module": "commonjs",
"moduleResolution": "node",
"outDir": "../../dist/tools/dgeni",
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"noEmitOnError": true,
"noImplicitAny": true,
"target": "es5",
"types": [
"node"
]
},
"files": [
"index.ts"
],
"bazelOptions": {
"suppressTsconfigOverrideWarnings": true
}
}