Skip to content

Commit ec4aa12

Browse files
authored
Merge pull request #582 from ui-router/upgrade-to-angular-15
feat: add support for angular 15
2 parents dfe43fa + 077d8e6 commit ec4aa12

File tree

13 files changed

+1180
-1407
lines changed

13 files changed

+1180
-1407
lines changed

.github/workflows/ci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ jobs:
3434
- uses: actions/checkout@v2
3535
- name: Prepare to Test Downstream Projects
3636
run: |
37-
npm config set scripts-prepend-node-path auto
3837
git config --global user.email [email protected]
3938
git config --global user.name uirouter_github_actions
4039
- name: Install Dependencies

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
scripts-prepend-node-path=true

downstream_projects.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"example": "./example",
3-
"sample-app-angular-hybrid": "https://github.com/ui-router/sample-app-angular-hybrid.git"
3+
"sample-app-angular-hybrid": "https://github.com/ui-router/sample-app-angular-hybrid.git@upgrade-to-angular-15"
44
}

example/cypress.config.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { defineConfig } from 'cypress';
2+
3+
export default defineConfig({
4+
video: false,
5+
e2e: {
6+
// We've imported your old cypress plugins here.
7+
// You may want to clean this up later by importing these.
8+
setupNodeEvents(on, config) {
9+
return require('./cypress/plugins/index.js')(on, config);
10+
},
11+
baseUrl: 'http://localhost:4000',
12+
},
13+
});

example/cypress.json

-4
This file was deleted.

example/cypress/integration/example_spec.js renamed to example/cypress/e2e/example.cy.js

+4-16
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,29 @@ describe('example app', () => {
1111

1212
it('renders angularjs', () => {
1313
cy.visit('');
14-
cy
15-
.get('a')
16-
.contains('app.ng1')
17-
.click();
14+
cy.get('a').contains('app.ng1').click();
1815
cy.url().should('include', '#!/ng1');
1916
cy.contains('ng1 component');
2017
});
2118

2219
it('renders angular', () => {
2320
cy.visit('');
24-
cy
25-
.get('a')
26-
.contains('app.ng2')
27-
.click();
21+
cy.get('a').contains('app.ng2').click();
2822
cy.url().should('include', '#!/ng2');
2923
cy.contains('ng2 component');
3024
});
3125

3226
it('renders angular inside angularjs', () => {
3327
cy.visit('');
34-
cy
35-
.get('a')
36-
.contains('app.ng1.ng2')
37-
.click();
28+
cy.get('a').contains('app.ng1.ng2').click();
3829
cy.url().should('include', '#!/ng1/ng2');
3930
cy.contains('ng1 component');
4031
cy.contains('ng2 component');
4132
});
4233

4334
it('renders angular inside angular', () => {
4435
cy.visit('');
45-
cy
46-
.get('a')
47-
.contains('app.ng2.ng2')
48-
.click();
36+
cy.get('a').contains('app.ng2.ng2').click();
4937
cy.url().should('include', '#!/ng2/ng2');
5038
cy.contains('ng2 component');
5139
});

example/cypress/plugins/index.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/// <reference types="cypress" />
2+
// ***********************************************************
3+
// This example plugins/index.js can be used to load plugins
4+
//
5+
// You can change the location of this file or turn off loading
6+
// the plugins file with the 'pluginsFile' configuration option.
7+
//
8+
// You can read more here:
9+
// https://on.cypress.io/plugins-guide
10+
// ***********************************************************
11+
12+
// This function is called when a project is opened or re-opened (e.g. due to
13+
// the project's config changing)
14+
15+
/**
16+
* @type {Cypress.PluginConfig}
17+
*/
18+
// eslint-disable-next-line no-unused-vars
19+
module.exports = function (on, config) {
20+
// `on` is used to hook into various events Cypress emits
21+
// `config` is the resolved Cypress config
22+
};

example/cypress/support/commands.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// ***********************************************
2+
// This example commands.js shows you how to
3+
// create various custom commands and overwrite
4+
// existing commands.
5+
//
6+
// For more comprehensive examples of custom
7+
// commands please read more here:
8+
// https://on.cypress.io/custom-commands
9+
// ***********************************************
10+
//
11+
//
12+
// -- This is a parent command --
13+
// Cypress.Commands.add('login', (email, password) => { ... })
14+
//
15+
//
16+
// -- This is a child command --
17+
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
18+
//
19+
//
20+
// -- This is a dual command --
21+
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
22+
//
23+
//
24+
// -- This will overwrite an existing command --
25+
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })

example/cypress/support/e2e.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ***********************************************************
2+
// This example support/index.js is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands';
18+
19+
// Alternatively you can use CommonJS syntax:
20+
// require('./commands')

example/package.json

+16-14
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,34 @@
99
"test:ui": "npm run build && cypress-runner open --path ."
1010
},
1111
"checkPeerDependencies": {
12-
"ignore": ["ajv"]
12+
"ignore": [
13+
"ajv"
14+
]
1315
},
1416
"dependencies": {
15-
"@angular/animations": "14",
16-
"@angular/common": "14",
17-
"@angular/compiler": "14",
18-
"@angular/core": "14",
19-
"@angular/platform-browser": "14",
20-
"@angular/platform-browser-dynamic": "14",
21-
"@angular/upgrade": "14",
17+
"@angular/animations": "^15.2.3",
18+
"@angular/common": "^15.2.3",
19+
"@angular/compiler": "^15.2.3",
20+
"@angular/core": "^15.2.3",
21+
"@angular/platform-browser": "^15.2.3",
22+
"@angular/platform-browser-dynamic": "^15.2.3",
23+
"@angular/upgrade": "^15.2.3",
2224
"@types/angular": "^1.6.39",
2325
"@types/jquery": "^3.2.16",
24-
"@uirouter/angular": "^10.0.0",
26+
"@uirouter/angular": "^11.0.0",
2527
"@uirouter/angular-hybrid": "latest",
2628
"@uirouter/angularjs": "1.0.30",
27-
"@uirouter/core": "6.0.8",
29+
"@uirouter/core": "6.1.0",
2830
"@uirouter/rx": "1.0.0",
29-
"angular": "1.8.2",
31+
"angular": "1.8.3",
3032
"rxjs": "^7.4.0",
3133
"tslib": "1.13.0",
32-
"typescript": "~4.6.2",
34+
"typescript": "4.8.4",
3335
"zone.js": "0.11.4"
3436
},
3537
"devDependencies": {
36-
"@uirouter/cypress-runner": "^2.0.0",
37-
"ts-loader": "9.2.6",
38+
"@uirouter/cypress-runner": "^3.0.0",
39+
"ts-loader": "9.4.2",
3840
"webpack": "5.64.4",
3941
"webpack-cli": "^4.9.1",
4042
"webpack-dev-server": "4.6.0"

package.json

+15-15
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,37 @@
1717
]
1818
},
1919
"peerDependencies": {
20-
"@angular/core": "^13.0.0 || ^14.0.0",
21-
"@angular/upgrade": "^13.0.0 || ^14.0.0",
22-
"@uirouter/angular": "^10.0.0",
20+
"@angular/core": "^14.0.0 || ^15.0.0",
21+
"@angular/upgrade": "^14.0.0 || ^15.0.0",
22+
"@uirouter/angular": "^11.0.0",
2323
"@uirouter/angularjs": "^1.0.30",
2424
"angular": "^1.5.0"
2525
},
2626
"devDependencies": {
27-
"@angular/animations": "14",
28-
"@angular/common": "14",
29-
"@angular/compiler": "14",
30-
"@angular/compiler-cli": "14",
31-
"@angular/core": "14",
32-
"@angular/platform-browser": "14",
33-
"@angular/platform-browser-dynamic": "14",
34-
"@angular/upgrade": "14",
27+
"@angular/animations": "^15.2.3",
28+
"@angular/common": "^15.2.3",
29+
"@angular/compiler": "^15.2.3",
30+
"@angular/compiler-cli": "^15.2.3",
31+
"@angular/core": "^15.2.3",
32+
"@angular/platform-browser": "^15.2.3",
33+
"@angular/platform-browser-dynamic": "^15.2.3",
34+
"@angular/upgrade": "^15.2.3",
3535
"@types/angular": "^1.8.2",
3636
"@types/jquery": "^3.5.6",
37-
"@uirouter/angular": "10.0.0",
37+
"@uirouter/angular": "11.0.0",
3838
"@uirouter/angularjs": "^1.0.30",
3939
"@uirouter/core": "6.0.8",
4040
"@uirouter/publish-scripts": "^2.6.0",
4141
"@uirouter/rx": "^1.0.0",
42-
"angular": "^1.8.1",
42+
"angular": "^1.8.3",
4343
"husky": "^4.3.8",
44-
"ng-packagr": "14",
44+
"ng-packagr": "^15.2.2",
4545
"prettier": "^2.3.2",
4646
"pretty-quick": "^2.0.1",
4747
"rxjs": "^6.6.7",
4848
"rxjs-compat": "^6.6.7",
4949
"shx": "^0.3.3",
50-
"typescript": "~4.6.2",
50+
"typescript": "4.8.4",
5151
"zone.js": "0.11.4"
5252
},
5353
"distDir": "dist",

src/angular-hybrid.ts

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
UIRouter,
1111
ViewConfig,
1212
ViewService,
13+
ServicesPlugin,
14+
servicesPlugin,
1315
} from '@uirouter/core';
1416

1517
import {
@@ -239,6 +241,7 @@ upgradeModule.run([
239241

240242
/** Add support for observable state and param changes */
241243
$uiRouter.plugin(UIRouterRx);
244+
$uiRouter.plugin<ServicesPlugin>(servicesPlugin);
242245

243246
// Expose a merged ng1/ng2 injector as a Resolvable (on the root state).
244247
// This mimics how ui-router-ng2 exposes the root ng2 Injector, but

0 commit comments

Comments
 (0)