Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(*): refactor for use IGO in prod #26

Merged
merged 4 commits into from
Apr 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions .angular-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"main": "../demo-app/main.ts",
"polyfills": "../demo-app/polyfills.ts",
"test": "../test/test.ts",
"tsconfig": "tsconfig.lib.json",
"tsconfig": "../tsconfig.lib.json",
"testTsconfig": "../tsconfig.spec.json",
"prefix": "igo",
"mobile": true,
Expand All @@ -25,18 +25,20 @@
"root": "src/demo-app",
"outDir": "dist",
"assets": [
"assets"
"assets",
{ "glob": "**/*", "input": "../assets/", "output": "./assets/igo2/" }
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"tsconfig": "tsconfig.demo.json",
"tsconfig": "../tsconfig.demo.json",
"prefix": "demo",
"mobile": true,
"styles": [
"../../node_modules/openlayers/dist/ol.css",
"style/main.styl",
"style/material-font.styl"
"../themes/deeppurple-amber.styl",
"../style/igo.styl",
"style/main.styl"
],
"scripts": [
"../../node_modules/openlayers/dist/ol.js"
Expand All @@ -48,25 +50,22 @@
}
}
],
"addons": [
"assets/fonts/*.+(otf|eot|svg|ttf|woff|woff2)"
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/lib/tsconfig.lib.json",
"project": "src/tsconfig.lib.json",
"exclude": "**/node_modules/**/*"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**/*"
},
{
"project": "src/demo-app/tsconfig.demo.json",
"project": "src/tsconfig.demo.json",
"exclude": "**/node_modules/**/*"
},
{
Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = function (config) {
files: [
'./node_modules/openlayers/dist/ol.js',
{
pattern: './src/assets/locale/*.json',
pattern: './src/locale/*.json',
watched: false,
included: false,
nocache: false,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
"ng": "ng",
"start": "ng serve --app demo --proxy-config proxy.conf.json",
"start.lib": "ng serve --proxy-config proxy.conf.json",
"build.lib": "npm run clean && gulp && ngc -p ./src/lib/tsconfig.lib.json && npm run build.lib.bundle",
"build.lib": "npm run clean && gulp && ngc -p ./src/tsconfig.lib.json && npm run build.lib.bundle",
"build.lib.bundle": "webpack --config webpack.conf.js --bail",
"build.demo": "ng build --app demo",
"test": "npm run lint && ng test --single-run",
"lint": "ng lint",
"e2e": "ng e2e --app demo",
"clean": "rimraf dist && rimraf bundle",
"language.extract": "npm run language.extract.lib && npm run language.extract.demo",
"language.extract.lib": "ngx-translate-extract -i ./src/lib -o ./src/assets/locale/fr.json ./src/assets/locale/en.json -s -f namespaced-json -m _ -c",
"language.extract.lib": "ngx-translate-extract -i ./src/lib -o ./src/locale/fr.json ./src/locale/en.json -s -f namespaced-json -m _ -c",
"language.extract.demo": "ngx-translate-extract -i ./src/demo-app -o ./src/demo-app/assets/locale/fr.json ./src/demo-app/assets/locale/en.json -s -f namespaced-json -m _ -c"
},
"dependencies": {
Expand Down
4 changes: 0 additions & 4 deletions src/demo-app/style/main.styl
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
@import '~@angular/material/prebuilt-themes/deeppurple-amber.css';
@import '../../themes/deeppurple-amber.styl';
@import '../../style/cls.styl';

/*** Reset ***/

html,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/language/shared/language-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class LanguageLoader implements TranslateLoader {
private suffix: string = '.json') {}

public getTranslation(lang: string): any {
const translation = require(`../../../../src/assets/locale/${lang}.json`);
const translation = require(`../../../../src/locale/${lang}.json`);
const igoLocale$ = Observable.of(translation);

if (!this.http) {
Expand Down
9 changes: 4 additions & 5 deletions src/lib/language/shared/language.service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Injectable, NgZone } from '@angular/core';
import { Injectable } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';

@Injectable()
export class LanguageService {

constructor(private translate: TranslateService, private zone: NgZone) {
constructor(private translate: TranslateService) {
const lang = this.getLanguage();
this.translate.setDefaultLang(lang);
}
Expand All @@ -15,8 +15,7 @@ export class LanguageService {
}

public setLanguage(language: string) {
this.translate.use(language);
this.translate.reloadLang(language);
this.zone.run(() => {});
this.translate.use(language);
this.translate.reloadLang(language);
}
}
2 changes: 1 addition & 1 deletion src/lib/overlay/shared/overlay.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class OverlayDirective implements OnInit, OnDestroy {

this.overlayMarkerStyle = new ol.style.Style({
image: new ol.style.Icon({
src: 'src/assets/icons/place_blue_36px.svg',
src: './assets/igo2/icons/place_blue_36px.svg',
imgSize: [36, 36], // for ie
anchor: [0.5, 1]
})
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions src/style/igo.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@require './material-font.styl';
@require './cls.styl';
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(../../assets/fonts/MaterialIcons-Regular.eot); /* For IE6-8 */
src: url(../fonts/MaterialIcons-Regular.eot); /* For IE6-8 */
src: local('Material Icons'),
local('MaterialIcons-Regular'),
url(../../assets/fonts/MaterialIcons-Regular.woff2) format('woff2'),
url(../../assets/fonts/MaterialIcons-Regular.woff) format('woff'),
url(../../assets/fonts/MaterialIcons-Regular.ttf) format('truetype');
url(../fonts/MaterialIcons-Regular.woff2) format('woff2'),
url(../fonts/MaterialIcons-Regular.woff) format('woff'),
url(../fonts/MaterialIcons-Regular.ttf) format('truetype');
}

.material-icons {
Expand All @@ -34,4 +34,4 @@
/* Support for IE. */
font-feature-settings: 'liga' 1;
-ms-font-feature-settings: 'liga' 1;
}
}
2 changes: 2 additions & 0 deletions src/themes/deeppurple-amber.styl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '~@angular/material/prebuilt-themes/deeppurple-amber.css';

$primary-color = rgb(103, 58, 183);
$accent-color = rgb(255, 215, 64);

Expand Down
6 changes: 3 additions & 3 deletions src/demo-app/tsconfig.demo.json → src/tsconfig.demo.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"extends": "../../tsconfig.json",
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/app",
"outDir": "../out-tsc/app",
"module": "es2015",
"baseUrl": "",
"types": []
},
"exclude": [
"test.ts",
"test/test.ts",
"**/*.spec.ts"
]
}
4 changes: 2 additions & 2 deletions src/lib/tsconfig.lib.json → src/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../tsconfig.json",
"compilerOptions": {
"declaration": true,
"stripInternal": false,
Expand All @@ -10,7 +10,7 @@
"types": []
},
"files": [
"../../dist/lib/index.ts"
"../dist/lib/index.ts"
],
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
Expand Down
2 changes: 1 addition & 1 deletion webpack.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ module.exports = {
use: [{
loader: 'awesome-typescript-loader?declaration=false',
options: {
tsconfig: './src/lib/tsconfig.lib.json'
tsconfig: './src/tsconfig.lib.json'
}
},
{
Expand Down