build(aio): local assets are not dangling links
Closes #16615 Closes #16616
This commit is contained in:

committed by
Pete Bacon Darwin

parent
1af42aedfa
commit
0190df9cf3
@ -9,7 +9,9 @@ const Package = require('dgeni').Package;
|
||||
const gitPackage = require('dgeni-packages/git');
|
||||
const apiPackage = require('../angular-api-package');
|
||||
const contentPackage = require('../angular-content-package');
|
||||
const { extname } = require('canonical-path');
|
||||
const { extname, resolve } = require('canonical-path');
|
||||
const { existsSync } = require('fs');
|
||||
const { SRC_PATH } = require('../config');
|
||||
|
||||
module.exports = new Package('angular.io', [gitPackage, apiPackage, contentPackage])
|
||||
|
||||
@ -32,4 +34,12 @@ module.exports = new Package('angular.io', [gitPackage, apiPackage, contentPacka
|
||||
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 = '/';
|
||||
// Ignore links to local assets
|
||||
// (This is not optimal in terms of performance without making changes to dgeni-packages there is no other way.
|
||||
// That being said do this only add 500ms onto the ~30sec doc-gen run - so not a huge issue)
|
||||
checkAnchorLinksProcessor.ignoredLinks.push({
|
||||
test(url) {
|
||||
return (existsSync(resolve(SRC_PATH, url)));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user