Skip to content

Commit

Permalink
fix: related to issue #64
Browse files Browse the repository at this point in the history
- barrel and circular dependencies -> removed index.ts files
- export all artifacts in public_api, to avoid problems with aot
  • Loading branch information
mauriciovigolo committed May 25, 2018
1 parent f388ea5 commit 6ca5012
Show file tree
Hide file tree
Showing 22 changed files with 61 additions and 10,648 deletions.
10,575 changes: 0 additions & 10,575 deletions examples/keycloak-events/package-lock.json

This file was deleted.

2 changes: 1 addition & 1 deletion examples/keycloak-events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2"
"typescript": "~2.4.2"
}
}
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
"scripts": {
"contributors:add": "all-contributors add",
"contributors:generate": "all-contributors generate",
"copy-files": "npx shx cp -r README.md ./dist/keycloak-angular",
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"build:keycloak-angular": "ng build keycloak-angular && npm run copy-files",
"build:keycloak-angular": "ng build keycloak-angular",
"test": "ng test",
"lint": "ng lint"
},
Expand Down Expand Up @@ -71,7 +70,7 @@
"tsickle": ">=0.25.5",
"tslib": "^1.7.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2",
"typescript": "~2.4.2",
"zone.js": "^0.8.26"
}
}
3 changes: 1 addition & 2 deletions projects/keycloak-angular/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"lib": {
"entryFile": "src/public_api.ts",
"umdModuleIds": {
"keycloak-js": "Keycloak",
"rxjs": "rxjs"
"keycloak-js": "Keycloak"
}
},
"whitelistedNonPeerDependencies": ["keycloak-js"]
Expand Down
8 changes: 2 additions & 6 deletions projects/keycloak-angular/ng-package.prod.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/lib",
"dest": "../../dist/keycloak-angular",
"deleteDestPath": true,
"lib": {
"entryFile": "src/public_api.ts",
"umdModuleIds": {
"keycloak-js": "Keycloak",
"rxjs": "rxjs"
}
"entryFile": "src/public_api.ts"
}
}
1 change: 1 addition & 0 deletions projects/keycloak-angular/src/lib/core/core.module.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Use of this source code is governed by a MIT-style license that can be
* found in the LICENSE file at https://github.com/mauriciovigolo/keycloak-angular/LICENSE
*/

import { CoreModule } from './core.module';

describe('CoreModule', () => {
Expand Down
7 changes: 4 additions & 3 deletions projects/keycloak-angular/src/lib/core/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
* Use of this source code is governed by a MIT-style license that can be
* found in the LICENSE file at https://github.com/mauriciovigolo/keycloak-angular/LICENSE
*/

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HTTP_INTERCEPTORS } from '@angular/common/http';

import { CORE_SERVICES } from './services';
import { KeycloakBearerInterceptor } from './interceptors';
import { KeycloakService } from './services/keycloak.service';
import { KeycloakBearerInterceptor } from './interceptors/keycloak-bearer.interceptor';

@NgModule({
imports: [CommonModule],
providers: [
CORE_SERVICES,
KeycloakService,
{
provide: HTTP_INTERCEPTORS,
useClass: KeycloakBearerInterceptor,
Expand Down
8 changes: 0 additions & 8 deletions projects/keycloak-angular/src/lib/core/interceptors/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Use of this source code is governed by a MIT-style license that can be
* found in the LICENSE file at https://github.com/mauriciovigolo/keycloak-angular/LICENSE
*/

import { TestBed, inject } from '@angular/core/testing';

import { KeycloakBearerInterceptor } from './keycloak-bearer.interceptor';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Use of this source code is governed by a MIT-style license that can be
* found in the LICENSE file at https://github.com/mauriciovigolo/keycloak-angular/LICENSE
*/

import { Injectable } from '@angular/core';
import {
HttpInterceptor,
Expand All @@ -14,10 +15,10 @@ import {
HttpHeaders
} from '@angular/common/http';

import { Observable } from 'rxjs';
import { mergeMap } from 'rxjs/operators';
import { Observable } from 'rxjs/Observable';
import { mergeMap } from 'rxjs/operators/mergeMap';

import { KeycloakService } from '../services';
import { KeycloakService } from '../services/keycloak.service';

/**
* This interceptor includes the bearer by default in all HttpClient requests.
Expand Down
11 changes: 0 additions & 11 deletions projects/keycloak-angular/src/lib/core/interfaces/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Mauricio Gemelli Vigolo and contributors.
*
* Use of this source code is governed by a MIT-style license that can be
* found in the LICENSE file at https://github.com/mauriciovigolo/keycloak-angular/LICENSE
*/

/**
* Keycloak onload options: 'login-required' or 'check-sso'
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Use of this source code is governed by a MIT-style license that can be
* found in the LICENSE file at https://github.com/mauriciovigolo/keycloak-angular/LICENSE
*/

import { KeycloakInitOptions } from './keycloak-init-options';
import { KeycloakConfig } from './keycloak-config';

Expand Down
13 changes: 0 additions & 13 deletions projects/keycloak-angular/src/lib/core/services/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
* Use of this source code is governed by a MIT-style license that can be
* found in the LICENSE file at https://github.com/mauriciovigolo/keycloak-angular/LICENSE
*/

import { CanActivate, Router, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';

import { KeycloakService } from './keycloak.service';

/**
Expand All @@ -24,7 +26,7 @@ export abstract class KeycloakAuthGuard implements CanActivate {
*/
protected roles: string[];

constructor(protected router: Router, protected keycloakAngular: KeycloakService) { }
constructor(protected router: Router, protected keycloakAngular: KeycloakService) {}

/**
* CanActivate checks if the user is logged in and get the full list of roles (REALM + CLIENT)
Expand Down Expand Up @@ -58,4 +60,4 @@ export abstract class KeycloakAuthGuard implements CanActivate {
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
): Promise<boolean>;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Use of this source code is governed by a MIT-style license that can be
* found in the LICENSE file at https://github.com/mauriciovigolo/keycloak-angular/LICENSE
*/

import { TestBed, inject } from '@angular/core/testing';

import { KeycloakService } from './keycloak.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@
* Use of this source code is governed by a MIT-style license that can be
* found in the LICENSE file at https://github.com/mauriciovigolo/keycloak-angular/LICENSE
*/

import { Injectable } from '@angular/core';

import { HttpHeaders } from '@angular/common/http';

// Workaround for rollup library behaviour, as pointed out on issue #1267 (https://github.com/rollup/rollup/issues/1267).
import * as Keycloak_ from 'keycloak-js';
export const Keycloak = Keycloak_;

import { Observable, Observer, Subject } from 'rxjs';
import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
import { Subject } from 'rxjs/Subject';

import { KeycloakOptions, KeycloakEvent, KeycloakEventType } from '../interfaces';
import { KeycloakOptions } from '../interfaces/keycloak-options';
import { KeycloakEvent, KeycloakEventType } from '../interfaces/keycloak-event';

/**
* Service to expose existent methods from the Keycloak JS adapter, adding new
Expand Down
3 changes: 2 additions & 1 deletion projects/keycloak-angular/src/lib/keycloak-angular.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
* Use of this source code is governed by a MIT-style license that can be
* found in the LICENSE file at https://github.com/mauriciovigolo/keycloak-angular/LICENSE
*/

import { NgModule } from '@angular/core';

import { CoreModule } from './core/core.module';

@NgModule({
imports: [CoreModule]
})
export class KeycloakAngularModule { }
export class KeycloakAngularModule {}
14 changes: 10 additions & 4 deletions projects/keycloak-angular/src/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
* Use of this source code is governed by a MIT-style license that can be
* found in the LICENSE file at https://github.com/mauriciovigolo/keycloak-angular/LICENSE
*/
export * from './lib/core/interceptors';
export * from './lib/core/interfaces';
export * from './lib/core/services';
export * from './lib/keycloak-angular.module';

export { KeycloakConfig } from './lib/core/interfaces/keycloak-config';
export { KeycloakEvent, KeycloakEventType } from './lib/core/interfaces/keycloak-event';
export { KeycloakInitOptions } from './lib/core/interfaces/keycloak-init-options';
export { KeycloakOptions } from './lib/core/interfaces/keycloak-options';
export { KeycloakAuthGuard } from './lib/core/services/keycloak-auth-guard';
export { KeycloakService, Keycloak } from './lib/core/services/keycloak.service';
export { KeycloakBearerInterceptor } from './lib/core/interceptors/keycloak-bearer.interceptor';
export { CoreModule } from './lib/core/core.module';
export { KeycloakAngularModule } from './lib/keycloak-angular.module';
13 changes: 9 additions & 4 deletions projects/keycloak-angular/src/test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Mauricio Gemelli Vigolo and contributors.
*
* Use of this source code is governed by a MIT-style license that can be
* found in the LICENSE file at https://github.com/mauriciovigolo/keycloak-angular/LICENSE
*/

// This file is required by karma.conf.js and loads recursively all the .spec and framework files

import 'core-js/es7/reflect';
Expand All @@ -12,10 +20,7 @@ import {
declare const require: any;

// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
Expand Down
11 changes: 2 additions & 9 deletions projects/keycloak-angular/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"module": "es2015",
"moduleResolution": "node",
Expand All @@ -12,10 +11,7 @@
"experimentalDecorators": true,
"importHelpers": true,
"types": [],
"lib": [
"dom",
"es2015"
]
"lib": ["dom", "es2015"]
},
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
Expand All @@ -26,8 +22,5 @@
"flatModuleId": "AUTOGENERATED",
"flatModuleOutFile": "AUTOGENERATED"
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
"exclude": ["src/test.ts", "**/*.spec.ts"]
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"declaration": true,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
Expand Down

0 comments on commit 6ca5012

Please sign in to comment.