build(docs-infra): display github links in CLI API docs (#26515)

This commit includes the following changes:

* CLI version information is read from the CLI package from which
  we read the help files.
* CLI API pages now contain GH links
* line numbers are not shown in GH links, if the doc does not
  have a truthy `startingLine` value. This allows us to remove
  hard coded checks for `guide` pages
* content pages and CLI api docs no longer have a `startingLine`
* the hard-coded `packages` path segment has been removed from
  the templates; instead we now only use the `realProjectRelativePath`.
* the `realProjectRelativePath` has been updated accordingly for API
  and CLI API docs.

PR Close #26515
This commit is contained in:
Pete Bacon Darwin
2018-10-17 15:45:47 +01:00
committed by Alex Rickabaugh
parent 9e8903ada1
commit 4c0ad5238e
11 changed files with 88 additions and 16 deletions

View File

@ -15,6 +15,7 @@ module.exports = function cliCommandFileReader(log) {
name: 'cliCommandFileReader',
defaultPattern: /\.json$/,
getDocs(fileInfo) {
fileInfo.realProjectRelativePath = 'packages/angular/cli/commands/' + fileInfo.relativePath;
try {
const doc = json5.parse(fileInfo.content);
const name = fileInfo.baseName;
@ -23,7 +24,6 @@ module.exports = function cliCommandFileReader(log) {
const result = Object.assign(doc, {
content: doc.description,
docType: 'cli-command',
startingLine: 1,
id: `cli-${doc.name}`,
commandAliases: doc.aliases || [],
aliases: computeAliases(doc),