diff --git a/.gitignore b/.gitignore index e50b457..7b821e4 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ speed-measure-plugin.json !.vscode/extensions.json # misc +/.angular/cache /.sass-cache /connect.lock /coverage diff --git a/angular.json b/angular.json index 84dff20..aeb17a5 100644 --- a/angular.json +++ b/angular.json @@ -10,10 +10,15 @@ "prefix": "ci", "architect": { "build": { - "builder": "@angular-devkit/build-ng-packagr:build", + "builder": "@angular-devkit/build-angular:ng-packagr", "options": { "tsConfig": "projects/lib/tsconfig.lib.json", "project": "projects/lib/ng-package.json" + }, + "configurations": { + "production": { + "tsConfig": "projects/lib/tsconfig.lib.prod.json" + } } }, "test": { @@ -23,18 +28,6 @@ "tsConfig": "projects/lib/tsconfig.spec.json", "karmaConfig": "projects/lib/karma.conf.js" } - }, - "lint": { - "builder": "@angular-devkit/build-angular:tslint", - "options": { - "tsConfig": [ - "projects/lib/tsconfig.lib.json", - "projects/lib/tsconfig.spec.json" - ], - "exclude": [ - "**/node_modules/**" - ] - } } } }, @@ -61,7 +54,13 @@ "projects/example/src/styles.css", "./node_modules/highlight.js/styles/github.css" ], - "scripts": [] + "scripts": [], + "vendorChunk": true, + "extractLicenses": false, + "buildOptimizer": false, + "sourceMap": true, + "optimization": false, + "namedChunks": true }, "configurations": { "production": { @@ -74,9 +73,7 @@ "optimization": true, "outputHashing": "all", "sourceMap": false, - "extractCss": true, "namedChunks": false, - "aot": true, "extractLicenses": true, "vendorChunk": false, "buildOptimizer": true, @@ -85,10 +82,15 @@ "type": "initial", "maximumWarning": "2mb", "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb" } ] } - } + }, + "defaultConfiguration": "" }, "serve": { "builder": "@angular-devkit/build-angular:dev-server", @@ -123,18 +125,6 @@ "projects/example/src/assets" ] } - }, - "lint": { - "builder": "@angular-devkit/build-angular:tslint", - "options": { - "tsConfig": [ - "projects/example/tsconfig.app.json", - "projects/example/tsconfig.spec.json" - ], - "exclude": [ - "**/node_modules/**" - ] - } } } }, @@ -154,15 +144,6 @@ "devServerTarget": "example:serve:production" } } - }, - "lint": { - "builder": "@angular-devkit/build-angular:tslint", - "options": { - "tsConfig": "projects/example-e2e/tsconfig.e2e.json", - "exclude": [ - "**/node_modules/**" - ] - } } } } diff --git a/package.json b/package.json index c5b79f1..c76a814 100644 --- a/package.json +++ b/package.json @@ -19,46 +19,44 @@ }, "private": true, "dependencies": { - "@angular-devkit/build-angular": "^0.801.1", - "@angular/animations": "~8.1.1", - "@angular/common": "~8.1.1", - "@angular/compiler": "~8.1.1", - "@angular/core": "~8.1.1", - "@angular/forms": "~8.1.1", - "@angular/platform-browser": "~8.1.1", - "@angular/platform-browser-dynamic": "~8.1.1", - "@angular/router": "~8.1.1", + "@angular-devkit/build-angular": "~13.3.3", + "@angular/animations": "~13.3.3", + "@angular/common": "~13.3.3", + "@angular/compiler": "~13.3.3", + "@angular/core": "~13.3.3", + "@angular/forms": "~13.3.3", + "@angular/platform-browser": "~13.3.3", + "@angular/platform-browser-dynamic": "~13.3.3", + "@angular/router": "~13.3.3", "core-js": "^3.6.5", "fibers": "^4.0.2", "highlight.js": "^9.18.1", "ng-lazyload-image": "^7.0.1", "ngx-highlightjs": "^3.0.3", "rxjs": "^6.5.5", - "zone.js": "^0.9.1" + "tslib": "^2.0.0", + "zone.js": "~0.11.4" }, "devDependencies": { - "@angular-devkit/build-ng-packagr": "~0.801.1", - "@angular/cli": "^8.3.26", - "@angular/compiler-cli": "~8.1.1", - "@angular/language-service": "~8.1.1", - "@types/jasmine": "^3.5.10", + "@angular/cli": "^13.3.3", + "@angular/compiler-cli": "~13.3.3", + "@angular/language-service": "~13.3.3", + "@types/jasmine": "~3.6.0", "@types/jasminewd2": "^2.0.8", - "@types/node": "~12.6.6", - "codelyzer": "^5.1.2", + "@types/node": "^12.11.1", + "codelyzer": "^6.0.0", "gh-pages": "^2.2.0", - "jasmine-core": "~3.4.0", - "jasmine-spec-reporter": "~4.2.1", - "karma": "~4.2.0", - "karma-chrome-launcher": "~3.0.0", - "karma-coverage-istanbul-reporter": "^2.1.1", - "karma-jasmine": "~2.0.1", - "karma-jasmine-html-reporter": "^1.5.3", - "ng-packagr": "^5.7.1", - "protractor": "^5.4.4", + "jasmine-core": "~3.6.0", + "jasmine-spec-reporter": "~5.0.0", + "karma": "~6.3.18", + "karma-chrome-launcher": "~3.1.0", + "karma-coverage-istanbul-reporter": "~3.0.2", + "karma-jasmine": "~4.0.0", + "karma-jasmine-html-reporter": "^1.5.0", + "ng-packagr": "^13.3.1", + "protractor": "~7.0.0", "ts-node": "~8.3.0", - "tsickle": "^0.36.0", - "tslib": "^1.11.1", - "tslint": "~5.18.0", - "typescript": "~3.4.5" + "tslint": "~6.1.0", + "typescript": "~4.6.3" } } diff --git a/projects/example/browserslist b/projects/example/.browserslistrc similarity index 100% rename from projects/example/browserslist rename to projects/example/.browserslistrc diff --git a/projects/example/src/app/containerBox/containerBox.component.ts b/projects/example/src/app/containerBox/containerBox.component.ts index 24e5ed4..73d8861 100644 --- a/projects/example/src/app/containerBox/containerBox.component.ts +++ b/projects/example/src/app/containerBox/containerBox.component.ts @@ -1,4 +1,4 @@ -import {Component, OnInit, ViewChild, ElementRef, OnDestroy} from '@angular/core'; +import { Component, OnInit, ViewChild, ElementRef, OnDestroy, AfterViewInit } from '@angular/core'; import {fromEvent, Observable, Subscription} from 'rxjs'; import {debounceTime} from 'rxjs/operators'; @@ -8,7 +8,7 @@ import {debounceTime} from 'rxjs/operators'; }) export default class ContainerBoxComponent implements OnInit, OnDestroy { - @ViewChild('containerElem', null) containerElem: ElementRef; + @ViewChild('containerElem', { static: true }) containerElem: ElementRef; resizeObservable$: Observable; resizeSubscription$: Subscription; diff --git a/projects/example/src/environments/environment.ts b/projects/example/src/environments/environment.ts index 7b4f817..30d7bcc 100644 --- a/projects/example/src/environments/environment.ts +++ b/projects/example/src/environments/environment.ts @@ -13,4 +13,4 @@ export const environment = { * This import should be commented out in production mode because it will have a negative impact * on performance if an error is thrown. */ -// import 'zone.js/dist/zone-error'; // Included with Angular CLI. +// import 'zone.js/plugins/zone-error'; // Included with Angular CLI. diff --git a/projects/example/src/polyfills.ts b/projects/example/src/polyfills.ts index a6d34ea..0d7df7f 100644 --- a/projects/example/src/polyfills.ts +++ b/projects/example/src/polyfills.ts @@ -37,19 +37,9 @@ // import 'core-js/es6/weak-map'; // import 'core-js/es6/set'; -/** IE10 and IE11 requires the following for NgClass support on SVG elements */ -// import 'classlist.js'; // Run `npm install --save classlist.js`. - /** IE10 and IE11 requires the following for the Reflect API. */ // import 'core-js/es6/reflect'; -/** - * Web Animations `@angular/platform-browser/animations` - * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. - * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). - */ -// import 'web-animations-js'; // Run `npm install --save web-animations-js`. - /** * By default, zone.js will patch all possible macroTask and DomEvents * user can disable parts of macroTask/DomEvents patch by setting following flags @@ -77,7 +67,7 @@ /*************************************************************************************************** * Zone JS is required by default for Angular itself. */ -import 'zone.js/dist/zone'; // Included with Angular CLI. +import 'zone.js'; // Included with Angular CLI. /*************************************************************************************************** diff --git a/projects/example/src/test.ts b/projects/example/src/test.ts index 1631789..6b03dbe 100644 --- a/projects/example/src/test.ts +++ b/projects/example/src/test.ts @@ -1,6 +1,6 @@ // This file is required by karma.conf.js and loads recursively all the .spec and framework files -import 'zone.js/dist/zone-testing'; +import 'zone.js/testing'; import { getTestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, @@ -12,7 +12,9 @@ declare const require: any; // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( BrowserDynamicTestingModule, - platformBrowserDynamicTesting() + platformBrowserDynamicTesting(), { + teardown: { destroyAfterEach: false } +} ); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); diff --git a/projects/example/tsconfig.app.json b/projects/example/tsconfig.app.json index bb16c46..a5b387a 100644 --- a/projects/example/tsconfig.app.json +++ b/projects/example/tsconfig.app.json @@ -4,8 +4,11 @@ "outDir": "../../out-tsc/app", "types": [] }, - "exclude": [ - "test.ts", - "**/*.spec.ts" + "files": [ + "src/main.ts", + "src/polyfills.ts" + ], + "include": [ + "projects/example/src/**/*.d.ts" ] } diff --git a/projects/lib/ng-package.json b/projects/lib/ng-package.json index 5ffccff..2fdd5b8 100644 --- a/projects/lib/ng-package.json +++ b/projects/lib/ng-package.json @@ -4,5 +4,5 @@ "lib": { "entryFile": "src/public_api.ts" }, - "whitelistedNonPeerDependencies": ["ng-lazyload-image"] + "allowedNonPeerDependencies": ["ng-lazyload-image"] } diff --git a/projects/lib/src/lib/img/img.component.ts b/projects/lib/src/lib/img/img.component.ts index cb290ad..31dd233 100644 --- a/projects/lib/src/lib/img/img.component.ts +++ b/projects/lib/src/lib/img/img.component.ts @@ -14,8 +14,8 @@ import { isPlatformServer } from '@angular/common'; templateUrl: './img.component.html', }) export class ImgComponent implements OnInit, OnChanges, AfterViewInit, OnDestroy { - @ViewChild('imgElem', {static: false}) imgElem: ElementRef; - @ViewChild('pictureElem', {static: false}) pictureElem: ElementRef; + @ViewChild('imgElem') imgElem: ElementRef; + @ViewChild('pictureElem') pictureElem: ElementRef; @Input() src: string; @Input() class = ''; @Input() alt: string; diff --git a/projects/lib/src/test.ts b/projects/lib/src/test.ts index e11ff1c..8bc9acb 100644 --- a/projects/lib/src/test.ts +++ b/projects/lib/src/test.ts @@ -1,8 +1,8 @@ // This file is required by karma.conf.js and loads recursively all the .spec and framework files import 'core-js/es7/reflect'; -import 'zone.js/dist/zone'; -import 'zone.js/dist/zone-testing'; +import 'zone.js'; +import 'zone.js/testing'; import { getTestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, @@ -14,7 +14,9 @@ declare const require: any; // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( BrowserDynamicTestingModule, - platformBrowserDynamicTesting() + platformBrowserDynamicTesting(), { + teardown: { destroyAfterEach: false } +} ); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); diff --git a/projects/lib/tsconfig.lib.json b/projects/lib/tsconfig.lib.json index 3fe337f..f689945 100644 --- a/projects/lib/tsconfig.lib.json +++ b/projects/lib/tsconfig.lib.json @@ -2,13 +2,13 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/lib", + "declarationMap": true, "target": "es2015", "module": "es2015", "moduleResolution": "node", "declaration": true, "sourceMap": true, "inlineSources": true, - "emitDecoratorMetadata": true, "experimentalDecorators": true, "importHelpers": true, "types": [], @@ -18,7 +18,6 @@ ] }, "angularCompilerOptions": { - "annotateForClosureCompiler": true, "skipTemplateCodegen": true, "strictMetadataEmit": true, "fullTemplateTypeCheck": true, diff --git a/projects/lib/tsconfig.lib.prod.json b/projects/lib/tsconfig.lib.prod.json new file mode 100644 index 0000000..6330633 --- /dev/null +++ b/projects/lib/tsconfig.lib.prod.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.lib.json", + "compilerOptions": { + "declarationMap": false + }, + "angularCompilerOptions": { + "compilationMode": "partial" + } +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 9922421..ebe2fa2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,9 +5,8 @@ "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, - "module": "es2015", + "module": "es2020", "moduleResolution": "node", - "emitDecoratorMetadata": true, "experimentalDecorators": true, "importHelpers": true, "target": "es5", diff --git a/tslint.json b/tslint.json index c740a7b..4370015 100644 --- a/tslint.json +++ b/tslint.json @@ -73,7 +73,6 @@ "no-trailing-whitespace": true, "no-unnecessary-initializer": true, "no-unused-expression": true, - "no-use-before-declare": true, "no-var-keyword": true, "object-literal-sort-keys": false, "one-line": [