Skip to content

Commit

Permalink
feat: upgrade to ng9 for material path
Browse files Browse the repository at this point in the history
  • Loading branch information
sinedied committed Feb 8, 2020
1 parent 32c69cf commit 97d8fb0
Show file tree
Hide file tree
Showing 26 changed files with 1,428 additions and 1,039 deletions.
11 changes: 11 additions & 0 deletions generators/app/templates/_angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"aot": true,
"outputPath": "<%= props.target.includes('cordova') ? 'www' : 'dist' %>",
"index": "src/index.html",
"main": "src/main.ts",
Expand Down Expand Up @@ -61,6 +62,10 @@
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
<% if (props.pwa) { -%>
Expand Down Expand Up @@ -147,6 +152,12 @@
},
"configurations": {
"ci": {
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
"progress": false,
"watch": false
}
Expand Down
67 changes: 33 additions & 34 deletions generators/app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@
"generate": "ng generate"
},
"dependencies": {
"@angular/animations": "^8.1.0",
"@angular/common": "^8.1.0",
"@angular/compiler": "^8.1.0",
"@angular/core": "^8.1.0",
"@angular/forms": "^8.1.0",
"@angular/platform-browser": "^8.1.0",
"@angular/platform-browser-dynamic": "^8.1.0",
"@angular/router": "^8.1.0",
"@ngx-translate/core": "^11.0.1",
"@angular/animations": "^9.0.0",
"@angular/common": "^9.0.0",
"@angular/compiler": "^9.0.0",
"@angular/core": "^9.0.0",
"@angular/forms": "^9.0.0",
"@angular/platform-browser": "^9.0.0",
"@angular/platform-browser-dynamic": "^9.0.0",
"@angular/router": "^9.0.0",
"@ngx-translate/core": "^12.0.0",
<% if (props.target.includes('cordova')) { -%>
"@ionic-native/core": "^5.0.0",
"@ionic-native/keyboard": "^5.0.0",
Expand All @@ -81,7 +81,7 @@
"cordova-plugin-whitelist": "^1.3.3",
<% } -%>
<% if (props.pwa) { -%>
"@angular/service-worker": "^8.1.0",
"@angular/service-worker": "^9.0.0",
<% } -%>
<% if (props.ui === 'ionic') { -%>
"@ionic/angular": "^4.0.0",
Expand All @@ -92,9 +92,8 @@
<% } else if (props.ui === 'material') { -%>
"@angular/cdk": "^8.0.2",
"@angular/material": "^8.0.2",
"@angular/flex-layout": "^8.0.0-beta.26",
"@angular/flex-layout": "^9.0.0-beta.29",
"material-design-icons-iconfont": "^5.0.1",
"hammerjs": "^2.0.8",
<% } -%>
<% if (props.angulartics) { -%>
"angulartics2": "^7.2.4",
Expand All @@ -111,8 +110,9 @@
<% if (props.utility.includes('datefns')) { -%>
"date-fns": "^1.30.1",
<% } -%>
"rxjs": "^6.5.2",
"zone.js": "^0.9.1"
"rxjs": "^6.5.4",
"tslib": "^1.10.0",
"zone.js": "^0.10.2"
},
"devDependencies": {
<% if (props.target.includes('cordova')) { -%>
Expand All @@ -121,26 +121,26 @@
<% if (props.tools.includes('jest')) { -%>
"@angular-builders/jest": "^8.0.4",
<% } -%>
"@angular/cli": "~8.1.0",
"@angular/compiler-cli": "^8.1.0",
"@angular/language-service": "^8.1.0",
"@angular-devkit/build-angular": "^0.801.0",
"@angular/cli": "~9.0.1",
"@angular/compiler-cli": "^9.0.0",
"@angular/language-service": "^9.0.0",
"@angular-devkit/build-angular": "^0.900.1",
"@angularclass/hmr": "^2.1.3",
"@biesbjerg/ngx-translate-extract": "^2.3.4",
"@biesbjerg/ngx-translate-extract": "^4.2.0",
"@ngx-rocket/scripts": "^4.0.0",
"@types/jasmine": "^3.3.13",
"@types/jasminewd2": "^2.0.3",
<% if (props.tools.includes('jest')) { -%>
"@types/jest": "^24.0.12",
<% } -%>
"@types/node": "^10.9.0",
"@types/node": "^12.11.1",
<% if (props.utility.includes('lodash')) { -%>
"@types/lodash": "^4.14.112",
<% } -%>
<% if (props.utility.includes('ramda')) { -%>
"@types/ramda": "^0.26.6",
<% } -%>
"codelyzer": "^5.1.0",
"codelyzer": "^5.1.2",
<% if (props.target.includes('electron')) { -%>
"electron": "^5.0.2",
"electron-packager": "^13.0.1",
Expand All @@ -153,20 +153,19 @@
"@compodoc/compodoc": "^1.1.9",
<% } -%>
"htmlhint": "^0.11.0",
"https-proxy-agent": "^2.0.0",
"jasmine-core": "~3.4.0",
"https-proxy-agent": "^5.0.0",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
<% if (props.tools.includes('jest')) { -%>
"jest": "^24.7.1",
"jest-preset-angular": "^7.1.0",
<% } else { -%>
"karma": "~4.2.0",
"karma-chrome-launcher": "^3.0.0",
"karma-cli": "~2.0.0",
"karma": "~4.4.1",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage-istanbul-reporter": "^2.0.2",
"karma-jasmine": "^2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"karma-junit-reporter": "^1.2.0",
"karma-junit-reporter": "^2.0.1",
<% } -%>
<% if (props.tools.includes('prettier')) { -%>
"prettier": "^1.16.3",
Expand All @@ -177,17 +176,17 @@
"husky": "^3.0.0",
<% } -%>
<% } -%>
"protractor": "~5.4.0",
"protractor": "~5.4.3",
<% if (!options['external-chrome']) { -%>
"puppeteer": "^1.17.0",
"puppeteer": "^2.1.1",
<% } -%>
"stylelint": "~10.1.0",
"stylelint-config-recommended-scss": "~3.3.0",
"stylelint-config-standard": "~18.3.0",
"stylelint-scss": "~3.9.0",
"stylelint": "~13.0.0",
"stylelint-config-recommended-scss": "~4.2.0",
"stylelint-config-standard": "~19.0.0",
"stylelint-scss": "~3.14.2",
"ts-node": "^8.3.0",
"tslint": "~5.18.0",
"typescript": "~3.4.0"
"typescript": "~3.7.5"
<% if (props.tools.includes('prettier')) { -%>
},
"prettier": {
Expand Down
3 changes: 3 additions & 0 deletions generators/app/templates/_tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
Expand Down Expand Up @@ -33,6 +34,8 @@
}
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"preserveWhitespaces": true
}
}
2 changes: 1 addition & 1 deletion generators/app/templates/_tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"outDir": "./out-tsc/spec",
<% if (props.tools.includes('jest')) { -%>
"allowJs": true,
<% } -%>
Expand Down
3 changes: 0 additions & 3 deletions generators/app/templates/src/_main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
* For app-specific initialization, use `app/app.component.ts`.
*/

<% if (props.ui === 'material') { -%>
import 'hammerjs';
<% } -%>
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

Expand Down
2 changes: 1 addition & 1 deletion generators/app/templates/src/app/_app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [
<% if (props.lazy) { -%>
Shell.childRoutes([
{ path: 'about', loadChildren: './about/about.module#AboutModule' }
{ path: 'about', loadChildren: () => import('./about/about.module').then(m => m.AboutModule) }
]),
<% } -%>
// Fallback when no prior route is matched
Expand Down
4 changes: 0 additions & 4 deletions generators/app/templates/src/app/about/_about.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ import { AboutComponent } from './about.component';
<% } -%>
AboutRoutingModule
],
<% if (props.ui === 'ionic') { -%>
entryComponents: [
AboutComponent
],
<% } -%>
declarations: [
AboutComponent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ describe('AuthenticationGuard', () => {
]
});

authenticationGuard = TestBed.get(AuthenticationGuard);
credentialsService = TestBed.get(CredentialsService);
authenticationGuard = TestBed.inject(AuthenticationGuard);
credentialsService = TestBed.inject(CredentialsService);
});

it('should have a canActivate method', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ describe('AuthenticationService', () => {
providers: [{ provide: CredentialsService, useClass: MockCredentialsService }, AuthenticationService]
});

authenticationService = TestBed.get(AuthenticationService);
credentialsService = TestBed.get(CredentialsService);
authenticationService = TestBed.inject(AuthenticationService);
credentialsService = TestBed.inject(CredentialsService);
credentialsService.credentials = null;
spyOn(credentialsService, 'setCredentials').and.callThrough();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('CredentialsService', () => {
providers: [CredentialsService]
});

credentialsService = TestBed.get(CredentialsService);
credentialsService = TestBed.inject(CredentialsService);
});

afterEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ describe('ApiPrefixInterceptor', () => {
}]
});

http = TestBed.get(HttpClient);
httpMock = TestBed.get(HttpTestingController as Type<HttpTestingController>);
http = TestBed.inject(HttpClient);
httpMock = TestBed.inject(HttpTestingController as Type<HttpTestingController>);
});

afterEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ describe('CacheInterceptor', () => {
describe('with default configuration', () => {
beforeEach(() => {
interceptorOptions = null;
http = TestBed.get(HttpClient);
httpMock = TestBed.get(HttpTestingController as Type<HttpTestingController>);
httpCacheService = TestBed.get(HttpCacheService);
http = TestBed.inject(HttpClient);
httpMock = TestBed.inject(HttpTestingController as Type<HttpTestingController>);
httpCacheService = TestBed.inject(HttpCacheService);
});

it('should cache the request', () => {
Expand Down Expand Up @@ -89,9 +89,9 @@ describe('CacheInterceptor', () => {
describe('with update forced configuration', () => {
beforeEach(() => {
interceptorOptions = { update: true };
http = TestBed.get(HttpClient);
httpMock = TestBed.get(HttpTestingController as Type<HttpTestingController>);
httpCacheService = TestBed.get(HttpCacheService);
http = TestBed.inject(HttpClient);
httpMock = TestBed.inject(HttpTestingController as Type<HttpTestingController>);
httpCacheService = TestBed.inject(HttpCacheService);
});

afterEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ describe('ErrorHandlerInterceptor', () => {
}]
});

http = TestBed.get(HttpClient);
httpMock = TestBed.get(HttpTestingController as Type<HttpTestingController>);
http = TestBed.inject(HttpClient);
httpMock = TestBed.inject(HttpTestingController as Type<HttpTestingController>);
});

afterEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('HttpCacheService', () => {
window.sessionStorage.removeItem(cachePersistenceKey);
window.localStorage.removeItem(cachePersistenceKey);

httpCacheService = TestBed.get(HttpCacheService);
httpCacheService = TestBed.inject(HttpCacheService);

response = new HttpResponse({ body: 'data' });
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ describe('HttpService', () => {
]
});

http = TestBed.get(HttpClient);
httpMock = TestBed.get(HttpTestingController as Type<HttpTestingController>);
httpCacheService = TestBed.get(HttpCacheService);
http = TestBed.inject(HttpClient);
httpMock = TestBed.inject(HttpTestingController as Type<HttpTestingController>);
httpCacheService = TestBed.inject(HttpCacheService);

const realRequest = http.request;
spyOn(HttpService.prototype, 'request').and.callFake(
Expand Down
4 changes: 2 additions & 2 deletions generators/app/templates/src/app/core/i18n.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ describe('I18nService', () => {
]
});

i18nService = TestBed.get(I18nService);
translateService = TestBed.get(TranslateService);
i18nService = TestBed.inject(I18nService);
translateService = TestBed.inject(TranslateService);

// Create spies
onLangChangeSpy = jasmine.createSpy('onLangChangeSpy');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { ActivatedRouteSnapshot, DetachedRouteHandle, RouteReuseStrategy } from '@angular/router';
import { Injectable } from '@angular/core';

/**
* A route strategy allowing for explicit route reuse.
* Used as a workaround for https://github.com/angular/angular/issues/18374
* To reuse a given route, add `data: { reuse: true }` to the route definition.
*/
@Injectable()
export class RouteReusableStrategy extends RouteReuseStrategy {

public shouldDetach(route: ActivatedRouteSnapshot): boolean {
Expand Down
5 changes: 0 additions & 5 deletions generators/app/templates/src/app/home/_home.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ import { QuoteService } from './quote.service';
<% } -%>
HomeRoutingModule
],
<% if (props.ui === 'ionic') { -%>
entryComponents: [
HomeComponent
],
<% } -%>
declarations: [
HomeComponent
]
Expand Down
6 changes: 3 additions & 3 deletions generators/app/templates/src/app/home/quote.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ describe('QuoteService', () => {
]
});

quoteService = TestBed.get(QuoteService);
httpMock = TestBed.get(HttpTestingController as Type<HttpTestingController>);
quoteService = TestBed.inject(QuoteService);
httpMock = TestBed.inject(HttpTestingController as Type<HttpTestingController>);

const htttpCacheService = TestBed.get(HttpCacheService);
const htttpCacheService = TestBed.inject(HttpCacheService);
htttpCacheService.cleanCache();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ import { LoginComponent } from './login.component';
<% } -%>
LoginRoutingModule
],
<% if (props.ui === 'ionic') { -%>
entryComponents: [
LoginComponent
],
<% } -%>
declarations: [
LoginComponent
]
Expand Down
Loading

0 comments on commit 97d8fb0

Please sign in to comment.