From 2da1fc784471973a9b36563507ce4987cd738e5d Mon Sep 17 00:00:00 2001 From: renjithsraj Date: Sun, 15 Jul 2018 20:42:33 +0530 Subject: [PATCH] migrate angular 5 to angualr 6 --- .angular-cli.json | 48 ------- angular.json | 121 ++++++++++++++++++ package.json | 47 +++---- src/app/app.module.ts | 48 +++---- .../secure/landing/securehome.component.ts | 10 +- src/tsconfig.spec.json | 3 +- 6 files changed, 177 insertions(+), 100 deletions(-) delete mode 100644 .angular-cli.json create mode 100644 angular.json diff --git a/.angular-cli.json b/.angular-cli.json deleted file mode 100644 index df30a53..0000000 --- a/.angular-cli.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "project": { - "version": "1.0.0-beta.14", - "name": "aws-cognito-quickstart" - }, - "apps": [ - { - "root": "src", - "outDir": "dist", - "assets": [ - "assets", - "favicon.ico" - ], - "index": "index.html", - "main": "main.ts", - "test": "test.ts", - "tsconfig": "tsconfig.app.json", - "testTsconfig": "tsconfig.spec.json", - "prefix": "app", - "mobile": false, - "styles": [ - "styles.css" - ], - "scripts": [], - "environmentSource": "environments/environment.ts", - "environments": { - "dev": "environments/environment.ts", - "prod": "environments/environment.prod.ts" - } - } - ], - "addons": [], - "packages": [], - "e2e": { - "protractor": { - "config": "./protractor.conf.js" - } - }, - "test": { - "karma": { - "config": "./karma.conf.js" - } - }, - "defaults": { - "styleExt": "css", - "prefixInterfaces": false - } -} diff --git a/angular.json b/angular.json new file mode 100644 index 0000000..ec38915 --- /dev/null +++ b/angular.json @@ -0,0 +1,121 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "aws-cognito-quickstart": { + "root": "", + "sourceRoot": "src", + "projectType": "application", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist", + "index": "src/index.html", + "main": "src/main.ts", + "tsConfig": "src/tsconfig.app.json", + "assets": [ + "src/assets", + "src/favicon.ico" + ], + "styles": [ + "src/styles.css" + ], + "scripts": [] + }, + "configurations": { + "production": { + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "extractCss": true, + "namedChunks": false, + "aot": true, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.prod.ts" + } + ] + } + } + }, + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "options": { + "browserTarget": "aws-cognito-quickstart:build" + }, + "configurations": { + "production": { + "browserTarget": "aws-cognito-quickstart:build:production" + } + } + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "aws-cognito-quickstart:build" + } + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "src/test.ts", + "karmaConfig": "./karma.conf.js", + "tsConfig": "src/tsconfig.spec.json", + "scripts": [], + "styles": [ + "src/styles.css" + ], + "assets": [ + "src/assets", + "src/favicon.ico" + ] + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [], + "exclude": [] + } + } + } + }, + "aws-cognito-quickstart-e2e": { + "root": "", + "sourceRoot": "e2e", + "projectType": "application", + "architect": { + "e2e": { + "builder": "@angular-devkit/build-angular:protractor", + "options": { + "protractorConfig": "./protractor.conf.js", + "devServerTarget": "aws-cognito-quickstart:serve" + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [], + "exclude": [] + } + } + } + } + }, + "defaultProject": "aws-cognito-quickstart", + "schematics": { + "@schematics/angular:component": { + "prefix": "app", + "styleext": "css" + }, + "@schematics/angular:directive": { + "prefix": "app" + } + } +} \ No newline at end of file diff --git a/package.json b/package.json index b82c9de..385b6e0 100644 --- a/package.json +++ b/package.json @@ -22,31 +22,31 @@ }, "private": true, "dependencies": { - "@angular/animations": "5.2.2", - "@angular/cli": "1.6.6", - "@angular/common": "5.2.2", - "@angular/compiler": "5.2.2", - "@angular/compiler-cli": "5.2.2", - "@angular/core": "5.2.2", - "@angular/forms": "5.2.2", - "@angular/http": "5.2.2", - "@angular/platform-browser": "5.2.2", - "@angular/platform-browser-dynamic": "5.2.2", - "@angular/platform-server": "5.2.2", - "@angular/router": "5.2.2", + "@angular/animations": "6.0.9", + "@angular/cli": "6.0.8", + "@angular/common": "6.0.9", + "@angular/compiler": "6.0.9", + "@angular/compiler-cli": "6.0.9", + "@angular/core": "6.0.9", + "@angular/forms": "6.0.9", + "@angular/http": "6.0.9", + "@angular/platform-browser": "6.0.9", + "@angular/platform-browser-dynamic": "6.0.9", + "@angular/platform-server": "6.0.9", + "@angular/router": "6.0.9", "@types/jasmine": "2.2.30", "@types/node": "^8.5.2", "@types/selenium-webdriver": "2.44.26", "amazon-cognito-identity-js": "1.29.0", "aws-sdk": "2.67.0", - "body-parser": "~1.15.1", + "body-parser": "^1.18.3", "codelyzer": "4.0.1", "cookie-parser": "~1.4.3", "core-js": "2.4.1", "debug": "~2.2.0", "ejs": "^2.5.2", "enhanced-resolve": "^3.3.0", - "express": "~4.13.4", + "express": "^4.16.3", "extract-text-webpack-plugin": "2.1.0", "jasmine-core": "2.4.1", "jasmine-spec-reporter": "2.5.0", @@ -55,20 +55,23 @@ "karma-cli": "1.0.1", "karma-jasmine": "1.0.2", "karma-remap-istanbul": "0.6.0", - "morgan": "~1.7.0", - "protractor": "5.1.1", - "rxjs": "5.5.4", - "serve-favicon": "~2.3.0", + "morgan": "^1.9.0", + "protractor": "^5.3.2", + "rxjs": "^6.2.2", + "rxjs-tslint": "^0.1.5", + "serve-favicon": "^2.5.0", "ts-helpers": "1.1.1", "ts-node": "3.2.0", "tslint": "5.7.0", - "typescript": "2.4.2", - "webpack": "2.2.1", + "typescript": "2.7.2", + "webpack": "^4.4.1", "webpack-dev-middleware": "1.10.1", "webpack-dev-server": "2.4.2", "webpack-md5-hash": "0.0.5", "webpack-merge": "4.1.0", - "zone.js": "0.8.20" + "zone.js": "^0.8.26" }, - "devDependencies": {} + "devDependencies": { + "@angular-devkit/build-angular": "~0.6.8" + } } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index e216070..39b76cb 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,26 +1,26 @@ -import {BrowserModule} from "@angular/platform-browser"; -import {NgModule} from "@angular/core"; -import {FormsModule} from "@angular/forms"; -import {HttpModule} from "@angular/http"; -import {AppComponent} from "./app.component"; -import {UserRegistrationService} from "./service/user-registration.service"; -import {UserParametersService} from "./service/user-parameters.service"; -import {UserLoginService} from "./service/user-login.service"; -import {CognitoUtil} from "./service/cognito.service"; -import {routing} from "./app.routes"; -import {AboutComponent, HomeComponent, HomeLandingComponent} from "./public/home.component"; -import {AwsUtil} from "./service/aws.service"; -import {UseractivityComponent} from "./secure/useractivity/useractivity.component"; -import {MyProfileComponent} from "./secure/profile/myprofile.component"; -import {SecureHomeComponent} from "./secure/landing/securehome.component"; -import {JwtComponent} from "./secure/jwttokens/jwt.component"; -import {DynamoDBService} from "./service/ddb.service"; -import {LoginComponent} from "./public/auth/login/login.component"; -import {RegisterComponent} from "./public/auth/register/registration.component"; -import {ForgotPassword2Component, ForgotPasswordStep1Component} from "./public/auth/forgot/forgotPassword.component"; -import {LogoutComponent, RegistrationConfirmationComponent} from "./public/auth/confirm/confirmRegistration.component"; -import {ResendCodeComponent} from "./public/auth/resend/resendCode.component"; -import {NewPasswordComponent} from "./public/auth/newpassword/newpassword.component"; +import {BrowserModule} from '@angular/platform-browser'; +import {NgModule} from '@angular/core'; +import {FormsModule} from '@angular/forms'; +import {HttpClientModule} from '@angular/common/http'; +import {AppComponent} from './app.component'; +import {UserRegistrationService} from './service/user-registration.service'; +import {UserParametersService} from './service/user-parameters.service'; +import {UserLoginService} from './service/user-login.service'; +import {CognitoUtil} from './service/cognito.service'; +import {routing} from './app.routes'; +import {AboutComponent, HomeComponent, HomeLandingComponent} from './public/home.component'; +import {AwsUtil} from './service/aws.service'; +import {UseractivityComponent} from './secure/useractivity/useractivity.component'; +import {MyProfileComponent} from './secure/profile/myprofile.component'; +import {SecureHomeComponent} from './secure/landing/securehome.component'; +import {JwtComponent} from './secure/jwttokens/jwt.component'; +import {DynamoDBService} from './service/ddb.service'; +import {LoginComponent} from './public/auth/login/login.component'; +import {RegisterComponent} from './public/auth/register/registration.component'; +import {ForgotPassword2Component, ForgotPasswordStep1Component} from './public/auth/forgot/forgotPassword.component'; +import {LogoutComponent, RegistrationConfirmationComponent} from './public/auth/confirm/confirmRegistration.component'; +import {ResendCodeComponent} from './public/auth/resend/resendCode.component'; +import {NewPasswordComponent} from './public/auth/newpassword/newpassword.component'; import { MFAComponent } from './public/auth/mfa/mfa.component'; @@ -47,7 +47,7 @@ import { MFAComponent } from './public/auth/mfa/mfa.component'; imports: [ BrowserModule, FormsModule, - HttpModule, + HttpClientModule, routing ], providers: [ diff --git a/src/app/secure/landing/securehome.component.ts b/src/app/secure/landing/securehome.component.ts index 6accf94..090de2b 100644 --- a/src/app/secure/landing/securehome.component.ts +++ b/src/app/secure/landing/securehome.component.ts @@ -1,7 +1,7 @@ -import {Component, OnInit} from "@angular/core"; -import {Router} from "@angular/router"; -import {UserLoginService} from "../../service/user-login.service"; -import {LoggedInCallback} from "../../service/cognito.service"; +import {Component, OnInit} from '@angular/core'; +import {Router} from '@angular/router'; +import {UserLoginService} from '../../service/user-login.service'; +import {LoggedInCallback} from '../../service/cognito.service'; @Component({ selector: 'awscognito-angular2-app', @@ -12,7 +12,7 @@ export class SecureHomeComponent implements OnInit, LoggedInCallback { constructor(public router: Router, public userService: UserLoginService) { this.userService.isAuthenticated(this); - console.log("SecureHomeComponent: constructor"); + console.log('SecureHomeComponent: constructor'); } ngOnInit() { diff --git a/src/tsconfig.spec.json b/src/tsconfig.spec.json index 6c5160e..b8347c1 100644 --- a/src/tsconfig.spec.json +++ b/src/tsconfig.spec.json @@ -18,7 +18,8 @@ ] }, "files": [ - "test.ts" + "test.ts", + "polyfills.ts" ], "include": [ "**/*.spec.ts"