Skip to content

Commit

Permalink
feat: Angular 15 support (#973)
Browse files Browse the repository at this point in the history
Co-authored-by: Mihail Goloborodov <Mihail.Goloborodov@nexign-systems.com>
  • Loading branch information
msgoloborodov and Mihail Goloborodov committed Jan 10, 2023
1 parent 1795920 commit d69d03e
Show file tree
Hide file tree
Showing 30 changed files with 7,517 additions and 7,712 deletions.
4 changes: 2 additions & 2 deletions add_support_for_new_angular_version.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Notes from when I added Angular 11 support
- update other libs
- update tests in test-angular-versions/
- ./scaffold.sh 11
- remove old tests fro test-angular-versions and ../downstream_projects.json
- remove old tests from test-angular-versions and ../downstream_projects.json
- update tests in test-typescript-versions/
- ./scaffold.sh 4.5
- (maybe) remove old tests fro test-typescript-versions and ../downstream_projects.json
- (maybe) remove old tests from test-typescript-versions and ../downstream_projects.json
- npx check-peer-dependencies
- gh pr create
- npm run release
Expand Down
8 changes: 4 additions & 4 deletions downstream_projects.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"packageDir": "./dist",
"projects": {
"angular14": "./test-angular-versions/v14",
"typescript46": "./test-typescript-versions/typescript4.6",
"sample-app-angular": "https://github.com/ui-router/sample-app-angular.git"
"sample-app-angular": "https://github.com/ui-router/sample-app-angular.git",
"angular15": "./test-angular-versions/v15",
"typescript48": "./test-typescript-versions/typescript4.8"
}
}
}
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,29 @@
"license": "MIT",
"distDir": "dist",
"peerDependencies": {
"@angular/common": "^14.0.0",
"@angular/core": "^14.0.0",
"@angular/common": "^15.0.0",
"@angular/core": "^15.0.0",
"@uirouter/core": "^6.0.8",
"@uirouter/rx": "^1.0.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^14.0.0",
"@angular/animations": "^14.0.0",
"@angular/common": "^14.0.0",
"@angular/compiler": "^14.0.0",
"@angular/compiler-cli": "^14.0.0",
"@angular/core": "^14.1.0",
"@angular/platform-browser": "^14.0.0",
"@angular/platform-browser-dynamic": "^14.0.0",
"@angular-devkit/build-angular": "^15.0.0",
"@angular/animations": "^15.0.0",
"@angular/common": "^15.0.0",
"@angular/compiler": "^15.0.0",
"@angular/compiler-cli": "^15.0.0",
"@angular/core": "^15.0.0",
"@angular/platform-browser": "^15.0.0",
"@angular/platform-browser-dynamic": "^15.0.0",
"@types/jest": "^27.0.3",
"@types/jquery": "^3.5.9",
"@uirouter/core": "^6.0.8",
"@uirouter/publish-scripts": "2.6.0",
"@uirouter/rx": "^1.0.0",
"husky": "^7.0.4",
"jest": "^28.0.0",
"jest-preset-angular": "^12.2.0",
"ng-packagr": "^14.0.0",
"jest-preset-angular": "^12.2.3",
"ng-packagr": "^15.0.0",
"postcss": "^8.0.0",
"prettier": "^2.5.0",
"pretty-quick": "^3.1.2",
Expand All @@ -74,7 +74,7 @@
"schema-utils": "^4.0.0",
"ts-node": "10.4.0",
"tslint": "^6.1.0",
"typescript": "~4.6.2",
"typescript": "~4.8.4",
"zone.js": "0.11.4"
},
"jest": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('Angular v9 app', () => {
describe('Angular app', () => {
beforeEach(() => {
window.sessionStorage.clear();
});
Expand Down
4 changes: 2 additions & 2 deletions test-angular-versions/v11/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "v9",
"name": "11",
"version": "0.0.0",
"scripts": {
"ng": "ng",
Expand Down Expand Up @@ -47,4 +47,4 @@
"tslint": "~6.1.0",
"typescript": "~4.0.5"
}
}
}
2 changes: 1 addition & 1 deletion test-angular-versions/v11/src/app/lazy/lazy.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import { Component, Input } from '@angular/core';
`,
})
export class LazyComponent {
@Input('$state$') state;
@Input('$state$') state: any;
}
27 changes: 27 additions & 0 deletions test-angular-versions/v15/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# V15

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.0.4.

## Development server

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.

## Code scaffolding

Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.

## Build

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.

## Running unit tests

Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Running end-to-end tests

Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
126 changes: 126 additions & 0 deletions test-angular-versions/v15/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"cli": {
"packageManager": "yarn"
},
"newProjectRoot": "projects",
"projects": {
"v15": {
"projectType": "application",
"schematics": {
"@schematics/angular:class": {
"skipTests": true
},
"@schematics/angular:component": {
"skipTests": true
},
"@schematics/angular:directive": {
"skipTests": true
},
"@schematics/angular:guard": {
"skipTests": true
},
"@schematics/angular:interceptor": {
"skipTests": true
},
"@schematics/angular:pipe": {
"skipTests": true
},
"@schematics/angular:resolver": {
"skipTests": true
},
"@schematics/angular:service": {
"skipTests": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/v15",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "v15:build:production"
},
"development": {
"browserTarget": "v15:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "v15:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
}
}
}
}
}
}
4 changes: 4 additions & 0 deletions test-angular-versions/v15/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"baseUrl": "http://localhost:4000",
"video": false
}
69 changes: 69 additions & 0 deletions test-angular-versions/v15/cypress/integration/sample_app_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
describe('Angular app', () => {
beforeEach(() => {
window.sessionStorage.clear();
});

it('loads', () => {
cy.visit('');
});

it('loads home state by default', () => {
cy.visit('');
cy.url().should('include', '/home');
});

it('renders uisref as links', () => {
cy.visit('');
cy.get('a').contains('home');
cy.get('a').contains('about');
cy.get('a').contains('lazy');
cy.get('a').contains('lazy.child');
cy.get('a').contains('lazy.child.viewtarget');
});

it('renders home', () => {
cy.visit('/home');
cy.get('a').contains('home').should('have.class', 'active');
cy.get('a').contains('about').should('not.have.class', 'active');
cy.get('#default').contains('home works');
});

it('renders about', () => {
cy.visit('/home');
cy.visit('/about');
cy.get('a').contains('home').should('not.have.class', 'active');
cy.get('a').contains('about').should('have.class', 'active');
cy.get('#default').contains('about works');
});

it('loads lazy routes', () => {
cy.visit('/home');
cy.visit('/lazy');
cy.get('a').contains('home').should('not.have.class', 'active');
cy.get('a').contains('lazy').should('have.class', 'active');
cy.get('#default').contains('lazy works');
});

it('routes to lazy routes', () => {
cy.visit('/lazy');
cy.get('a').contains('home').should('not.have.class', 'active');
cy.get('a').contains('lazy').should('have.class', 'active');
cy.get('#default').contains('lazy works');
});

it('routes to lazy child routes', () => {
cy.visit('/lazy/child');
cy.get('a').contains('home').should('not.have.class', 'active');
cy.get('a').contains('lazy.child').should('have.class', 'active');
cy.get('#default').contains('lazy.child works');
});

it('targets named views', () => {
cy.visit('/lazy/child/viewtarget');
cy.get('a').contains('home').should('not.have.class', 'active');
cy.get('a').contains('lazy.child').should('have.class', 'active');
cy.get('#default').contains('lazy.child works');
cy.get('#header').contains('lazy.child.viewtarget works');
cy.get('#footer').contains('lazy.child.viewtarget works');
});
});
42 changes: 42 additions & 0 deletions test-angular-versions/v15/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "15",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "npm run test:dev && npm run test:prod",
"test:dev": "ng build --configuration development && cypress-runner run --path dist/v15",
"test:prod": "ng build --configuration production && cypress-runner run --path dist/v15"
},
"private": true,
"dependencies": {
"@angular/animations": "^15.0.0",
"@angular/common": "^15.0.0",
"@angular/compiler": "^15.0.0",
"@angular/core": "^15.0.0",
"@angular/forms": "^15.0.0",
"@angular/platform-browser": "^15.0.0",
"@angular/platform-browser-dynamic": "^15.0.0",
"@angular/router": "^15.0.0",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
"zone.js": "~0.12.0",
"@uirouter/angular": "*",
"@uirouter/cypress-runner": "*"
},
"devDependencies": {
"@angular-devkit/build-angular": "^15.0.4",
"@angular/cli": "~15.0.4",
"@angular/compiler-cli": "^15.0.0",
"@types/jasmine": "~4.3.0",
"jasmine-core": "~4.5.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"typescript": "~4.8.2"
}
}
7 changes: 7 additions & 0 deletions test-angular-versions/v15/src/app/about.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-about',
template: ` <p>about works!</p> `,
})
export class AboutComponent {}
Empty file.

0 comments on commit d69d03e

Please sign in to comment.