From 16dccb6a6b8215622aa090e78e44d142d6d6496f Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Thu, 19 May 2016 20:57:15 +0100 Subject: [PATCH] api-builder: consolidate readTypescriptProcessor configuration closes #1440 --- tools/api-builder/angular.io-package/index.js | 17 +++++++++++++ tools/api-builder/docs-package/index.js | 24 ------------------- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/tools/api-builder/angular.io-package/index.js b/tools/api-builder/angular.io-package/index.js index add8a222d1..a1194e6d7e 100644 --- a/tools/api-builder/angular.io-package/index.js +++ b/tools/api-builder/angular.io-package/index.js @@ -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, diff --git a/tools/api-builder/docs-package/index.js b/tools/api-builder/docs-package/index.js index 047ef45ad6..5988639330 100644 --- a/tools/api-builder/docs-package/index.js +++ b/tools/api-builder/docs-package/index.js @@ -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