Commit 76bb82c8 by Tuukka Kivilahti

update to angular-6-beta

1 parent a9ab48ed
{ {
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": { "project": {
"name": "moya-angular" "name": "angular6testi"
}, },
"apps": [ "apps": [
{ {
...@@ -12,18 +13,18 @@ ...@@ -12,18 +13,18 @@
], ],
"index": "index.html", "index": "index.html",
"main": "main.ts", "main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts", "test": "test.ts",
"tsconfig": "tsconfig.json", "tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app", "prefix": "app",
"styles": [ "styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.scss" "styles.scss"
], ],
"scripts": [], "scripts": [],
"environmentSource": "environments/environment.ts", "environmentSource": "environments/environment.ts",
"environments": { "environments": {
"dev": "environments/environment.ts", "dev": "environments/environment.ts",
"hmr": "environments/environment.hmr.ts",
"prod": "environments/environment.prod.ts" "prod": "environments/environment.prod.ts"
} }
} }
...@@ -35,7 +36,16 @@ ...@@ -35,7 +36,16 @@
}, },
"lint": [ "lint": [
{ {
"project": "src/tsconfig.json" "project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
} }
], ],
"test": { "test": {
...@@ -44,14 +54,7 @@ ...@@ -44,14 +54,7 @@
} }
}, },
"defaults": { "defaults": {
"styleExt": "scss", "styleExt": "css",
"class": { "component": {}
"spec": false
},
"component": {
"spec": true,
"inlineStyle": false,
"inlineTemplate": false
}
} }
} }
...@@ -7,50 +7,49 @@ ...@@ -7,50 +7,49 @@
"ng": "ng", "ng": "ng",
"start": "ng serve --preserve-symlinks --proxy-config=moyaproxy.conf.json --base-href=/", "start": "ng serve --preserve-symlinks --proxy-config=moyaproxy.conf.json --base-href=/",
"build": "ng build --preserve-symlinks", "build": "ng build --preserve-symlinks",
"aot": "ng build --preserve-symlinks --aot",
"test": "ng test", "test": "ng test",
"lint": "ng lint", "lint": "ng lint",
"e2e": "ng e2e" "e2e": "ng e2e",
"version": "ng version"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/animations": "^5.2.4", "@angular/animations": "^6.0.0-beta.6",
"@angular/common": "^5.2.4", "@angular/common": "^6.0.0-beta.6",
"@angular/compiler": "^5.2.4", "@angular/compiler": "^6.0.0-beta.6",
"@angular/core": "^5.2.4", "@angular/core": "^6.0.0-beta.6",
"@angular/forms": "^5.2.4", "@angular/forms": "^6.0.0-beta.6",
"@angular/http": "^5.2.4", "@angular/http": "^6.0.0-beta.6",
"@angular/material": "^5.2.0", "@angular/material": "^6.0.0-beta.3",
"@angular/platform-browser": "^5.2.4", "@angular/platform-browser": "^6.0.0-beta.6",
"@angular/platform-browser-dynamic": "^5.2.4", "@angular/platform-browser-dynamic": "^6.0.0-beta.6",
"@angular/platform-server": "^5.2.4", "@angular/router": "^6.0.0-beta.6",
"@angular/router": "^5.2.4",
"bootstrap": "^4.0.0",
"core-js": "^2.5.1", "core-js": "^2.5.1",
"rxjs": "^5.5.0",
"zone.js": "^0.8.19",
"bootstrap": "^4.0.0",
"ngx-bootstrap": "^2.0.2", "ngx-bootstrap": "^2.0.2",
"rxjs": "^5.4.3", "ts-helpers": "^1.1.1"
"ts-helpers": "^1.1.1",
"zone.js": "^0.8.19"
}, },
"devDependencies": { "devDependencies": {
"@angular/cli": "^1.6.8", "@angular/cli": "~6.0.0-beta.4",
"@angular/compiler-cli": "^5.2.4", "@angular/compiler-cli": "^6.0.0-beta.6",
"@angularclass/hmr": "^2.1.3", "@angular/language-service": "^6.0.0-beta.6",
"@types/jasmine": "2.8.6", "@types/jasmine": "~2.8.3",
"@types/node": "^9.4.4", "@types/jasminewd2": "~2.0.2",
"codelyzer": "~4.1.0", "@types/node": "~9.4.6",
"jasmine-core": "2.99.1", "codelyzer": "^4.0.1",
"jasmine-spec-reporter": "4.2.1", "jasmine-core": "~3.1.0",
"karma": "2.0.0", "jasmine-spec-reporter": "~4.2.1",
"karma-chrome-launcher": "^2.2.0", "karma": "~2.0.0",
"karma-cli": "^1.0.1", "karma-chrome-launcher": "~2.2.0",
"karma-jasmine": "^1.0.2", "karma-coverage-istanbul-reporter": "^1.2.1",
"karma-remap-istanbul": "^0.6.0", "karma-jasmine": "~1.1.0",
"node-sass": "^4.5.3", "karma-jasmine-html-reporter": "^0.2.2",
"protractor": "^5.1.2", "protractor": "~5.3.0",
"raw-loader": "^0.5.1", "ts-node": "~5.0.0",
"sass-loader": "^6.0.6", "tslint": "~5.9.1",
"ts-node": "5.0.0", "typescript": "~2.5.3"
"tslint": "^5.9.1",
"typescript": "^2.5.3"
} }
} }
...@@ -9,7 +9,6 @@ import {AlertModule} from 'ngx-bootstrap'; ...@@ -9,7 +9,6 @@ import {AlertModule} from 'ngx-bootstrap';
import {RouterModule, Routes} from '@angular/router'; import {RouterModule, Routes} from '@angular/router';
import {OldMoyaComponent} from './old-moya/old-moya.component'; import {OldMoyaComponent} from './old-moya/old-moya.component';
import {SafePipe} from './pipes/safe.pipe';
import {TestComponent} from './test/test.component'; import {TestComponent} from './test/test.component';
import {AdminMenuComponent} from './menu/admin-menu/admin-menu.component'; import {AdminMenuComponent} from './menu/admin-menu/admin-menu.component';
import {TopMenuComponent} from './menu/top-menu/top-menu.component'; import {TopMenuComponent} from './menu/top-menu/top-menu.component';
...@@ -19,13 +18,13 @@ import {UserMenuComponent} from './menu/user-menu/user-menu.component'; ...@@ -19,13 +18,13 @@ import {UserMenuComponent} from './menu/user-menu/user-menu.component';
import {UserComponent} from './user/user.component'; import {UserComponent} from './user/user.component';
import {InfoComponent} from './info/info.component'; import {InfoComponent} from './info/info.component';
import {AdminComponent} from './admin/admin.component'; import {AdminComponent} from './admin/admin.component';
import {I18nPipe} from './pipes/i18n.pipe';
import {HttpClientModule, HttpHandler } from '@angular/common/http'; import {HttpClientModule, HttpHandler } from '@angular/common/http';
import { HttpModule } from '@angular/http'; import { HttpModule } from '@angular/http';
import {StaticInjector} from "@angular/core/src/di/injector"; import {StaticInjector} from "@angular/core/src/di/injector";
import {CommonModule} from "@angular/common"; import {CommonModule} from "@angular/common";
import {CacheService} from "./shared/services/cache.service"; import {CacheService} from "./shared/services/cache.service";
import {MoyaRestModule} from "./moya-rest"; import {MoyaRestModule} from "./moya-rest";
import {SafePipe} from "./pipes/safe.pipe";
const appRoutes: Routes = [ const appRoutes: Routes = [
{ {
...@@ -63,7 +62,6 @@ const appRoutes: Routes = [ ...@@ -63,7 +62,6 @@ const appRoutes: Routes = [
AppComponent, AppComponent,
ViplistComponent, ViplistComponent,
OldMoyaComponent, OldMoyaComponent,
SafePipe,
TestComponent, TestComponent,
TopMenuComponent, TopMenuComponent,
LeftMenuComponent, LeftMenuComponent,
...@@ -73,7 +71,7 @@ const appRoutes: Routes = [ ...@@ -73,7 +71,7 @@ const appRoutes: Routes = [
UserComponent, UserComponent,
InfoComponent, InfoComponent,
AdminComponent, AdminComponent,
I18nPipe SafePipe
], ],
imports: [ imports: [
......
import { Pipe, PipeTransform } from '@angular/core'
@Pipe({
name: 'i18n'
})
export class I18nPipe implements PipeTransform {
i18n = require('../../i18n/i18n.json')
transform(value: any, args?: any): any {
return this.i18n[value];
}
}
import {NgModuleRef, ApplicationRef} from '@angular/core';
import {createNewHosts} from '@angularclass/hmr';
/**
* Created by tuukka on 14/02/17.
*/
export const hmrBootstrap = (module: any, bootstrap: () => Promise<NgModuleRef<any>>) => {
let ngModule: NgModuleRef<any>;
module.hot.accept();
bootstrap().then(mod => ngModule = mod);
module.hot.dispose(() => {
let appRef: ApplicationRef = ngModule.injector.get(ApplicationRef);
let elements = appRef.components.map(c => c.location.nativeElement);
let makeVisible = createNewHosts(elements);
ngModule.destroy();
makeVisible();
});
};
...@@ -4,7 +4,7 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; ...@@ -4,7 +4,7 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core'; import { enableProdMode } from '@angular/core';
import { environment } from './environments/environment'; import { environment } from './environments/environment';
import { AppModule } from './app/app.module'; import { AppModule } from './app/app.module';
import {hmrBootstrap} from './hmr';
if (environment.production) { if (environment.production) {
enableProdMode(); enableProdMode();
...@@ -15,17 +15,6 @@ if (environment.production) { ...@@ -15,17 +15,6 @@ if (environment.production) {
const bootstrap = () => { const bootstrap = () => {
return platformBrowserDynamic().bootstrapModule(AppModule); return platformBrowserDynamic().bootstrapModule(AppModule);
}; };
bootstrap();
if (environment.hmr) {
if (module['hot']) {
console.log('starting with hmr!');
hmrBootstrap(module, bootstrap);
} else {
console.error('HMR is not enabled for webpack-dev-server!');
console.log('Are you using the --hmr flag for ng serve?');
}
} else {
bootstrap();
}
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"baseUrl": "./",
"module": "commonjs",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}
/* SystemJS module definition */
declare var module: NodeModule;
interface NodeModule {
id: string;
}
{ {
"compileOnSave": false,
"compilerOptions": { "compilerOptions": {
"baseUrl": "", "outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false, "declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"lib": [
"es6",
"dom"
],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"target": "es5", "target": "es5",
"typeRoots": [ "typeRoots": [
"../node_modules/@types" "node_modules/@types"
],
"lib": [
"es2017",
"dom"
] ]
}, }
"include": [
"**/*.ts",
]
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!