From 02742552f3e05b19c2915235d62fbc570a24c667 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Tue, 29 Jun 2021 18:59:35 +0300 Subject: [PATCH] refactor(docs-infra): make angular.io and docs examples compatible with RxJS v7 (#42660) This commit applies the necessary changes to make angular.io and (most) docs examples compatible with both RxJS v6 and v7. It also adds new steps to relevant CI jobs to test angular.io and docs examples against RxJS v7 as well (to catch potential regressions). NOTE: Some of the docs examples are not compatible with RxJS v7 and are therefore excluded from the tests. The SystemJS-based ngUpgrade examples in particular are excluded, since they require a different SystemJS configs to run against RxJS v6 and v7 and the extra complexity of managing that is not worth it for the 4 affected examples. PR Close #42660 --- .circleci/config.yml | 7 +++++++ aio/content/examples/elements/src/app/popup.component.ts | 2 +- aio/src/app/custom-elements/api/api.service.ts | 2 +- aio/src/app/custom-elements/toc/toc.component.ts | 2 +- aio/src/app/layout/notification/notification.component.ts | 2 +- aio/src/app/shared/scroll-spy.service.ts | 2 +- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e5afbb0f19..2997e4006e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -441,6 +441,9 @@ jobs: - run: yarn --cwd aio test-pwa-score-localhost $CI_AIO_MIN_PWA_SCORE # Check the bundle sizes. - run: yarn --cwd aio payload-size aio-local + # Run tests with RxJS v7. + - run: yarn --cwd aio add rxjs@7.1.0 + - run: yarn --cwd aio test --progress=false --watch=false test_aio_tools: executor: default-executor @@ -469,6 +472,10 @@ jobs: # Since the parallelism is set to "5", there will be five parallel CircleCI containers. # with either "0", "1", etc as node index. This can be passed to the "--shard" argument. - run: yarn --cwd aio example-e2e --setup --local --cliSpecsConcurrency=5 --shard=${CIRCLE_NODE_INDEX}/${CIRCLE_NODE_TOTAL} + # Run tests with RxJS v7. + # (Exclude some examples that are not yet compatible with v7.) + - run: yarn --cwd aio/tools/examples/shared add rxjs@7.1.0 && yarn --cwd aio boilerplate:add + - run: yarn --cwd aio example-e2e --cliSpecsConcurrency=5 --shard=${CIRCLE_NODE_INDEX}/${CIRCLE_NODE_TOTAL} --exclude=practical-observable-usage --exclude=upgrade-module --exclude=upgrade-phonecat # This job should only be run on PR builds, where `CI_PULL_REQUEST` is not `false`. aio_preview: diff --git a/aio/content/examples/elements/src/app/popup.component.ts b/aio/content/examples/elements/src/app/popup.component.ts index eda1d8212a..c14a7b86ab 100644 --- a/aio/content/examples/elements/src/app/popup.component.ts +++ b/aio/content/examples/elements/src/app/popup.component.ts @@ -50,5 +50,5 @@ export class PopupComponent { private _message = ''; @Output() - closed = new EventEmitter(); + closed = new EventEmitter(); } diff --git a/aio/src/app/custom-elements/api/api.service.ts b/aio/src/app/custom-elements/api/api.service.ts index b6ca5ea26d..2e7bd58171 100644 --- a/aio/src/app/custom-elements/api/api.service.ts +++ b/aio/src/app/custom-elements/api/api.service.ts @@ -30,7 +30,7 @@ export class ApiService implements OnDestroy { private apiBase = DOC_CONTENT_URL_PREFIX + 'api/'; private apiListJsonDefault = 'api-list.json'; private firstTime = true; - private onDestroy = new Subject(); + private onDestroy = new Subject(); private sectionsSubject = new ReplaySubject(1); private _sections = this.sectionsSubject.pipe(takeUntil(this.onDestroy)); diff --git a/aio/src/app/custom-elements/toc/toc.component.ts b/aio/src/app/custom-elements/toc/toc.component.ts index ceb6ce821a..9883ffb441 100644 --- a/aio/src/app/custom-elements/toc/toc.component.ts +++ b/aio/src/app/custom-elements/toc/toc.component.ts @@ -19,7 +19,7 @@ export class TocComponent implements OnInit, AfterViewInit, OnDestroy { isCollapsed = true; isEmbedded = false; @ViewChildren('tocItem') private items: QueryList; - private onDestroy = new Subject(); + private onDestroy = new Subject(); primaryMax = 4; tocList: TocItem[]; diff --git a/aio/src/app/layout/notification/notification.component.ts b/aio/src/app/layout/notification/notification.component.ts index 23a619440c..ac6920d272 100644 --- a/aio/src/app/layout/notification/notification.component.ts +++ b/aio/src/app/layout/notification/notification.component.ts @@ -23,7 +23,7 @@ export class NotificationComponent implements OnInit { @Input() dismissOnContentClick: boolean; @Input() notificationId: string; @Input() expirationDate: string; - @Output() dismissed = new EventEmitter(); + @Output() dismissed = new EventEmitter(); @HostBinding('@hideAnimation') showNotification: 'show'|'hide'; diff --git a/aio/src/app/shared/scroll-spy.service.ts b/aio/src/app/shared/scroll-spy.service.ts index 80c72e2835..c44aad1f94 100644 --- a/aio/src/app/shared/scroll-spy.service.ts +++ b/aio/src/app/shared/scroll-spy.service.ts @@ -118,7 +118,7 @@ export class ScrollSpiedElementGroup { @Injectable() export class ScrollSpyService { private spiedElementGroups: ScrollSpiedElementGroup[] = []; - private onStopListening = new Subject(); + private onStopListening = new Subject(); private resizeEvents = fromEvent(window, 'resize').pipe(auditTime(300), takeUntil(this.onStopListening)); private scrollEvents = fromEvent(window, 'scroll').pipe(auditTime(10), takeUntil(this.onStopListening)); private lastContentHeight: number;