build(aio): local assets are not dangling links
Closes #16615 Closes #16616
This commit is contained in:
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)));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,7 +6,8 @@ const AIO_PATH = resolve(PROJECT_ROOT, 'aio');
|
|||
const TEMPLATES_PATH = resolve(AIO_PATH, 'tools/transforms/templates');
|
||||
const API_TEMPLATES_PATH = resolve(TEMPLATES_PATH, 'api');
|
||||
const CONTENTS_PATH = resolve(AIO_PATH, 'content');
|
||||
const OUTPUT_PATH = resolve(AIO_PATH, 'src/generated');
|
||||
const SRC_PATH = resolve(AIO_PATH, 'src');
|
||||
const OUTPUT_PATH = resolve(SRC_PATH, 'generated');
|
||||
const DOCS_OUTPUT_PATH = resolve(OUTPUT_PATH, 'docs');
|
||||
const API_SOURCE_PATH = resolve(PROJECT_ROOT, 'packages');
|
||||
|
||||
|
@ -17,5 +18,5 @@ function requireFolder(dirname, folderPath) {
|
|||
.map(p => require(resolve(absolutePath, p)));
|
||||
}
|
||||
|
||||
module.exports = { PROJECT_ROOT, AIO_PATH, TEMPLATES_PATH, API_TEMPLATES_PATH, CONTENTS_PATH, OUTPUT_PATH, DOCS_OUTPUT_PATH, API_SOURCE_PATH, requireFolder };
|
||||
module.exports = { PROJECT_ROOT, AIO_PATH, TEMPLATES_PATH, API_TEMPLATES_PATH, CONTENTS_PATH, SRC_PATH, OUTPUT_PATH, DOCS_OUTPUT_PATH, API_SOURCE_PATH, requireFolder };
|
||||
|
||||
|
|
Loading…
Reference in New Issue