build(docs-infra): align `navigationUrls` in `ngsw-config.json` with Firebase redirects (#42452)

The ServiceWorker `navigationUrls` globs defined in `ngsw-config.json`
are supposed to exclude any URLs that are redirected on the server (as
configured in `firebase.json`). However, the list of redirected
URLs/globs in `firebase.json` and `ngsw-config.json` have gotten out of
sync.

This commit updates the globs in `ngsw-config.json` to match the ones in
`firebase.json`.

This is in preparation of automatically generating the ServiceWorker
`navigationUrls` based on `firebase.json`.

PR Close #42452
This commit is contained in:
George Kalpakas 2021-06-18 00:10:39 +03:00 committed by Dylan Hunn
parent fe3c79fe40
commit 982521f284
2 changed files with 38 additions and 20 deletions

View File

@ -79,33 +79,46 @@
"!/**/*__*", "!/**/*__*",
"!/**/*__*/**", "!/**/*__*/**",
"!/**/stackblitz/{0,1}", "!/**/stackblitz/{0,1}",
"!/api/**/AnimationStateDeclarationMetadata*", "!/**/AnimationStateDeclarationMetadata*",
"!/api/**/CORE_DIRECTIVES*", "!/**/CORE_DIRECTIVES*",
"!/api/**/DirectiveMetadata*", "!/**/DirectiveMetadata-*",
"!/api/**/HTTP_PROVIDERS*", "!/**/HTTP_PROVIDERS*",
"!/api/**/NgFor-*", "!/**/NgFor-*",
"!/api/**/PLATFORM_PIPES*", "!/**/OptionalMetadata-*",
"!/api/*/**/*-(class|directive|var|interface|function|pipe|let|type-alias|decorator)", "!/**/PLATFORM_PIPES*",
"!/**/api/common/Control*",
"!/**/api/common/ControlGroup*",
"!/**/api/common/NgModel/{0,1}",
"!/**/api/common/SelectControlValueAccessor-*",
"!/**/api/common/index/MaxLengthValidator-*",
"!/**/cookbook/ts-to-js*",
"!/api/*/*-(class|decorator|directive|function|interface|let|pipe|type|type-alias|var)",
"!/api/*/testing/*-(class|decorator|directive|function|interface|let|pipe|type|type-alias|var)",
"!/api/*/testing/index/*",
"!/api/animate/**", "!/api/animate/**",
"!/api/api/**", "!/api/api/**",
"!/api/common/Control*",
"!/api/common/MaxLengthValidator*",
"!/api/common/NgModel*",
"!/api/http/**", "!/api/http/**",
"!/api/http/{0,1}", "!/api/http/{0,1}",
"!/api/platform-browser/AnimationDriver*", "!/api/platform-browser/AnimationDriver/{0,1}",
"!/api/testing/**", "!/api/testing/*-*",
"!/config/**", "!/api/upgrade/*/*-(class|decorator|directive|function|interface|let|pipe|type|type-alias|var)",
"!/api/upgrade/*/index/*",
"!/config/app-package-json/{0,1}",
"!/config/solution-tsconfig/{0,1}",
"!/config/tsconfig/{0,1}",
"!/devtools/{0,1}", "!/devtools/{0,1}",
"!/docs/*/**", "!/docs/*/latest/**",
"!/docs/?*", "!/docs/*/latest/{0,1}",
"!/docs/latest/**",
"!/docs/styleguide*",
"!/docs/styleguide/{0,1}",
"!/getting-started/**", "!/getting-started/**",
"!/getting-started/{0,1}", "!/getting-started/{0,1}",
"!/guide/bazel/{0,1}", "!/guide/bazel/{0,1}",
"!/guide/change-log/{0,1}", "!/guide/change-log/{0,1}",
"!/guide/cli-quickstart/{0,1}", "!/guide/cli-quickstart/{0,1}",
"!/guide/displaying-data/{0,1}", "!/guide/displaying-data/{0,1}",
"!/guide/learning-angular/{0,1}", "!/guide/learning-angular*",
"!/guide/metadata/{0,1}", "!/guide/metadata/{0,1}",
"!/guide/ngmodule/{0,1}", "!/guide/ngmodule/{0,1}",
"!/guide/quickstart/{0,1}", "!/guide/quickstart/{0,1}",
@ -117,13 +130,12 @@
"!/guide/updating-to-version-10/{0,1}", "!/guide/updating-to-version-10/{0,1}",
"!/guide/updating-to-version-11/{0,1}", "!/guide/updating-to-version-11/{0,1}",
"!/guide/webpack/{0,1}", "!/guide/webpack/{0,1}",
"!/news/{0,1}", "!/news*",
"!/start/data/{0,1}", "!/start/data/{0,1}",
"!/start/deployment/{0,1}", "!/start/deployment/{0,1}",
"!/start/forms/{0,1}", "!/start/forms/{0,1}",
"!/start/routing/{0,1}", "!/start/routing/{0,1}",
"!/strict/{0,1}", "!/strict/{0,1}",
"!/styleguide/**",
"!/styleguide/{0,1}", "!/styleguide/{0,1}",
"!/testing/**", "!/testing/**",
"!/testing/{0,1}" "!/testing/{0,1}"

View File

@ -28,9 +28,15 @@ describe('ServiceWorker navigation URLs', () => {
expect(isNavigationUrl('/generated/docs/guide/animations.json')).toBeFalsy(); expect(isNavigationUrl('/generated/docs/guide/animations.json')).toBeFalsy();
}); });
it('should treat `/docs*` URLs correctly', () => { it('should treat `/docs/*` URLs correctly', () => {
const navigationUrls = ['/docs', '/docs/']; const navigationUrls = ['/docs', '/docs/'];
const nonNavigationUrls = ['/docs/foo', '/docs/foo/', '/docs/foo/bar']; const nonNavigationUrls = [
'/docs/js/latest',
'/docs/ts/latest/foo',
'/docs/latest/foo/bar',
'/docs/styleguide',
'/docs/styleguide/',
];
navigationUrls.forEach(url => expect(isNavigationUrl(url)).toBeTruthy(url)); navigationUrls.forEach(url => expect(isNavigationUrl(url)).toBeTruthy(url));
nonNavigationUrls.forEach(url => expect(isNavigationUrl(url)).toBeFalsy(url)); nonNavigationUrls.forEach(url => expect(isNavigationUrl(url)).toBeFalsy(url));