Skip to content

Commit

Permalink
Ivy support (#674)
Browse files Browse the repository at this point in the history
* chore(travis): Do not install custom yarn version (travis seems to be installing recent versions these days)

* feat(package): Switch to ng-packagr for packaging @uirouter/angular

* chore(package): update package.json scripts for ng-packagr style

* chore(package): update to @uirouter/publish-scripts@2.3.37

* feat(package): switch to peerDependencies for uirouter/core and /rx and require angular 8 peer dependencies

BREAKING CHANGE: uirouter core and rx packages are now `peerDependencies`.
You will need to explicitly install the correct versions of `@uirouter/core` and `@uirouter/rx` into your project.

before:

```
dependencies: {
  "@uirouter/angular": "4.0.0"
}
```

after (example -- versions will vary):
```
dependencies: {
  "@uirouter/angular": "5.0.0"
  "@uirouter/core": "6.0.1",
  "@uirouter/rx": "0.6.0",
}
```

Or, use this command to automatically install peerDependencies:

```
npx check-peer-dependencies --install
```

* chore(package): Build with Angular 8

* fix(angular8): Add static: true to ViewChild

* fix(lazyLoad): Remove dependency on angular/router in favor of using ivy

Ivy supports lazy loading of modules without depending on the ROUTES token from angular/router.

* feat(package): Drop support for Angular version 7 and lower

BREAKING CHANGE: UIRouter for Angular v6.0.0 now requires Angular 8 or higher

* test(angular-versions): Test against Angular 9

* test(typescript-versions): Test against Typescript 3.4 through 3.7

* test(angular-versions): Angular 9: npx ng update @angular/core @angular/cli --next

* test(angular-versions): Angular 8: remove package-lock.json
  • Loading branch information
christopherthielen authored and mergify[bot] committed Nov 11, 2019
1 parent 2f1506c commit 00e9d6a
Show file tree
Hide file tree
Showing 96 changed files with 7,062 additions and 2,901 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ _doc
_bundles
lib
lib-esm
dist
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ services:
- xvfb
before_install:
- sudo apt-get install libgconf-2-4
- export PATH=$HOME/.yarn/bin:$PATH
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.5.1
script:
- if [ "x${CORE_BRANCH}x" != "xx" ] ; then ./node_modules/.bin/publish_yalc_package .downstream_cache/core https://github.com/ui-router/core.git && yalc add @uirouter/core ; fi
- tsc &&
Expand Down
23 changes: 10 additions & 13 deletions downstream_projects.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{
"angular6": "./test-angular-versions/v6",
"angular7": "./test-angular-versions/v7",
"angular8": "./test-angular-versions/v8",
"typescript2.3": "./test-typescript-versions/typescript2.3",
"typescript2.4": "./test-typescript-versions/typescript2.4",
"typescript2.5": "./test-typescript-versions/typescript2.5",
"typescript2.6": "./test-typescript-versions/typescript2.6",
"typescript2.7": "./test-typescript-versions/typescript2.7",
"typescript2.8": "./test-typescript-versions/typescript2.8",
"typescript2.9": "./test-typescript-versions/typescript2.9",
"typescript3.1": "./test-typescript-versions/typescript3.1",
"typescript3.2": "./test-typescript-versions/typescript3.2",
"sample-app-angular": "https://github.com/ui-router/sample-app-angular.git"
"packageDir": "./dist",
"projects": {
"angular8": "./test-angular-versions/v8",
"angular9": "./test-angular-versions/v9",
"typescript3.4": "./test-typescript-versions/typescript3.4",
"typescript3.5": "./test-typescript-versions/typescript3.5",
"typescript3.6": "./test-typescript-versions/typescript3.6",
"typescript3.7": "./test-typescript-versions/typescript3.7",
"sample-app-angular": "https://github.com/ui-router/sample-app-angular.git"
}
}
59 changes: 29 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
{
"$schema": "./node_modules/ng-packagr/package.schema.json",
"name": "@uirouter/angular",
"description": "State-based routing for Angular",
"version": "5.0.0",
"scripts": {
"clean": "shx rm -rf lib lib-esm _bundles _doc",
"clean": "shx rm -rf lib lib-esm _bundles _doc dist",
"compile": "npm run clean && ngc",
"bundle": "rollup -c && rollup -c --environment MINIFY",
"fixmaps:lib": "tweak_sourcemap_paths -a --include 'lib/**/*.js.map' 'lib-esm/**/*.js.map'",
"fixmaps:bundle": "tweak_sourcemap_paths -a --include '_bundles/**/*.js.map'",
"build": "run-s compile bundle fixmaps:*",
"build": "ng-packagr -p package.json",
"release": "release --deps @uirouter/core @uirouter/rx",
"test": "karma start",
"test:downstream": "test_downstream_projects",
"debug": "karma start --singleRun=false --autoWatch=true --autoWatchInterval=1 --browsers=Chrome",
"package": "npm run build",
"docs": "generate_docs",
"docs:publish": "generate_docs && publish_docs",
"prepublishOnly": "npm run build",
"changelog": "update_changelog --include-core",
"artifacts": "artifact_tagging"
"prepublishOnly": "echo && echo DO NOT RUN npm publish. Instead, run npm run release && echo && echo && false",
"changelog": "update_changelog --include-core"
},
"homepage": "https://ui-router.github.io/angular",
"contributors": [
Expand All @@ -44,31 +40,33 @@
"node": ">=6.0.0"
},
"license": "MIT",
"main": "_bundles/ui-router-ng2.js",
"module": "lib/index.js",
"typings": "lib/index.d.ts",
"dependencies": {
"@uirouter/core": "^6.0.1",
"@uirouter/rx": "^0.6.0"
"distDir": "dist",
"ngPackage": {
"lib": {
"entryFile": "src/index.ts"
}
},
"peerDependencies": {
"@angular/common": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0",
"@angular/core": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0",
"@angular/router": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
"@angular/common": ">=8.0.0",
"@angular/core": ">=8.0.0",
"@uirouter/core": "^6.0.1",
"@uirouter/rx": "^0.6.0"
},
"devDependencies": {
"@angular/animations": "^6.1.2",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/platform-server": "^5.0.0",
"@angular/router": "^5.0.0",
"@angular/animations": "^8.2.5",
"@angular/common": "^8.2.5",
"@angular/compiler": "^8.2.5",
"@angular/compiler-cli": "^8.2.5",
"@angular/core": "^8.2.5",
"@angular/platform-browser": "^8.2.5",
"@angular/platform-browser-dynamic": "^8.2.5",
"@angular/platform-server": "^8.2.5",
"@angular/router": "^8.2.5",
"@types/jasmine": "3.4.0",
"@types/jquery": "^3.3.29",
"@uirouter/core": "^6.0.1",
"@uirouter/publish-scripts": "^2.3.37",
"@uirouter/rx": "^0.6.0",
"husky": "^3.0.0",
"jasmine-core": "^3.3.0",
"karma": "^4.1.0",
Expand All @@ -78,22 +76,23 @@
"karma-sourcemap-loader": "^0.3.7",
"karma-super-dots-reporter": "^0.2.0",
"karma-webpack": "^3.0.5",
"ng-packagr": "^5.3.0",
"prettier": "^1.18.2",
"pretty-quick": "^1.11.1",
"rollup": "^1.15.5",
"rollup-plugin-commonjs": "^10.0.0",
"rollup-plugin-node-resolve": "^5.0.2",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-uglify": "^6.0.0",
"rxjs": "^6.3.2",
"rxjs": "^6.5.3",
"rxjs-compat": "^6.3.2",
"ts-loader": "^3.5.0",
"tslib": "^1.9.3",
"tslint": "^5.11.0",
"typescript": "^3.2.4",
"typescript": "~3.5.3",
"webpack": "^3.11.0",
"webpack-dev-server": "^3.1.4",
"zone.js": "^0.10.2"
"zone.js": "~0.9.1"
},
"husky": {
"hooks": {
Expand Down
2 changes: 1 addition & 1 deletion src/directives/uiView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const ng2ComponentInputs = (factory: ComponentFactory<any>): InputMapping[] => {
export class UIView implements OnInit, OnDestroy {
static PARENT_INJECT = 'UIView.PARENT_INJECT';

@ViewChild('componentTarget', { read: ViewContainerRef })
@ViewChild('componentTarget', { read: ViewContainerRef, static: true })
_componentTarget: ViewContainerRef;
@Input('name') name: string;

Expand Down
4 changes: 0 additions & 4 deletions src/uiRouterNgModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ import { UIView } from './directives/uiView';
import { UrlRuleHandlerFn, TargetState, TargetStateDef, UIRouter, TransitionService } from '@uirouter/core';
import { _UIROUTER_INSTANCE_PROVIDERS, _UIROUTER_SERVICE_PROVIDERS } from './providers';

import { ROUTES } from '@angular/router';
/** @hidden */ export const UIROUTER_ROOT_MODULE = new InjectionToken('UIRouter Root Module');
/** @hidden */ export const UIROUTER_MODULE_TOKEN = new InjectionToken('UIRouter Module');
/** @hidden */ export const UIROUTER_STATES = new InjectionToken('UIRouter States');
// /** @hidden */ export const ROUTES = UIROUTER_STATES;

// Delay angular bootstrap until first transition is successful, for SSR.
// See https://github.com/ui-router/angular/pull/127
Expand All @@ -50,7 +48,6 @@ export function makeRootProviders(module: RootModule): Provider[] {
return [
{ provide: UIROUTER_ROOT_MODULE, useValue: module, multi: true },
{ provide: UIROUTER_MODULE_TOKEN, useValue: module, multi: true },
{ provide: ROUTES, useValue: module.states || [], multi: true },
{ provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: module.states || [], multi: true },
{
provide: APP_INITIALIZER,
Expand All @@ -64,7 +61,6 @@ export function makeRootProviders(module: RootModule): Provider[] {
export function makeChildProviders(module: StatesModule): Provider[] {
return [
{ provide: UIROUTER_MODULE_TOKEN, useValue: module, multi: true },
{ provide: ROUTES, useValue: module.states || [], multi: true },
{ provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: module.states || [], multi: true },
];
}
Expand Down
13 changes: 0 additions & 13 deletions test-angular-versions/v6/.editorconfig

This file was deleted.

39 changes: 0 additions & 39 deletions test-angular-versions/v6/.gitignore

This file was deleted.

27 changes: 0 additions & 27 deletions test-angular-versions/v6/README.md

This file was deleted.

105 changes: 0 additions & 105 deletions test-angular-versions/v6/angular.json

This file was deleted.

Loading

0 comments on commit 00e9d6a

Please sign in to comment.