Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Github link fixes #1440

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tools/api-builder/angular.io-package/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var fs = require('fs');
var path = require('canonical-path');
var Package = require('dgeni').Package;
var basePackage = require('../docs-package');
Expand Down Expand Up @@ -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',
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) $}

Expand Down
Original file line number Diff line number Diff line change
@@ -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) -%}
<a href="{$ githubHref(doc) $}">{$ doc.fileInfo.relativePath $} (line {$ doc.location.start.line+1 $})</a>
{%- endmacro -%}
<a href="{$ githubHref(doc) $}">{$ doc.fileInfo.projectRelativePath $} (line {$ doc.location.start.line+1 $})</a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

{%- endmacro %}
24 changes: 0 additions & 24 deletions tools/api-builder/docs-package/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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
Expand Down