Skip to content

Commit

Permalink
Upgraded to ng 6 (#267)
Browse files Browse the repository at this point in the history
* Upgraded to ng 6
Updated various deps

* Updated travis nodejs

* Linting
Fixing webtest
  • Loading branch information
santam85 authored and aitboudad committed May 17, 2018
1 parent 0dae3db commit 759f4d0
Show file tree
Hide file tree
Showing 11 changed files with 5,590 additions and 4,316 deletions.
63 changes: 0 additions & 63 deletions .angular-cli.json

This file was deleted.

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- "6"
- "8"
# To start firefox, xvfb(X virtual framebuffer)
before_script:
- export DISPLAY=:99.0
Expand Down
131 changes: 131 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"@ngui/map": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/app",
"index": "app/index.html",
"main": "app/main.ts",
"tsConfig": "app/tsconfig.app.json",
"polyfills": "app/polyfills.ts",
"assets": [
],
"styles": [
"app/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": "app/environments/environment.ts",
"with": "app/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "@ngui/map:build"
},
"configurations": {
"production": {
"browserTarget": "@ngui/map:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "@ngui/map:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "app/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "app/polyfills.ts",
"tsConfig": "app/tsconfig.spec.json",
"scripts": [],
"styles": [
"app/styles.css"
],
"assets": [
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"@ngui/map-e2e": {
"root": "",
"sourceRoot": "",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "@ngui/map:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "@ngui/map",
"schematics": {
"@schematics/angular:class": {
"spec": false
},
"@schematics/angular:component": {
"prefix": "app",
"styleext": "css"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
}
4 changes: 2 additions & 2 deletions app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

import { LocationStrategy, HashLocationStrategy } from '@angular/common';
import { NguiUtilsModule } from '@ngui/utils';
import { NguiMapModule } from '@ngui/map';
import { SourceCodeService } from './source-code.service';
import { HttpClientModule } from '@angular/common/http';

import { AppComponent } from './app.component';
// import { Codeblock } from 'ng2-prism/codeblock';
Expand All @@ -17,7 +17,7 @@ import { APP_ROUTER_PROVIDERS, APP_ROUTER_COMPONENTS } from './app.route';
imports: [
BrowserModule,
FormsModule,
HttpModule,
HttpClientModule,
APP_ROUTER_PROVIDERS,
// NguiMapModule,
NguiMapModule.forRoot({
Expand Down
8 changes: 4 additions & 4 deletions app/map-components/custom-marker-ng-for.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { of } from 'rxjs';
import { Component } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { SourceCodeService } from '../source-code.service';
import 'rxjs/add/observable/of';


@Component({
template: `
Expand Down Expand Up @@ -33,7 +33,7 @@ import 'rxjs/add/observable/of';
]
})
export class CustomMarkerNgForComponent {
public positions= [];
public positions = [];
public count: number = 0;
public code: string;

Expand All @@ -55,7 +55,7 @@ export class CustomMarkerNgForComponent {
}

showMarkersFromObservable() {
Observable.of(this.getRandomMarkers()) // Think this as http call
of(this.getRandomMarkers()) // Think this as http call
.subscribe( positions => {
this.positions = positions;
});
Expand Down
8 changes: 4 additions & 4 deletions app/map-components/marker-ng-for.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { of } from 'rxjs';
import { Component } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { SourceCodeService } from '../source-code.service';
import 'rxjs/add/observable/of';


@Component({
template: `
Expand All @@ -17,7 +17,7 @@ import 'rxjs/add/observable/of';
<pre class="prettyprint">{{code}}</pre>
`})
export class MarkerNgForComponent {
public positions= [];
public positions = [];

code: string;

Expand All @@ -39,7 +39,7 @@ export class MarkerNgForComponent {
}

showMarkersFromObservable() {
Observable.of(this.getRandomMarkers()) // Think this as http call
of(this.getRandomMarkers()) // Think this as http call
.subscribe( positions => {
this.positions = positions;
});
Expand Down
11 changes: 6 additions & 5 deletions app/source-code.service.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import {map} from 'rxjs/operators';
import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Plunker} from 'create-plunker';
import 'rxjs/add/operator/map';
import {HttpClient} from '@angular/common/http';


@Injectable()
export class SourceCodeService {

constructor(private http: Http) { }
constructor(private http: HttpClient) { }

getText(klassName: string) {
let urlPrefix = 'https://raw.githubusercontent.com/ng2-ui/map/master/app/map-components';
Expand All @@ -18,8 +19,8 @@ export class SourceCodeService {
replace(/^-/, '');
let url = `${urlPrefix}/${fileName}`;

return this.http.get(url).
map((res: Response) => appComponentTsCode(res.text()));
return this.http.get(url, { responseType: 'text'}).pipe(
map((res) => appComponentTsCode(res)));
}

plnkr(code: string) {
Expand Down
Loading

0 comments on commit 759f4d0

Please sign in to comment.