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/angular.io-package/templates/class.template.html b/tools/api-builder/angular.io-package/templates/class.template.html index 7390604888..016ce47923 100644 --- a/tools/api-builder/angular.io-package/templates/class.template.html +++ b/tools/api-builder/angular.io-package/templates/class.template.html @@ -159,7 +159,7 @@ {% endif %}{% endfor %} {% endif %} -.p(class="location-badge") +p(class="location-badge"). exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} } defined in {$ githubViewLink(doc) $} diff --git a/tools/api-builder/angular.io-package/templates/lib/githubLinks.html b/tools/api-builder/angular.io-package/templates/lib/githubLinks.html index 611ebdb13a..4bf27cd15c 100644 --- a/tools/api-builder/angular.io-package/templates/lib/githubLinks.html +++ b/tools/api-builder/angular.io-package/templates/lib/githubLinks.html @@ -1,7 +1,7 @@ {% macro githubHref(doc) -%} -https://github.com/{$ versionInfo.gitRepoInfo.owner $}/{$ versionInfo.gitRepoInfo.repo $}/tree/{$ versionInfo.currentVersion.isSnapshot and versionInfo.currentVersion.SHA or versionInfo.currentVersion.raw $}/modules/{$ doc.fileInfo.relativePath $}#L{$ doc.location.start.line+1 $}-L{$ doc.location.end.line+1 $} +https://github.com/{$ versionInfo.gitRepoInfo.owner $}/{$ versionInfo.gitRepoInfo.repo $}/tree/{$ versionInfo.currentVersion.isSnapshot and versionInfo.currentVersion.SHA or versionInfo.currentVersion.raw $}/modules/{$ doc.fileInfo.projectRelativePath $}#L{$ doc.location.start.line+1 $}-L{$ doc.location.end.line+1 $} {%- endmacro %} {% macro githubViewLink(doc) -%} - {$ doc.fileInfo.relativePath $} (line {$ doc.location.start.line+1 $}) -{%- endmacro -%} + {$ doc.fileInfo.projectRelativePath $} (line {$ doc.location.start.line+1 $}) +{%- endmacro %} \ No newline at end of file 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