Skip to content

Commit

Permalink
build: support for Angular v14 (nicky-lenaers#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafa AS authored Oct 23, 2022
1 parent fcc873f commit ccec860
Show file tree
Hide file tree
Showing 13 changed files with 1,309 additions and 1,919 deletions.
15 changes: 15 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.js text eol=lf
*.json text eol=lf
*.html text eol=lf
*.scss text eol=lf
*.ts text eol=lf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.gif binary
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16.18.0
1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
no-progress true
16 changes: 8 additions & 8 deletions angular.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"cli": {
"analytics": "90748fe0-c2f3-428a-a161-bde380a9383d",
"defaultCollection": "@angular-eslint/schematics"
},
"version": 1,
"newProjectRoot": "projects",
"projects": {
Expand Down Expand Up @@ -52,9 +48,6 @@
"schematics": {
"@schematics/angular:component": {
"style": "scss"
},
"@schematics/angular:application": {
"strict": true
}
},
"root": "projects/ngx-scroll-to-demo",
Expand All @@ -69,6 +62,7 @@
"main": "projects/ngx-scroll-to-demo/src/main.ts",
"polyfills": "projects/ngx-scroll-to-demo/src/polyfills.ts",
"tsConfig": "projects/ngx-scroll-to-demo/tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"projects/ngx-scroll-to-demo/src/favicon.ico",
"projects/ngx-scroll-to-demo/src/assets"
Expand Down Expand Up @@ -136,6 +130,7 @@
"polyfills": "projects/ngx-scroll-to-demo/src/polyfills.ts",
"tsConfig": "projects/ngx-scroll-to-demo/tsconfig.spec.json",
"karmaConfig": "projects/ngx-scroll-to-demo/karma.conf.js",
"inlineStyleLanguage": "scss",
"assets": [
"projects/ngx-scroll-to-demo/src/favicon.ico",
"projects/ngx-scroll-to-demo/src/assets"
Expand Down Expand Up @@ -170,5 +165,10 @@
}
}
},
"defaultProject": "ngx-scroll-to"
"cli": {
"analytics": "90748fe0-c2f3-428a-a161-bde380a9383d",
"schematicCollections": [
"@angular-eslint/schematics"
]
}
}
52 changes: 27 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve ngx-scroll-to-demo",
"build": "ng build --configuration production",
"build:demo": "ng build ngx-scroll-to-demo --configuration production",
"start:demo": "ng serve ngx-scroll-to-demo",
"build": "yarn build:lib && yarn build:demo",
"build:lib": "ng build ngx-scroll-to",
"build:demo": "ng build ngx-scroll-to-demo",
"test": "ng test --watch=false --no-progress --browsers=ChromeHeadless",
"test:lib": "ng test ngx-scroll-to --watch=false",
"test:demo": "ng test ngx-scroll-to-demo --watch=false",
"test:watch": "ng test --watch=true",
"test:watch": "ng test --watch=true --configuration development",
"lint": "ng lint",
"e2e": "ng e2e",
"copy:readme": "copyfiles README.md ./dist/ngx-scroll-to",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"github-releaser": "conventional-github-releaser -p angular",
"lib:package": "yarn build && yarn copy:readme && cd ./dist/ngx-scroll-to && yarn pack",
"lib:package": "yarn build:lib && yarn copy:readme && cd ./dist/ngx-scroll-to && yarn pack",
"prelib:publish": "yarn lib:package",
"lib:publish": "cd ./dist/ngx-scroll-to && yarn publish --access=public",
"tags": "yarn tag list @nicky-lenaers/ngx-scroll-to",
Expand All @@ -41,28 +43,28 @@
"url": "https://github.com/nicky-lenaers/ngx-scroll-to/issues"
},
"dependencies": {
"@angular/animations": "~13.3.11",
"@angular/common": "~13.3.11",
"@angular/compiler": "~13.3.11",
"@angular/core": "~13.3.11",
"@angular/forms": "~13.3.11",
"@angular/platform-browser": "~13.3.11",
"@angular/platform-browser-dynamic": "~13.3.11",
"@angular/router": "~13.3.11",
"@angular/animations": "^14.2.7",
"@angular/common": "^14.2.7",
"@angular/compiler": "^14.2.7",
"@angular/core": "^14.2.7",
"@angular/forms": "^14.2.7",
"@angular/platform-browser": "^14.2.7",
"@angular/platform-browser-dynamic": "^14.2.7",
"@angular/router": "^14.2.7",
"rxjs": "~7.5.7",
"tslib": "^2.4.0",
"zone.js": "~0.11.8"
},
"devDependencies": {
"@angular-devkit/build-angular": "~13.3.9",
"@angular-eslint/builder": "^13.5.0",
"@angular-eslint/eslint-plugin": "^13.5.0",
"@angular-eslint/eslint-plugin-template": "^13.5.0",
"@angular-eslint/schematics": "^13.5.0",
"@angular-eslint/template-parser": "^13.5.0",
"@angular/cli": "~13.3.9",
"@angular/compiler-cli": "~13.3.11",
"@angular/language-service": "~13.3.11",
"@angular-devkit/build-angular": "^14.2.6",
"@angular-eslint/builder": "^14.1.2",
"@angular-eslint/eslint-plugin": "^14.1.2",
"@angular-eslint/eslint-plugin-template": "^14.1.2",
"@angular-eslint/schematics": "^14.1.2",
"@angular-eslint/template-parser": "^14.1.2",
"@angular/cli": "^14.2.6",
"@angular/compiler-cli": "^14.2.7",
"@angular/language-service": "^14.2.7",
"@commitlint/cli": "^17.1.2",
"@commitlint/config-angular": "^17.1.0",
"@cypress/schematic": "^2.2.0",
Expand All @@ -73,16 +75,16 @@
"conventional-changelog-cli": "^2.2.2",
"conventional-github-releaser": "^3.1.5",
"copyfiles": "^2.4.1",
"eslint": "^8.25.0",
"eslint": "^8.26.0",
"husky": "^8.0.1",
"jasmine-core": "~4.4.0",
"karma": "~6.4.1",
"karma-chrome-launcher": "~3.1.1",
"karma-coverage-istanbul-reporter": "~3.0.3",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "^2.0.0",
"ng-packagr": "^13.3.1",
"typescript": "~4.6.4",
"ng-packagr": "^14.2.1",
"typescript": "~4.8.4",
"cypress": "^10.10.0"
},
"engines": {
Expand Down
12 changes: 6 additions & 6 deletions projects/ngx-scroll-to-demo/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { TestBed, waitForAsync } from '@angular/core/testing';
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';

describe('AppComponent', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent
],
}).compileComponents();
}));
});

it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
Expand All @@ -29,7 +29,7 @@ describe('AppComponent', () => {
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement;
expect(compiled.querySelector('.content span').textContent).toContain('ngx-scroll-to-demo app is running!');
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('ngx-scroll-to-demo app is running!');
});
});
6 changes: 2 additions & 4 deletions projects/ngx-scroll-to-demo/src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ declare const require: {
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
}
platformBrowserDynamicTesting()
);

// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
context.keys().forEach(context);
12 changes: 7 additions & 5 deletions projects/ngx-scroll-to/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
"angular12",
"angular 12",
"angular13",
"angular 13"
"angular 13",
"angular14",
"angular 14"
],
"author": {
"name": "Nicky Lenaers",
Expand All @@ -61,11 +63,11 @@
"node": ">=16.18.0",
"yarn": ">=1.22.18"
},
"peerDependencies": {
"@angular/common": "^14.0.0",
"@angular/core": "^14.0.0"
},
"dependencies": {
"tslib": "^2.3.0"
},
"peerDependencies": {
"@angular/common": "^13.0.0",
"@angular/core": "^13.0.0"
}
}
10 changes: 4 additions & 6 deletions projects/ngx-scroll-to/src/lib/scroll-to.directive.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { ScrollToModule } from './scroll-to.module';
import { ScrollToDirective } from './scroll-to.directive';
Expand All @@ -11,9 +11,8 @@ import { ScrollToEvent } from './scroll-to-event.interface';

describe('ScrollToDirective', () => {

beforeEach(waitForAsync(() => {

TestBed
beforeEach(async () => {
await TestBed
.configureTestingModule({
imports: [
ScrollToModule.forRoot()
Expand All @@ -28,8 +27,7 @@ describe('ScrollToDirective', () => {
}
]
});

}));
});

it('should be created', () => {
const fixture = TestBed.createComponent(DummyComponent);
Expand Down
10 changes: 5 additions & 5 deletions projects/ngx-scroll-to/src/lib/scroll-to.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Inject, PLATFORM_ID } from '@angular/core';
import { PLATFORM_ID } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import { TestBed, waitForAsync } from '@angular/core/testing';
import { TestBed } from '@angular/core/testing';
import { ScrollToService } from './scroll-to.service';

class MockDocument { }
Expand All @@ -10,8 +10,8 @@ describe('ScrollToService', () => {

let service: ScrollToService;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
providers: [
{
provide: DOCUMENT, useClass: MockDocument
Expand All @@ -24,7 +24,7 @@ describe('ScrollToService', () => {
});

service = TestBed.inject(ScrollToService);
}));
});

it('should be created', () => {
expect(service).toBeTruthy();
Expand Down
7 changes: 4 additions & 3 deletions projects/ngx-scroll-to/src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ declare const require: {
// 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$/);
// And load the modules.
context.keys().map(context);
context.keys().forEach(context);
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2017",
"target": "es2020",
"module": "es2020",
"lib": [
"es2020",
Expand Down
Loading

0 comments on commit ccec860

Please sign in to comment.