refactor(aio): rename directory (tests/deployment-config --> tests/deployment) (#23390)
PR Close #23390
This commit is contained in:

committed by
Jason Aden

parent
6db8241ffa
commit
44193c0b94
184
aio/tests/deployment/shared/URLS_TO_REDIRECT.txt
Normal file
184
aio/tests/deployment/shared/URLS_TO_REDIRECT.txt
Normal file
@ -0,0 +1,184 @@
|
||||
/api/animate/AnimationBuilder /api/animations/AnimationBuilder
|
||||
/api/animate/CssAnimationBuilder /api/animations/CssAnimationBuilder
|
||||
/api/api/core/ElementRef /api/core/ElementRef
|
||||
/api/common/Control-class /api/forms/FormControl
|
||||
/api/common/CORE_DIRECTIVES /api/common/CommonModule
|
||||
/api/common/DatePipe-class /api/common/DatePipe
|
||||
/api/common/NgClass-directive.html /api/common/NgClass
|
||||
/api/common/NgFor-directive.html /api/common/NgForOf
|
||||
/api/common/NgModel-directive /api/forms/NgModel
|
||||
/api/common/SelectControlValueAccessor-directive /api/forms/SelectControlValueAccessor
|
||||
/api/common/SlicePipe-class.html /api/common/SlicePipe
|
||||
/api/core/AnimationStateDeclarationMetadata /api/animations
|
||||
/api/core/DoCheck-interface.html /api/core/DoCheck
|
||||
/api/core/HostBinding-var /api/core/HostBinding
|
||||
/api/core/OpaqueToken-class /api/core/OpaqueToken
|
||||
/api/core/OptionalMetadata-class /api/core/Optional
|
||||
/api/core/PLATFORM_PIPES /api/common/CommonModule
|
||||
/api/core/Provider-class.html /api/core/Provider
|
||||
/api/core/Renderer-class /api/core/Renderer
|
||||
/api/core/testing/async-function /api/core/testing/async
|
||||
/api/core/testing/index/async-function /api/core/testing/async
|
||||
/api/core/testing/index/TestBed-class.html /api/core/testing/TestBed
|
||||
/api/core/testing/inject-function /api/core/testing/inject
|
||||
/api/core/testing/inject-function.html /api/core/testing/inject
|
||||
/api/http/Headers-class /api/http/Headers
|
||||
/api/http/Headers-class.html /api/http/Headers
|
||||
/api/http/HTTP_PROVIDERS-let /api/http/HttpModule
|
||||
/api/http/testing/index/MockBackend-class /api/http/testing/MockBackend
|
||||
/api/http/testing/index/MockBackend-class.html /api/http/testing/MockBackend
|
||||
/api/platform-browser-dynamic/testing/index/platformBrowserDynamicTesting-let.html /api/platform-browser-dynamic/testing/platformBrowserDynamicTesting
|
||||
/api/platform-browser/AnimationDriver /api/animations/browser/AnimationDriver
|
||||
/api/router/Route-class /api/router/Route
|
||||
/api/router/RouterLink-directive /api/router/RouterLink
|
||||
/api/testing/tick-function /api/core/testing/tick
|
||||
/api/upgrade/static/downgradeComponent-function /api/upgrade/static/downgradeComponent
|
||||
/api/upgrade/static/downgradeComponent-function.html /api/upgrade/static/downgradeComponent
|
||||
/api/upgrade/static/index/downgradeComponent-function /api/upgrade/static/downgradeComponent
|
||||
/api/upgrade/static/UpgradeModule-class /api/upgrade/static/UpgradeModule
|
||||
/docs/js/latest/api/ /api
|
||||
/docs/js/latest/api/animate/AnimationBuilder-class /api/animations/AnimationBuilder
|
||||
/docs/js/latest/api/animate/CssAnimationBuilder-class.html /api/animations/CssAnimationBuilder
|
||||
/docs/js/latest/api/animations/index/trigger-function /api/animations/trigger
|
||||
/docs/js/latest/api/common/ControlGroup-class.html /api/forms/FormGroup
|
||||
/docs/js/latest/api/common/index/DatePipe-pipe /api/common/DatePipe
|
||||
/docs/js/latest/api/common/index/Location-class.html /api/common/Location
|
||||
/docs/js/latest/api/common/index/MaxLengthValidator-directive.html /api/forms/MaxLengthValidator
|
||||
/docs/js/latest/api/common/index/NgFor-directive /api/common/NgForOf
|
||||
/docs/js/latest/api/common/index/NgFor-directive.html /api/common/NgForOf
|
||||
/docs/js/latest/api/common/index/NgFor-type-alias /api/common/NgForOf
|
||||
/docs/js/latest/api/common/index/NgFor-type-alias.html /api/common/NgForOf
|
||||
/docs/js/latest/api/common/index/NgTemplateOutlet-directive /api/common/NgTemplateOutlet
|
||||
/docs/js/latest/api/common/NgStyle-directive /api/common/NgStyle
|
||||
/docs/js/latest/api/core/DynamicComponentLoader-class.html /api/core/DynamicComponentLoader
|
||||
/docs/js/latest/api/core/HostListener-var /api/core/HostListener
|
||||
/docs/js/latest/api/core/index/AfterViewChecked-class /api/core/AfterViewChecked
|
||||
/docs/js/latest/api/core/index/AnimationStateTransitionMetadata-class.html /api/core/AnimationStateTransitionMetadata
|
||||
/docs/js/latest/api/core/index/AnimationStateTransitionMetadata-type-alias /api/core/AnimationStateTransitionMetadata
|
||||
/docs/js/latest/api/core/index/ApplicationModule-class /api/core/ApplicationModule
|
||||
/docs/js/latest/api/core/index/ApplicationRef-class /api/core/ApplicationRef
|
||||
/docs/js/latest/api/core/index/ChangeDetectorRef-class /api/core/ChangeDetectorRef
|
||||
/docs/js/latest/api/core/index/ComponentFactory-class /api/core/ComponentFactory
|
||||
/docs/js/latest/api/core/index/DebugNode-class /api/core/DebugNode
|
||||
/docs/js/latest/api/core/index/destroyPlatform-function /api/core/destroyPlatform
|
||||
/docs/js/latest/api/core/index/DirectiveMetadata-class /api/core/Directive
|
||||
/docs/js/latest/api/core/index/ErrorHandler-class /api/core/ErrorHandler
|
||||
/docs/js/latest/api/core/index/EventEmitter-class /api/core/EventEmitter
|
||||
/docs/js/latest/api/core/index/EventEmitter-class.html /api/core/EventEmitter
|
||||
/docs/js/latest/api/core/index/getPlatform-function /api/core/getPlatform
|
||||
/docs/js/latest/api/core/index/NgModule-interface /api/core/NgModule
|
||||
/docs/js/latest/api/core/index/NgModuleRef-class /api/core/NgModuleRef
|
||||
/docs/js/latest/api/core/index/NgModuleRef-class.html /api/core/NgModuleRef
|
||||
/docs/js/latest/api/core/index/OnInit-class /api/core/OnInit
|
||||
/docs/js/latest/api/core/index/OnInit-class.html /api/core/OnInit
|
||||
/docs/js/latest/api/core/index/OnInit-interface /api/core/OnInit
|
||||
/docs/js/latest/api/core/index/PlatformRef-class /api/core/PlatformRef
|
||||
/docs/js/latest/api/core/index/QueryList-class.html /api/core/QueryList
|
||||
/docs/js/latest/api/core/index/RenderComponentType-class /api/core/RenderComponentType
|
||||
/docs/js/latest/api/core/index/Renderer2-class.html /api/core/Renderer2
|
||||
/docs/js/latest/api/core/index/state-function.html /api/core/state
|
||||
/docs/js/latest/api/core/index/transition-function.html /api/core/transition
|
||||
/docs/js/latest/api/core/index/trigger-function /api/core/trigger
|
||||
/docs/js/latest/api/core/index/trigger-function.html /api/core/trigger
|
||||
/docs/js/latest/api/core/index/ViewChild-decorator /api/core/ViewChild
|
||||
/docs/js/latest/api/core/index/wtfLeave-let /api/core/wtfLeave
|
||||
/docs/js/latest/api/core/Injector-class.html /api/core/Injector
|
||||
/docs/js/latest/api/core/Query-var /api/core/Query
|
||||
/docs/js/latest/api/core/ResolvedProvider-interface.html /api/core/ResolvedProvider
|
||||
/docs/js/latest/api/core/testing/index/TestBed-class /api/core/testing/TestBed
|
||||
/docs/js/latest/api/core/testing/index/tick-function /api/core/testing/tick
|
||||
/docs/js/latest/api/core/testing/index/tick-function.html /api/core/testing/tick
|
||||
/docs/js/latest/api/core/ViewContainerRef-class.html /api/core/ViewContainerRef
|
||||
/docs/js/latest/api/forms/index/AbstractControl-class /api/forms/AbstractControl
|
||||
/docs/js/latest/api/forms/index/AbstractControl-class.html /api/forms/AbstractControl
|
||||
/docs/js/latest/api/forms/index/FormArray-class.html /api/forms/FormArray
|
||||
/docs/js/latest/api/forms/index/FormBuilder-class.html /api/forms/FormBuilder
|
||||
/docs/js/latest/api/forms/index/NG_VALIDATORS-let /api/forms/NG_VALIDATORS
|
||||
/docs/js/latest/api/forms/index/Validator-interface.html /api/forms/Validator
|
||||
/docs/js/latest/api/http/ConnectionBackend-class /api/http/ConnectionBackend
|
||||
/docs/js/latest/api/http/index/Http-class.html /api/http/Http
|
||||
/docs/js/latest/api/http/index/Jsonp-class.html /api/http/Jsonp
|
||||
/docs/js/latest/api/http/index/ResponseOptions-class.html /api/http/ResponseOptions
|
||||
/docs/js/latest/api/http/index/URLSearchParams-class /api/http/URLSearchParams
|
||||
/docs/js/latest/api/http/index/XHRConnection-class /api/http/XHRConnection
|
||||
/docs/js/latest/api/http/index/XHRConnection-class.html /api/http/XHRConnection
|
||||
/docs/js/latest/api/http/testing/index/MockConnection-class.html /api/http/testing/MockConnection
|
||||
/docs/js/latest/api/http/testing/MockBackend-class /api/http/testing/MockBackend
|
||||
/docs/js/latest/api/platform-browser-dynamic/index/platformBrowserDynamic-let.html /api/platform-browser-dynamic/platformBrowserDynamic
|
||||
/docs/js/latest/api/platform-browser-dynamic/testing/index/BrowserDynamicTestingModule-class.html /api/platform-browser-dynamic/testing/BrowserDynamicTestingModule
|
||||
/docs/js/latest/api/platform-browser/animations/index/BrowserAnimationsModule-class /api/platform-browser/animations/BrowserAnimationsModule
|
||||
/docs/js/latest/api/platform-browser/animations/index/BrowserAnimationsModule-class.html /api/platform-browser/animations/BrowserAnimationsModule
|
||||
/docs/js/latest/api/platform-browser/animations/index/NoopAnimationsModule-class.html /api/platform-browser/animations/NoopAnimationsModule
|
||||
/docs/js/latest/api/platform-browser/index/DomSanitizer-class /api/platform-browser/DomSanitizer
|
||||
/docs/js/latest/api/platform-browser/index/Meta-class /api/platform-browser/Meta
|
||||
/docs/js/latest/api/platform-browser/index/MetaDefinition-type-alias /api/platform-browser/MetaDefinition
|
||||
/docs/js/latest/api/platform-browser/index/SafeUrl-interface /api/platform-browser/SafeUrl
|
||||
/docs/js/latest/api/platform-browser/index/Title-class /api/platform-browser/Title
|
||||
/docs/js/latest/api/platform-browser/index/Title-class.html /api/platform-browser/Title
|
||||
/docs/js/latest/api/platform-server/index/PlatformState-class /api/platform-server/PlatformState
|
||||
/docs/js/latest/api/platform-server/index/PlatformState-class.html /api/platform-server/PlatformState
|
||||
/docs/js/latest/api/platform-webworker /api/platform-webworker
|
||||
/docs/js/latest/api/platform-webworker/index/MessageBus-class /api/platform-webworker/MessageBus
|
||||
/docs/js/latest/api/router/index/ActivatedRoute-interface /api/router/ActivatedRoute
|
||||
/docs/js/latest/api/router/index/CanActivate-interface.html /api/router/CanActivate
|
||||
/docs/js/latest/api/router/index/CanActivateChild-interface /api/router/CanActivateChild
|
||||
/docs/js/latest/api/router/index/CanDeactivate-interface.html /api/router/CanDeactivate
|
||||
/docs/js/latest/api/router/index/CanLoad-interface /api/router/CanLoad
|
||||
/docs/js/latest/api/router/index/CanLoad-interface.html /api/router/CanLoad
|
||||
/docs/js/latest/api/router/index/NavigationEnd-class /api/router/NavigationEnd
|
||||
/docs/js/latest/api/router/index/provideRoutes-function /api/router/provideRoutes
|
||||
/docs/js/latest/api/router/index/provideRoutes-function.html /api/router/provideRoutes
|
||||
/docs/js/latest/api/router/index/Router-class /api/router/Router
|
||||
/docs/js/latest/api/router/index/RouterLink-directive /api/router/RouterLink
|
||||
/docs/js/latest/api/router/index/Routes-type-alias /api/router/Routes
|
||||
/docs/js/latest/api/router/index/UrlSegment-class /api/router/UrlSegment
|
||||
/docs/js/latest/api/router/index/UrlSerializer-class.html /api/router/UrlSerializer
|
||||
/docs/js/latest/api/router/Instruction-class /api/router/Instruction
|
||||
/docs/js/latest/api/router/Location-class /api/router/Location
|
||||
/docs/js/latest/api/router/OnActivate-interface /api/router/OnActivate
|
||||
/docs/js/latest/api/router/Redirect-class.html /api/router/Redirect
|
||||
/docs/js/latest/api/router/RouteDefinition-interface.html /api/router/RouteDefinition
|
||||
/docs/js/latest/api/router/RouteParams-class /api/router/RouteParams
|
||||
/docs/js/latest/api/router/RouteParams-class.html /api/router/RouteParams
|
||||
/docs/js/latest/api/router/Router-class.html /api/router/Router
|
||||
/docs/js/latest/api/router/testing /api/router/testing
|
||||
/docs/js/latest/api/upgrade/index/UpgradeAdapter-class.html /api/upgrade/UpgradeAdapter
|
||||
/docs/js/latest/api/upgrade/static/UpgradeModule-class /api/upgrade/static/UpgradeModule
|
||||
/docs/js/latest/api/upgrade/static/UpgradeModule-class.html /api/upgrade/static/UpgradeModule
|
||||
/docs/js/latest/cookbook/ts-to-js.html https://github.com/angular/angular/blob/master/aio/content/guide/change-log.md#es6--described-in-typescript-to-javascript-2016-11-14
|
||||
/docs/js/latest/glossary /guide/glossary
|
||||
/docs/js/latest/guide/ /docs
|
||||
/docs/js/latest/guide/lifecycle-hooks /guide/lifecycle-hooks
|
||||
/docs/js/latest/guide/ngmodule /guide/ngmodules
|
||||
/docs/js/latest/resources /resources
|
||||
/docs/latest/tutorial /tutorial
|
||||
/styleguide /guide/styleguide
|
||||
/docs/styleguide /guide/styleguide
|
||||
/docs/styleguide.html /guide/styleguide
|
||||
/docs/ts/latest/api/core/HostBinding-var.html /api/core/HostBinding
|
||||
/docs/ts/latest/api/core/index/BaseException-class.html /api/core/BaseException
|
||||
/docs/ts/latest/api/core/index/PLATFORM_PIPES-let.html /api/common/CommonModule
|
||||
/docs/ts/latest/api/core/OnInit-interface.html /api/core/OnInit
|
||||
/docs/ts/latest/api/core/OpaqueToken-class.html /api/core/OpaqueToken
|
||||
/docs/ts/latest/api/core/OptionalMetadata-class.html /api/core/Optional
|
||||
/docs/ts/latest/api/core/testing/index/async-function.html /api/core/testing/async
|
||||
/docs/ts/latest/api/core/testing/index/fakeAsync-function.html /api/core/testing/fakeAsync
|
||||
/docs/ts/latest/api/core/testing/index/TestComponentRenderer-class.html /api/core/testing/TestComponentRenderer
|
||||
/docs/ts/latest/api/core/testing/index/tick-function.html /api/core/testing/tick
|
||||
/docs/ts/latest/api/http/Connection-class.html /api/http/Connection
|
||||
/docs/ts/latest/api/http/testing/index/MockBackend-class.html /api/http/testing/MockBackend
|
||||
/docs/ts/latest/api/http/testing/index/MockConnection-class.html /api/http/testing/MockConnection
|
||||
/docs/ts/latest/api/platform-browser-dynamic/index/workerAppDynamicPlatform-let.html /api/platform-browser-dynamic/workerAppDynamicPlatform
|
||||
/docs/ts/latest/api/testing/fakeAsync-function.html /api/core/testing/fakeAsync
|
||||
/docs/ts/latest/cookbook/ts-to-js.html https://github.com/angular/angular/blob/master/aio/content/guide/change-log.md#es6--described-in-typescript-to-javascript-2016-11-14
|
||||
/guide/cli-quickstart /guide/quickstart
|
||||
/guide/learning-angular /guide/quickstart
|
||||
/guide/learning-angular.html /guide/quickstart
|
||||
/guide/metadata /guide/aot-compiler
|
||||
/guide/service-worker-getstart /guide/service-worker-getting-started
|
||||
/guide/service-worker-comm /guide/service-worker-communications
|
||||
/guide/service-worker-configref /guide/service-worker-config
|
||||
/news https://blog.angular.io/
|
||||
/news.html https://blog.angular.io/
|
||||
/testing /guide/testing
|
||||
/testing/first-app-tests.html /guide/testing
|
76
aio/tests/deployment/shared/helpers.ts
Normal file
76
aio/tests/deployment/shared/helpers.ts
Normal file
@ -0,0 +1,76 @@
|
||||
import { resolve } from 'canonical-path';
|
||||
import { load as loadJson } from 'cjson';
|
||||
import { readFileSync } from 'fs';
|
||||
import { get as httpGet } from 'http';
|
||||
import { get as httpsGet } from 'https';
|
||||
|
||||
import { FirebaseRedirector, FirebaseRedirectConfig } from '../../../tools/firebase-test-utils/FirebaseRedirector';
|
||||
|
||||
|
||||
const AIO_DIR = resolve(__dirname, '../../..');
|
||||
|
||||
export function getRedirector() {
|
||||
return new FirebaseRedirector(loadRedirects());
|
||||
}
|
||||
|
||||
export function loadRedirects(): FirebaseRedirectConfig[] {
|
||||
const pathToFirebaseJSON = `${AIO_DIR}/firebase.json`;
|
||||
const contents = loadJson(pathToFirebaseJSON);
|
||||
return contents.hosting.redirects;
|
||||
}
|
||||
|
||||
export function loadLegacyUrls() {
|
||||
const pathToLegacyUrls = `${__dirname}/URLS_TO_REDIRECT.txt`;
|
||||
const urls = readFileSync(pathToLegacyUrls, 'utf8').split('\n').map(line => line.split('\t'));
|
||||
return urls;
|
||||
}
|
||||
|
||||
export function loadLocalSitemapUrls() {
|
||||
const pathToSiteMap = `${AIO_DIR}/src/generated/sitemap.xml`;
|
||||
const xml = readFileSync(pathToSiteMap, 'utf8');
|
||||
return extractSitemapUrls(xml);
|
||||
}
|
||||
|
||||
export async function loadRemoteSitemapUrls(host: string) {
|
||||
const urlToSiteMap = `${host}/generated/sitemap.xml`;
|
||||
const get = /^https:/.test(host) ? httpsGet : httpGet;
|
||||
|
||||
const xml = await new Promise<string>((resolve, reject) => {
|
||||
let responseText = '';
|
||||
get(urlToSiteMap, res => res
|
||||
.on('data', chunk => responseText += chunk)
|
||||
.on('end', () => resolve(responseText))
|
||||
.on('error', reject));
|
||||
});
|
||||
|
||||
// Currently, all sitemaps use `angular.io` as host in URLs (which is fine since we only use the
|
||||
// sitemap `angular.io`). See also `aio/src/extra-files/*/robots.txt`.
|
||||
return extractSitemapUrls(xml, 'https://angular.io/');
|
||||
}
|
||||
|
||||
export function loadSWRoutes() {
|
||||
const pathToSWManifest = `${AIO_DIR}/ngsw-manifest.json`;
|
||||
const contents = loadJson(pathToSWManifest);
|
||||
const routes = contents.routing.routes;
|
||||
return Object.keys(routes).map(route => {
|
||||
const routeConfig = routes[route];
|
||||
switch (routeConfig.match) {
|
||||
case 'exact':
|
||||
return (url) => url === route;
|
||||
case 'prefix':
|
||||
return (url) => url.startsWith(route);
|
||||
case 'regex':
|
||||
const regex = new RegExp(route);
|
||||
return (url) => regex.test(url);
|
||||
default:
|
||||
throw new Error(`unknown route config: ${route} - ${routeConfig.match}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Private functions
|
||||
function extractSitemapUrls(xml: string, host = '%%DEPLOYMENT_HOST%%') {
|
||||
const urls: string[] = [];
|
||||
xml.replace(/<loc>([^<]+)<\/loc>/g, (_, loc) => urls.push(loc.replace(host, '')) as any);
|
||||
return urls;
|
||||
}
|
Reference in New Issue
Block a user