Skip to content

Commit 2682adf

Browse files
authored
chore: Angular 17 support. (#987)
1 parent 792bb2f commit 2682adf

27 files changed

+2607
-895
lines changed

downstream_projects.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
"packageDir": "./dist",
33
"projects": {
44
"sample-app-angular": "https://github.com/ui-router/sample-app-angular.git",
5-
"typescript48": "./test-typescript-versions/typescript4.8",
6-
"angular16": "./test-angular-versions/v16",
7-
"typescript49": "./test-typescript-versions/typescript4.9"
5+
"angular17": "./test-angular-versions/v17",
6+
"typescript52": "./test-typescript-versions/typescript5.2"
87
}
98
}

package.json

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@uirouter/angular",
33
"description": "State-based routing for Angular",
4-
"version": "12.0.0",
4+
"version": "13.0.0",
55
"scripts": {
66
"clean": "shx rm -rf lib lib-esm _bundles _doc dist",
77
"compile": "npm run clean && ngc",
@@ -43,39 +43,41 @@
4343
"license": "MIT",
4444
"distDir": "dist",
4545
"peerDependencies": {
46-
"@angular/common": "^16.0.0",
47-
"@angular/core": "^16.0.0",
46+
"@angular/common": "^17.0.0",
47+
"@angular/core": "^17.0.0",
4848
"@uirouter/core": "^6.0.8",
4949
"@uirouter/rx": "^1.0.0"
5050
},
5151
"devDependencies": {
52-
"@angular-devkit/build-angular": "^16.0.0",
53-
"@angular/animations": "^16.0.0",
54-
"@angular/common": "^16.0.0",
55-
"@angular/compiler": "^16.0.0",
56-
"@angular/compiler-cli": "^16.0.0",
57-
"@angular/core": "^16.0.0",
58-
"@angular/platform-browser": "^16.0.0",
59-
"@angular/platform-browser-dynamic": "^16.0.0",
52+
"@angular-devkit/build-angular": "^17.0.0",
53+
"@angular/animations": "^17.0.0",
54+
"@angular/common": "^17.0.0",
55+
"@angular/compiler": "^17.0.0",
56+
"@angular/compiler-cli": "^17.0.0",
57+
"@angular/core": "^17.0.0",
58+
"@angular/platform-browser": "^17.0.0",
59+
"@angular/platform-browser-dynamic": "^17.0.0",
6060
"@types/jest": "^27.0.3",
6161
"@types/jquery": "^3.5.9",
62+
"@types/node": "^20.11.4",
6263
"@uirouter/core": "^6.0.8",
6364
"@uirouter/publish-scripts": "2.6.2",
6465
"@uirouter/rx": "^1.0.0",
6566
"husky": "^7.0.4",
6667
"jest": "^29.0.0",
67-
"jest-preset-angular": "^13.0.0",
68-
"ng-packagr": "^16.0.0",
68+
"jest-preset-angular": "^14.0.0",
69+
"ng-packagr": "^17.0.0",
6970
"postcss": "^8.0.0",
7071
"prettier": "^2.5.0",
7172
"pretty-quick": "^3.1.2",
7273
"rxjs": "~7.8.0",
7374
"rxjs-compat": "^6.5.4",
7475
"schema-utils": "^4.0.0",
7576
"ts-node": "10.4.0",
77+
"tslib": "^2.3.0",
7678
"tslint": "^6.1.0",
77-
"typescript": "~4.9.5",
78-
"zone.js": "0.13.0"
79+
"typescript": "~5.2.2",
80+
"zone.js": "~0.14.0"
7981
},
8082
"jest": {
8183
"preset": "jest-preset-angular",

test-angular-versions/v17/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# V17
2+
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.0.10.
4+
5+
## Development server
6+
7+
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.
8+
9+
## Code scaffolding
10+
11+
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`.
12+
13+
## Build
14+
15+
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
16+
17+
## Running unit tests
18+
19+
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20+
21+
## Running end-to-end tests
22+
23+
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.
24+
25+
## Further help
26+
27+
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.
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"cli": {
5+
"packageManager": "yarn"
6+
},
7+
"newProjectRoot": "projects",
8+
"projects": {
9+
"v17": {
10+
"projectType": "application",
11+
"schematics": {
12+
"@schematics/angular:class": {
13+
"skipTests": true
14+
},
15+
"@schematics/angular:component": {
16+
"skipTests": true
17+
},
18+
"@schematics/angular:directive": {
19+
"skipTests": true
20+
},
21+
"@schematics/angular:guard": {
22+
"skipTests": true
23+
},
24+
"@schematics/angular:interceptor": {
25+
"skipTests": true
26+
},
27+
"@schematics/angular:pipe": {
28+
"skipTests": true
29+
},
30+
"@schematics/angular:resolver": {
31+
"skipTests": true
32+
},
33+
"@schematics/angular:service": {
34+
"skipTests": true
35+
}
36+
},
37+
"root": "",
38+
"sourceRoot": "src",
39+
"prefix": "app",
40+
"architect": {
41+
"build": {
42+
"builder": "@angular-devkit/build-angular:application",
43+
"options": {
44+
"outputPath": "dist/v17",
45+
"index": "src/index.html",
46+
"browser": "src/main.ts",
47+
"polyfills": [
48+
"zone.js"
49+
],
50+
"tsConfig": "tsconfig.app.json",
51+
"assets": [
52+
"src/favicon.ico",
53+
"src/assets"
54+
],
55+
"styles": [
56+
"src/styles.css"
57+
],
58+
"scripts": []
59+
},
60+
"configurations": {
61+
"production": {
62+
"budgets": [
63+
{
64+
"type": "initial",
65+
"maximumWarning": "500kb",
66+
"maximumError": "1mb"
67+
},
68+
{
69+
"type": "anyComponentStyle",
70+
"maximumWarning": "2kb",
71+
"maximumError": "4kb"
72+
}
73+
],
74+
"outputHashing": "all"
75+
},
76+
"development": {
77+
"optimization": false,
78+
"extractLicenses": false,
79+
"sourceMap": true
80+
}
81+
},
82+
"defaultConfiguration": "production"
83+
},
84+
"serve": {
85+
"builder": "@angular-devkit/build-angular:dev-server",
86+
"configurations": {
87+
"production": {
88+
"buildTarget": "v17:build:production"
89+
},
90+
"development": {
91+
"buildTarget": "v17:build:development"
92+
}
93+
},
94+
"defaultConfiguration": "development"
95+
},
96+
"extract-i18n": {
97+
"builder": "@angular-devkit/build-angular:extract-i18n",
98+
"options": {
99+
"buildTarget": "v17:build"
100+
}
101+
},
102+
"test": {
103+
"builder": "@angular-devkit/build-angular:karma",
104+
"options": {
105+
"polyfills": [
106+
"zone.js",
107+
"zone.js/testing"
108+
],
109+
"tsConfig": "tsconfig.spec.json",
110+
"assets": [
111+
"src/favicon.ico",
112+
"src/assets"
113+
],
114+
"styles": [
115+
"src/styles.css"
116+
],
117+
"scripts": []
118+
}
119+
}
120+
}
121+
}
122+
}
123+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { defineConfig } from 'cypress';
2+
3+
export default defineConfig({
4+
video: false,
5+
e2e: {
6+
setupNodeEvents(on, config) {},
7+
baseUrl: 'http://localhost:4000',
8+
supportFile: false
9+
},
10+
})
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
describe('Angular app', () => {
2+
beforeEach(() => {
3+
window.sessionStorage.clear();
4+
});
5+
6+
it('loads', () => {
7+
cy.visit('');
8+
});
9+
10+
it('loads home state by default', () => {
11+
cy.visit('');
12+
cy.url().should('include', '/home');
13+
});
14+
15+
it('renders uisref as links', () => {
16+
cy.visit('');
17+
cy.get('a').contains('home');
18+
cy.get('a').contains('about');
19+
cy.get('a').contains('lazy');
20+
cy.get('a').contains('lazy.child');
21+
cy.get('a').contains('lazy.child.viewtarget');
22+
});
23+
24+
it('renders home', () => {
25+
cy.visit('/home');
26+
cy.get('a').contains('home').should('have.class', 'active');
27+
cy.get('a').contains('about').should('not.have.class', 'active');
28+
cy.get('#default').contains('home works');
29+
});
30+
31+
it('renders about', () => {
32+
cy.visit('/home');
33+
cy.visit('/about');
34+
cy.get('a').contains('home').should('not.have.class', 'active');
35+
cy.get('a').contains('about').should('have.class', 'active');
36+
cy.get('#default').contains('about works');
37+
});
38+
39+
it('loads lazy routes', () => {
40+
cy.visit('/home');
41+
cy.visit('/lazy');
42+
cy.get('a').contains('home').should('not.have.class', 'active');
43+
cy.get('a').contains('lazy').should('have.class', 'active');
44+
cy.get('#default').contains('lazy works');
45+
});
46+
47+
it('routes to lazy routes', () => {
48+
cy.visit('/lazy');
49+
cy.get('a').contains('home').should('not.have.class', 'active');
50+
cy.get('a').contains('lazy').should('have.class', 'active');
51+
cy.get('#default').contains('lazy works');
52+
});
53+
54+
it('routes to lazy child routes', () => {
55+
cy.visit('/lazy/child');
56+
cy.get('a').contains('home').should('not.have.class', 'active');
57+
cy.get('a').contains('lazy.child').should('have.class', 'active');
58+
cy.get('#default').contains('lazy.child works');
59+
});
60+
61+
it('targets named views', () => {
62+
cy.visit('/lazy/child/viewtarget');
63+
cy.get('a').contains('home').should('not.have.class', 'active');
64+
cy.get('a').contains('lazy.child').should('have.class', 'active');
65+
cy.get('#default').contains('lazy.child works');
66+
cy.get('#header').contains('lazy.child.viewtarget works');
67+
cy.get('#footer').contains('lazy.child.viewtarget works');
68+
});
69+
});
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "17",
3+
"version": "0.0.0",
4+
"scripts": {
5+
"ng": "ng",
6+
"start": "ng serve",
7+
"build": "ng build",
8+
"watch": "ng build --watch --configuration development",
9+
"test": "npm run test:dev && npm run test:prod",
10+
"test:dev": "ng build --configuration development && cypress-runner run --path dist/v17/browser",
11+
"test:prod": "ng build --configuration production && cypress-runner run --path dist/v17/browser"
12+
},
13+
"private": true,
14+
"dependencies": {
15+
"@angular/animations": "^17.0.0",
16+
"@angular/common": "^17.0.0",
17+
"@angular/compiler": "^17.0.0",
18+
"@angular/core": "^17.0.0",
19+
"@angular/forms": "^17.0.0",
20+
"@angular/platform-browser": "^17.0.0",
21+
"@angular/platform-browser-dynamic": "^17.0.0",
22+
"@angular/router": "^17.0.0",
23+
"rxjs": "~7.8.0",
24+
"tslib": "^2.3.0",
25+
"zone.js": "~0.14.2",
26+
"@uirouter/angular": "*",
27+
"@uirouter/cypress-runner": "*",
28+
"@uirouter/core": "*",
29+
"@uirouter/rx": "*"
30+
},
31+
"devDependencies": {
32+
"@angular-devkit/build-angular": "^17.0.10",
33+
"@angular/cli": "^17.0.10",
34+
"@angular/compiler-cli": "^17.0.0",
35+
"@types/jasmine": "~5.1.0",
36+
"jasmine-core": "~5.1.0",
37+
"karma": "~6.4.0",
38+
"karma-chrome-launcher": "~3.2.0",
39+
"karma-coverage": "~2.2.0",
40+
"karma-jasmine": "~5.1.0",
41+
"karma-jasmine-html-reporter": "~2.1.0",
42+
"typescript": "~5.2.2"
43+
},
44+
"checkPeerDependencies": {
45+
"ignore": [
46+
"ajv",
47+
"terser"
48+
]
49+
}
50+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-about',
5+
template: ` <p>about works!</p> `,
6+
})
7+
export class AboutComponent {}

test-angular-versions/v17/src/app/app.component.css

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!--The content below is only a placeholder and can be replaced.-->
2+
<div style="text-align: center">
3+
<h1>Welcome to {{ title }}!</h1>
4+
<img
5+
width="300"
6+
alt="Angular Logo"
7+
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg=="
8+
/>
9+
</div>
10+
<h2>Here are some links to help you start:</h2>
11+
<ul>
12+
<li>
13+
<h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2>
14+
</li>
15+
<li>
16+
<h2><a target="_blank" rel="noopener" href="https://angular.io/cli">CLI Documentation</a></h2>
17+
</li>
18+
<li>
19+
<h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>
20+
</li>
21+
</ul>

0 commit comments

Comments
 (0)