Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Angular 17 support. #987

Merged
merged 13 commits into from
Jan 31, 2024
Merged
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
5 changes: 2 additions & 3 deletions downstream_projects.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"packageDir": "./dist",
"projects": {
"sample-app-angular": "https://github.com/ui-router/sample-app-angular.git",
"typescript48": "./test-typescript-versions/typescript4.8",
"angular16": "./test-angular-versions/v16",
"typescript49": "./test-typescript-versions/typescript4.9"
"angular17": "./test-angular-versions/v17",
"typescript52": "./test-typescript-versions/typescript5.2"
}
}
32 changes: 17 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@uirouter/angular",
"description": "State-based routing for Angular",
"version": "12.0.0",
"version": "13.0.0",
"scripts": {
"clean": "shx rm -rf lib lib-esm _bundles _doc dist",
"compile": "npm run clean && ngc",
Expand Down Expand Up @@ -43,39 +43,41 @@
"license": "MIT",
"distDir": "dist",
"peerDependencies": {
"@angular/common": "^16.0.0",
"@angular/core": "^16.0.0",
"@angular/common": "^17.0.0",
"@angular/core": "^17.0.0",
"@uirouter/core": "^6.0.8",
"@uirouter/rx": "^1.0.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^16.0.0",
"@angular/animations": "^16.0.0",
"@angular/common": "^16.0.0",
"@angular/compiler": "^16.0.0",
"@angular/compiler-cli": "^16.0.0",
"@angular/core": "^16.0.0",
"@angular/platform-browser": "^16.0.0",
"@angular/platform-browser-dynamic": "^16.0.0",
"@angular-devkit/build-angular": "^17.0.0",
"@angular/animations": "^17.0.0",
"@angular/common": "^17.0.0",
"@angular/compiler": "^17.0.0",
"@angular/compiler-cli": "^17.0.0",
"@angular/core": "^17.0.0",
"@angular/platform-browser": "^17.0.0",
"@angular/platform-browser-dynamic": "^17.0.0",
"@types/jest": "^27.0.3",
"@types/jquery": "^3.5.9",
"@types/node": "^20.11.4",
"@uirouter/core": "^6.0.8",
"@uirouter/publish-scripts": "2.6.2",
"@uirouter/rx": "^1.0.0",
"husky": "^7.0.4",
"jest": "^29.0.0",
"jest-preset-angular": "^13.0.0",
"ng-packagr": "^16.0.0",
"jest-preset-angular": "^14.0.0",
"ng-packagr": "^17.0.0",
"postcss": "^8.0.0",
"prettier": "^2.5.0",
"pretty-quick": "^3.1.2",
"rxjs": "~7.8.0",
"rxjs-compat": "^6.5.4",
"schema-utils": "^4.0.0",
"ts-node": "10.4.0",
"tslib": "^2.3.0",
"tslint": "^6.1.0",
"typescript": "~4.9.5",
"zone.js": "0.13.0"
"typescript": "~5.2.2",
"zone.js": "~0.14.0"
},
"jest": {
"preset": "jest-preset-angular",
Expand Down
27 changes: 27 additions & 0 deletions test-angular-versions/v17/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# V17

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

## 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.
123 changes: 123 additions & 0 deletions test-angular-versions/v17/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"cli": {
"packageManager": "yarn"
},
"newProjectRoot": "projects",
"projects": {
"v17": {
"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:application",
"options": {
"outputPath": "dist/v17",
"index": "src/index.html",
"browser": "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": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"buildTarget": "v17:build:production"
},
"development": {
"buildTarget": "v17:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"buildTarget": "v17: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": []
}
}
}
}
}
}
10 changes: 10 additions & 0 deletions test-angular-versions/v17/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from 'cypress';

export default defineConfig({
video: false,
e2e: {
setupNodeEvents(on, config) {},
baseUrl: 'http://localhost:4000',
supportFile: false
},
})
69 changes: 69 additions & 0 deletions test-angular-versions/v17/cypress/e2e/sample_app.cy.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');
});
});
50 changes: 50 additions & 0 deletions test-angular-versions/v17/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "17",
"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/v17/browser",
"test:prod": "ng build --configuration production && cypress-runner run --path dist/v17/browser"
},
"private": true,
"dependencies": {
"@angular/animations": "^17.0.0",
"@angular/common": "^17.0.0",
"@angular/compiler": "^17.0.0",
"@angular/core": "^17.0.0",
"@angular/forms": "^17.0.0",
"@angular/platform-browser": "^17.0.0",
"@angular/platform-browser-dynamic": "^17.0.0",
"@angular/router": "^17.0.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.2",
"@uirouter/angular": "*",
"@uirouter/cypress-runner": "*",
"@uirouter/core": "*",
"@uirouter/rx": "*"
},
"devDependencies": {
"@angular-devkit/build-angular": "^17.0.10",
"@angular/cli": "^17.0.10",
"@angular/compiler-cli": "^17.0.0",
"@types/jasmine": "~5.1.0",
"jasmine-core": "~5.1.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.2.2"
},
"checkPeerDependencies": {
"ignore": [
"ajv",
"terser"
]
}
}
7 changes: 7 additions & 0 deletions test-angular-versions/v17/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.
21 changes: 21 additions & 0 deletions test-angular-versions/v17/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--The content below is only a placeholder and can be replaced.-->
<div style="text-align: center">
<h1>Welcome to {{ title }}!</h1>
<img
width="300"
alt="Angular Logo"
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg=="
/>
</div>
<h2>Here are some links to help you start:</h2>
<ul>
<li>
<h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://angular.io/cli">CLI Documentation</a></h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>
</li>
</ul>
Loading
Loading