build(aio): turn on dangling link checking

This commit is contained in:
Peter Bacon Darwin 2017-04-25 13:30:30 +01:00 committed by Pete Bacon Darwin
parent 9b7f2ce6c3
commit 5331fc1aab
2 changed files with 13 additions and 1 deletions

View File

@ -33,7 +33,8 @@ module.exports = new Package('angular-base', [
.factory(require('./readers/json')) .factory(require('./readers/json'))
.config(function(checkAnchorLinksProcessor) { .config(function(checkAnchorLinksProcessor) {
// TODO: re-enable // This is disabled here to prevent false negatives for the `docs-watch` task.
// It is re-enabled in the main `angular.io-package`
checkAnchorLinksProcessor.$enabled = false; checkAnchorLinksProcessor.$enabled = false;
}) })

View File

@ -9,6 +9,7 @@ const Package = require('dgeni').Package;
const gitPackage = require('dgeni-packages/git'); const gitPackage = require('dgeni-packages/git');
const apiPackage = require('../angular-api-package'); const apiPackage = require('../angular-api-package');
const contentPackage = require('../angular-content-package'); const contentPackage = require('../angular-content-package');
const { extname } = require('canonical-path');
module.exports = new Package('angular.io', [gitPackage, apiPackage, contentPackage]) module.exports = new Package('angular.io', [gitPackage, apiPackage, contentPackage])
@ -20,5 +21,15 @@ module.exports = new Package('angular.io', [gitPackage, apiPackage, contentPacka
.config(function(renderDocsProcessor, versionInfo) { .config(function(renderDocsProcessor, versionInfo) {
// Add the version data to the renderer, for use in things like github links // Add the version data to the renderer, for use in things like github links
renderDocsProcessor.extraData.versionInfo = versionInfo; renderDocsProcessor.extraData.versionInfo = versionInfo;
})
.config(function(checkAnchorLinksProcessor) {
checkAnchorLinksProcessor.$enabled = true;
// since we encode the HTML to JSON we need to ensure that this processor runs before that encoding happens.
checkAnchorLinksProcessor.$runBefore = ['convertToJsonProcessor'];
checkAnchorLinksProcessor.$runAfter = ['fixInternalDocumentLinks'];
// We only want to check docs that are going to be output as JSON docs.
checkAnchorLinksProcessor.checkDoc = (doc) => doc.path && doc.outputPath && extname(doc.outputPath) === '.json';
// Since we have a `base[href="/"]` arrangement all links are relative to that and not relative to the source document's path
checkAnchorLinksProcessor.base = '/';
}); });