Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

build: upgrade to Angular and CDK v14 #1409

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# To validate changes, use an online parser, eg.
# http://yaml-online-parser.appspot.com/

var_1: &docker_image circleci/node:14.16.1
var_1: &docker_image cimg/node:16.14.0
var_2: &cache_key v2-ng-layout-{{ .Branch }}-{{ checksum "yarn.lock" }}-0.7.0

# Settings common to each job
Expand Down Expand Up @@ -53,7 +53,7 @@ var_8: &docker-firefox-image
# TODO(devversion): Temporarily use a image that includes Firefox 62 because the
# ngcontainer image does include an old Firefox version that does not support headless.
# See the PR that fixes this: https://github.com/angular/angular/pull/26435
- image: circleci/node:14.16.1-browsers
- image: cimg/node:16.14.0-browsers

# Attaches the release output which has been stored in the workspace to the current job.
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
Expand All @@ -64,7 +64,9 @@ var_9: &attach_release_output
# -----------------------------
# Container version of CircleCI
# -----------------------------
version: 2
version: 2.1
orbs:
browser-tools: circleci/[email protected]

# -----------------------------------------------------------------------------------------
# Job definitions. Jobs which are defined just here, will not run automatically. Each job
Expand Down Expand Up @@ -103,6 +105,7 @@ jobs:
steps:
- *checkout_code
- *attach_release_output
- browser-tools/install-browser-tools
- run: ./scripts/circleci/run-local-browser-tests.sh

# ----------------------------------------------------------------------------
Expand All @@ -111,6 +114,7 @@ jobs:
# ----------------------------------------------------------------------------
tests_browserstack:
<<: *job_defaults
resource_class: xlarge
environment:
BROWSER_STACK_USERNAME: 'adamplumer1'
BROWSER_STACK_ACCESS_KEY: 'WgLjxoB2zQ3tqmsznKnz'
Expand All @@ -135,6 +139,7 @@ jobs:
steps:
- *checkout_code
- *attach_release_output
- browser-tools/install-browser-tools

- run: ./scripts/circleci/run-saucelabs-tests.sh

Expand Down
3 changes: 1 addition & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,5 @@
}
}
}
},
"defaultProject": "@angular/flex-layout"
}
}
48 changes: 26 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"license": "MIT",
"engines": {
"node": "^12.20.0 || ^14.15.0 || >=16.10.0",
"node": "^14.15.0 || >=16.10.0",
"yarn": ">=1.22.4 <2",
"npm": "Please use yarn instead of NPM to install dependencies"
},
Expand All @@ -31,34 +31,34 @@
"private": true,
"requiredAngularVersion": "^13.0.0",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just putting this request in the review comments. Can you use ^14.0.0 || ^15.0.0 for this, so delays like this in the future won't be blocking? Also, the engines declaration at the top shouldn't include 12.x node versions anymore, since v14 dropped support for 12.

"dependencies": {
"@angular/animations": "~13.0.0",
"@angular/common": "~13.0.0",
"@angular/compiler": "~13.0.0",
"@angular/core": "~13.0.0",
"@angular/forms": "~13.0.0",
"@angular/material": "^13.0.2",
"@angular/platform-browser": "~13.0.0",
"@angular/platform-browser-dynamic": "~13.0.0",
"@angular/platform-server": "~13.0.0",
"@angular/router": "~13.0.0",
"@nguniversal/builders": "^13.0.1",
"@nguniversal/express-engine": "^13.0.1",
"@angular/animations": "~14.0.0",
"@angular/common": "~14.0.0",
"@angular/compiler": "~14.0.0",
"@angular/core": "~14.0.0",
"@angular/forms": "~14.0.0",
"@angular/material": "~14.0.0",
"@angular/platform-browser": "~14.0.0",
"@angular/platform-browser-dynamic": "~14.0.0",
"@angular/platform-server": "~14.0.0",
"@angular/router": "~14.0.0",
"@nguniversal/builders": "~14.0.0",
"@nguniversal/express-engine": "~14.0.0",
"express": "^4.17.1",
"rxjs": "~7.4.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~13.0.0",
"@angular/cdk": "^13.0.2",
"@angular/cli": "~13.0.0",
"@angular/compiler-cli": "~13.0.0",
"@ngtools/webpack": "^13.0.3",
"@nguniversal/builders": "^13.0.1",
"@angular-devkit/build-angular": "~14.0.0",
"@angular/cdk": "~14.0.0",
"@angular/cli": "~14.0.0",
"@angular/compiler-cli": "~14.0.0",
"@ngtools/webpack": "~14.0.0",
"@nguniversal/builders": "~14.0.0",
"@types/express": "^4.17.0",
"@types/jasmine": "~3.10.0",
"@types/minimatch": "^3.0.5",
"@types/node": "^12.11.1",
"@types/node": "^14.18.21",
"conventional-changelog-cli": "^2.1.1",
"jasmine-core": "~3.10.0",
"karma": "~6.3.0",
Expand All @@ -71,15 +71,19 @@
"karma-parallel": "^0.3.1",
"karma-sauce-launcher": "^2.0.2",
"minimatch": "^3.0.4",
"ng-packagr": "^13.0.0",
"ng-packagr": "~14.0.0",
"postcss": "^8.3.3",
"postcss-scss": "^4.0.2",
"protractor": "^7.0.0",
"stylelint": "^14.1.0",
"ts-node": "^10.4.0",
"tslint": "^6.1.3",
"typescript": "~4.4.3",
"typescript": "~4.7.3",
"webpack": "^5.64.1",
"webpack-cli": "^4.9.1"
},
"resolutions": {
"browser-sync-client": "2.26.13",
"**/https-proxy-agent": "5.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const selector = `[fxHide], [fxHide.yba]`;

@Directive({selector, inputs})
export class CustomHideDirective extends ShowHideDirective {
protected inputs = inputs;
protected override inputs = inputs;
}

@Component({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,9 @@ export const customMatchers: jasmine.CustomMatcherFactories = {
toEqual: function (util) {
return {
compare: function (actual: any, expected: any) {
return {pass: util.equals(actual, expected, [compareMap])};
return {pass: util.equals(actual, expected)};
}
};

function compareMap(actual: any, expected: any) {
if (actual instanceof Map) {
let pass = actual.size === expected.size;
if (pass) {
actual.forEach((v: any, k: any) => {
pass = pass && util.equals(v, expected.get(k));
});
}
return pass;
} else {
return undefined;
}
}
},

toHaveText: function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class MockMatchMedia extends MatchMedia {
* Call window.matchMedia() to build a MediaQueryList; which
* supports 0..n listeners for activation/deactivation
*/
protected buildMQL(query: string): MediaQueryList {
protected override buildMQL(query: string): MediaQueryList {
return new MockMediaQueryList(query);
}

Expand Down
6 changes: 3 additions & 3 deletions projects/libs/flex-layout/extended/class/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {BaseDirective2, StyleUtils, MediaMarshaller} from '@angular/flex-layout/
@Directive()
export class ClassDirective extends BaseDirective2 implements DoCheck {

protected DIRECTIVE_KEY = 'ngClass';
protected override DIRECTIVE_KEY = 'ngClass';

/**
* Capture class assignments so we cache the default classes
Expand Down Expand Up @@ -51,7 +51,7 @@ export class ClassDirective extends BaseDirective2 implements DoCheck {
this.setValue('', '');
}

protected updateWithValue(value: any) {
protected override updateWithValue(value: any) {
this.ngClassInstance.ngClass = value;
this.ngClassInstance.ngDoCheck();
}
Expand Down Expand Up @@ -87,5 +87,5 @@ const selector = `
*/
@Directive({selector, inputs})
export class DefaultClassDirective extends ClassDirective {
protected inputs = inputs;
protected override inputs = inputs;
}
8 changes: 4 additions & 4 deletions projects/libs/flex-layout/extended/img-src/img-src.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class ImgSrcStyleBuilder extends StyleBuilder {

@Directive()
export class ImgSrcDirective extends BaseDirective2 {
protected DIRECTIVE_KEY = 'img-src';
protected override DIRECTIVE_KEY = 'img-src';
protected defaultSrc = '';

@Input('src')
Expand Down Expand Up @@ -56,7 +56,7 @@ export class ImgSrcDirective extends BaseDirective2 {
* Do nothing to standard `<img src="">` usages, only when responsive
* keys are present do we actually call `setAttribute()`
*/
protected updateWithValue(value?: string) {
protected override updateWithValue(value?: string) {
const url = value || this.defaultSrc;
if (isPlatformServer(this.platformId) && this.serverModuleLoaded) {
this.addStyles(url);
Expand All @@ -65,7 +65,7 @@ export class ImgSrcDirective extends BaseDirective2 {
}
}

protected styleCache = imgSrcCache;
protected override styleCache = imgSrcCache;
}

const imgSrcCache: Map<string, StyleDefinition> = new Map();
Expand Down Expand Up @@ -93,5 +93,5 @@ const selector = `
*/
@Directive({selector, inputs})
export class DefaultImgSrcDirective extends ImgSrcDirective {
protected inputs = inputs;
protected override inputs = inputs;
}
8 changes: 4 additions & 4 deletions projects/libs/flex-layout/extended/show-hide/show-hide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class ShowHideStyleBuilder extends StyleBuilder {

@Directive()
export class ShowHideDirective extends BaseDirective2 implements AfterViewInit, OnChanges {
protected DIRECTIVE_KEY = 'show-hide';
protected override DIRECTIVE_KEY = 'show-hide';

/** Original DOM Element CSS display style */
protected display: string = '';
Expand Down Expand Up @@ -97,7 +97,7 @@ export class ShowHideDirective extends BaseDirective2 implements AfterViewInit,
* Default to use the non-responsive Input value ('fxShow')
* Then conditionally override with the mq-activated Input's current value
*/
ngOnChanges(changes: SimpleChanges) {
override ngOnChanges(changes: SimpleChanges) {
Object.keys(changes).forEach(key => {
if (this.inputs.indexOf(key) !== -1) {
const inputKey = key.split('.');
Expand Down Expand Up @@ -143,7 +143,7 @@ export class ShowHideDirective extends BaseDirective2 implements AfterViewInit,
}

/** Validate the visibility value and then update the host's inline display style */
protected updateWithValue(value: boolean | string = true) {
protected override updateWithValue(value: boolean | string = true) {
if (value === '') {
return;
}
Expand Down Expand Up @@ -185,5 +185,5 @@ const selector = `
*/
@Directive({selector, inputs})
export class DefaultShowHideDirective extends ShowHideDirective {
protected inputs = inputs;
protected override inputs = inputs;
}
2 changes: 1 addition & 1 deletion projects/libs/flex-layout/extended/show-hide/show.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ const selector = `[fxShow.sm-md], [fxHide.sm-md], [fxShow.sm.lg], [fxHide.sm.lg]
// Used to test custom breakpoint functionality
@Directive({inputs, selector})
class FxShowHideDirective extends ShowHideDirective {
protected inputs = inputs;
protected override inputs = inputs;
}


Expand Down
8 changes: 4 additions & 4 deletions projects/libs/flex-layout/extended/style/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
@Directive()
export class StyleDirective extends BaseDirective2 implements DoCheck {

protected DIRECTIVE_KEY = 'ngStyle';
protected override DIRECTIVE_KEY = 'ngStyle';
protected fallbackStyles: NgStyleMap;
protected isServer: boolean;

Expand All @@ -68,7 +68,7 @@ export class StyleDirective extends BaseDirective2 implements DoCheck {
}

/** Add generated styles */
protected updateWithValue(value: any) {
protected override updateWithValue(value: any) {
const styles = this.buildStyleMap(value);
this.ngStyleInstance.ngStyle = {...this.fallbackStyles, ...styles};
if (this.isServer) {
Expand All @@ -78,7 +78,7 @@ export class StyleDirective extends BaseDirective2 implements DoCheck {
}

/** Remove generated styles */
protected clearStyles() {
protected override clearStyles() {
this.ngStyleInstance.ngStyle = this.fallbackStyles;
this.ngStyleInstance.ngDoCheck();
}
Expand Down Expand Up @@ -136,7 +136,7 @@ const selector = `
*/
@Directive({selector, inputs})
export class DefaultStyleDirective extends StyleDirective implements DoCheck {
protected inputs = inputs;
protected override inputs = inputs;
}

/** Build a styles map from a list of styles, while sanitizing bad values first */
Expand Down
6 changes: 3 additions & 3 deletions projects/libs/flex-layout/flex/flex-align/flex-align.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const selector = `
@Directive()
export class FlexAlignDirective extends BaseDirective2 {

protected DIRECTIVE_KEY = 'flex-align';
protected override DIRECTIVE_KEY = 'flex-align';

constructor(elRef: ElementRef,
styleUtils: StyleUtils,
Expand All @@ -68,12 +68,12 @@ export class FlexAlignDirective extends BaseDirective2 {
this.init();
}

protected styleCache = flexAlignCache;
protected override styleCache = flexAlignCache;
}

const flexAlignCache: Map<string, StyleDefinition> = new Map();

@Directive({selector, inputs})
export class DefaultFlexAlignDirective extends FlexAlignDirective {
protected inputs = inputs;
protected override inputs = inputs;
}
2 changes: 1 addition & 1 deletion projects/libs/flex-layout/flex/flex-fill/flex-fill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class FlexFillDirective extends BaseDirective2 {
this.addStyles('');
}

protected styleCache = flexFillCache;
protected override styleCache = flexFillCache;
}

const flexFillCache: Map<string, StyleDefinition> = new Map();
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ describe('flex-offset directive', () => {

@Injectable({providedIn: FlexModule})
export class MockFlexOffsetStyleBuilder extends StyleBuilder {
shouldCache = false;
override shouldCache = false;
buildStyles(_input: string) {
return {'margin-top': '10px'};
}
Expand Down
6 changes: 3 additions & 3 deletions projects/libs/flex-layout/flex/flex-offset/flex-offset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const selector = `
*/
@Directive()
export class FlexOffsetDirective extends BaseDirective2 implements OnChanges {
protected DIRECTIVE_KEY = 'flex-offset';
protected override DIRECTIVE_KEY = 'flex-offset';

constructor(elRef: ElementRef,
protected directionality: Directionality,
Expand All @@ -94,7 +94,7 @@ export class FlexOffsetDirective extends BaseDirective2 implements OnChanges {
* NOTE: this will assign `margin-left` if the parent flex-direction == 'row',
* otherwise `margin-top` is used for the offset.
*/
protected updateWithValue(value: string|number = ''): void {
protected override updateWithValue(value: string|number = ''): void {
// The flex-direction of this element's flex container. Defaults to 'row'.
const layout = this.getFlexFlowDirection(this.parentElement!, true);
const isRtl = this.directionality.value === 'rtl';
Expand All @@ -113,7 +113,7 @@ export class FlexOffsetDirective extends BaseDirective2 implements OnChanges {

@Directive({selector, inputs})
export class DefaultFlexOffsetDirective extends FlexOffsetDirective {
protected inputs = inputs;
protected override inputs = inputs;
}

const flexOffsetCacheRowRtl: Map<string, StyleDefinition> = new Map();
Expand Down
Loading