api-builder: consolidate readTypescriptProcessor configuration

closes #1440
This commit is contained in:
Peter Bacon Darwin 2016-05-19 20:57:15 +01:00 committed by Ward Bell
parent 0cb0bd7949
commit 16dccb6a6b
2 changed files with 17 additions and 24 deletions

View File

@ -1,3 +1,4 @@
var fs = require('fs');
var path = require('canonical-path');
var Package = require('dgeni').Package;
var basePackage = require('../docs-package');
@ -40,6 +41,21 @@ module.exports = new Package('angular.io', [basePackage, targetPackage, cheatshe
.config(function(readTypeScriptModules, writeFilesProcessor, readFilesProcessor) {
var angular_repo_path = path.resolve(__dirname, '../../../../angular');
// confirm that the angular repo is actually there.
if (!fs.existsSync(angular_repo_path)) {
throw new Error('build-api-docs task requires the angular2 repo to be at ' + angular_repo_path);
}
readTypeScriptModules.basePath = path.resolve(angular_repo_path, 'modules');
readTypeScriptModules.ignoreExportsMatching = [
'___esModule',
'___core_private_types__',
'___platform_browser_private__',
'___compiler_private__',
'__core_private__',
'___core_private__'
];
readTypeScriptModules.sourceFiles = [
'@angular/common/index.ts',
'@angular/common/testing.ts',
@ -61,6 +77,7 @@ module.exports = new Package('angular.io', [basePackage, targetPackage, cheatshe
];
readTypeScriptModules.hidePrivateMembers = true;
readFilesProcessor.basePath = DOCS_PATH;
readFilesProcessor.sourceFiles = [{
basePath: ANGULAR2_DOCS_PATH,

View File

@ -5,7 +5,6 @@ var typescriptPackage = require('dgeni-packages/typescript');
var linksPackage = require('../links-package');
var gitPackage = require('dgeni-packages/git');
var path = require('canonical-path');
var fs = require('fs');
// Define the dgeni package for generating the docs
module.exports = new Package('angular-v2-docs', [jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage, gitPackage])
@ -36,29 +35,6 @@ module.exports = new Package('angular-v2-docs', [jsdocPackage, nunjucksPackage,
renderDocsProcessor.extraData.versionInfo = versionInfo;
})
// Configure file reading
.config(function(readTypeScriptModules) {
var angular_repo_path = path.resolve(__dirname, '../../../../angular');
// confirm that the angular repo is actually there.
if (!fs.existsSync(angular_repo_path)) {
throw new Error('build-api-docs task requires the angular2 repo to be at ' + angular_repo_path);
}
readTypeScriptModules.sourceFiles = [
'*/*.@(js|es6|ts)',
'*/src/**/*.@(js|es6|ts)'
];
readTypeScriptModules.basePath = path.resolve(angular_repo_path, 'modules');
readTypeScriptModules.ignoreExportsMatching = [
'___esModule',
'___core_private_types__',
'___platform_browser_private__',
'___compiler_private__',
'__core_private__',
'___core_private__'
];
})
.config(function(parseTagsProcessor, getInjectables) {
// We actually don't want to parse param docs in this package as we are getting the data out using TS