From 96f5c86fbe85b4dfd2eacfbca5180940e35e2dd9 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Tue, 27 Apr 2021 22:50:12 +0300 Subject: [PATCH] build(docs-infra): take disambiguated doc paths into account when generating the sitemap (#41842) (#41854) In ##41788, the `disambiguateDocsPathsProcessor` was introduced to fix an issue with case-insensitively equal paths. This processor may alter the paths of some docs and thus their final URL in the app. Previously, both the `disambiguateDocPathsProcessor` and the `createSitemap` processor (which relies on the docs' computed paths to generate the sitemap file) were configured to run before the "rendering-docs" phase. However, this resulted in the `disambiguateDocPathsProcessor`'s running after `createSitemap`, which meant that the sitemap did not include the updated doc paths. This commit fixes it by ensuring that the `disambiguateDocPathsProcessor` is explicitly run before the `createSitemap` processor, so that the latter will be able to take into account any changes made by the former. PR Close #41842 PR Close #41854 --- .../angular-base-package/processors/disambiguateDocPaths.js | 2 +- .../processors/disambiguateDocPaths.spec.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/aio/tools/transforms/angular-base-package/processors/disambiguateDocPaths.js b/aio/tools/transforms/angular-base-package/processors/disambiguateDocPaths.js index 2f3d01b6242..0a070a26bee 100644 --- a/aio/tools/transforms/angular-base-package/processors/disambiguateDocPaths.js +++ b/aio/tools/transforms/angular-base-package/processors/disambiguateDocPaths.js @@ -18,7 +18,7 @@ module.exports = function disambiguateDocPathsProcessor(log) { return { $runAfter: ['paths-computed'], - $runBefore: ['rendering-docs'], + $runBefore: ['rendering-docs', 'createSitemap'], $process(docs) { // Collect all the ambiguous docs, whose outputPath is are only different by casing. const ambiguousDocMap = new Map(); diff --git a/aio/tools/transforms/angular-base-package/processors/disambiguateDocPaths.spec.js b/aio/tools/transforms/angular-base-package/processors/disambiguateDocPaths.spec.js index 6bcd5995bc6..22eae728c14 100644 --- a/aio/tools/transforms/angular-base-package/processors/disambiguateDocPaths.spec.js +++ b/aio/tools/transforms/angular-base-package/processors/disambiguateDocPaths.spec.js @@ -22,6 +22,10 @@ describe('disambiguateDocPaths processor', () => { expect(processor).toBeDefined(); }); + it('should be run before creating the sitemap', () => { + expect(processor.$runBefore).toContain('createSitemap'); + }); + it('should create `disambiguator` documents for docs that have ambiguous outputPaths', () => { const numDocs = docs.length; processor.$process(docs);