Skip to content

Commit

Permalink
Merge pull request #23 from mpalourdio/sub-modules
Browse files Browse the repository at this point in the history
sub-modules split. Fixes #20
  • Loading branch information
mpalourdio authored Nov 6, 2017
2 parents 3a6b5f1 + f0f3af1 commit 1c455a6
Show file tree
Hide file tree
Showing 51 changed files with 214 additions and 127 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ tmp
*.iml
dist
coverage
.idea/
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ coverage
.travis.yml
gulpfile.js
karma.conf.js
main.ts
polyfills.ts
test.ts
tsconfig.json
Expand All @@ -20,3 +21,4 @@ tsconfig.spec.json
tslint.json
yarn.lock
*.iml
.idea/
28 changes: 28 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## v0.5.0

The module is now splitted in sub-modules for more convenience. See [usage](https://github.com/mpalourdio/ng-http-loader#usage).
It's an **opt-in** feature. The "old" module import method, by simply declaring ``NgHttpLoaderModule``, is still fully supported.

**BC break** : paths of components and services have changed.
- Components are now located in the ``components`` folders.
- Services are now located in the ``services`` folders.

## v0.4.0

Added **angular 5** full support. The last version compatible with angular 4 is ``version 0.3.4``

## v0.3.4

Fixed default spinners background.

## v0.3.0

This release gives the possibility to filter http requests that should not be handled by the interceptor by providing an array of URL regex to the component's ``filteredUrlPatterns`` property.

## v0.2.0

Definitely switch to the new HttpClientModule api available from angular 4.3

## v0.1.0

Before completely removing HttpInterceptorService, provide a parallel implementation based on the new built-in angular 4.3 intercepto
31 changes: 31 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

# ng-http-loader

## Changelog

[Please read the changelog](CHANGELOG.MD)

## Installation

To install this library, run:
Expand Down Expand Up @@ -62,6 +66,33 @@ import { NgHttpLoaderModule } from 'ng-http-loader/ng-http-loader.module'; <====
export class AppModule { }
```

or (splitted modules mode for more convenience)

```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
[...]
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http'; <============
import { NgHttpLoaderComponentsModule } from 'ng-http-loader/components/ng-http-loader-components.module'; <============
import { NgHttpLoaderServicesModule } from 'ng-http-loader/services/ng-http-loader-services.module'; <============

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
HttpClientModule, <============ (Perform http requests with this module)
NgHttpLoaderServicesModule, <============
NgHttpLoaderComponentsModule, <============
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
```

In your app.component.html, add :
```xml
<spinner></spinner>
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ gulp.task('copy-package-json', function () {
});

gulp.task('copy-misc-files', function () {
return gulp.src(['README.MD', 'LICENSE'])
return gulp.src(['README.MD', 'LICENSE', 'CHANGELOG.MD'])
.pipe(gulp.dest(distDir));
});

Expand Down
21 changes: 12 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-http-loader",
"version": "0.4.0",
"version": "0.5.0",
"scripts": {
"prepare-deploy": "gulp inline-templates && gulp clean-dist && ngc -p tsconfig.ngc.json && gulp clean-tmp && gulp copy-all",
"test": "ng test --watch false"
Expand Down Expand Up @@ -28,24 +28,25 @@
"bugs": {
"url": "https://github.com/mpalourdio/ng-http-loader/issues"
},
"dependencies": {
"peerDependencies": {
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.5.2",
"zone.js": "^0.8.14"
"rxjs": "^5.5.2"
},
"devDependencies": {
"@angular/cli": "^1.5.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/language-service": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "~3.2.0",
"core-js": "^2.4.1",
"gulp": "^3.9.1",
"gulp-clean": "^0.3.2",
"gulp-inline-ng2-template": "^4.0.0",
Expand All @@ -60,8 +61,10 @@
"karma-phantomjs-launcher": "^1.0.4",
"phantomjs-prebuilt": "^2.1.14",
"protractor": "~5.1.2",
"rxjs": "^5.5.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.4.2"
"typescript": "~2.4.2",
"zone.js": "^0.8.14"
}
}
File renamed without changes.
22 changes: 22 additions & 0 deletions src/components/ng-http-loader-components.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HttpClientModule } from '@angular/common/http';
import { SpinnerComponent } from './spinner/spinner.component';
import { SPINKIT_COMPONENTS } from '../spinkits';

@NgModule({
declarations: [
SpinnerComponent,
SPINKIT_COMPONENTS,
],
imports: [
CommonModule,
HttpClientModule,
],
exports: [
SpinnerComponent,
SPINKIT_COMPONENTS,
],
})
export class NgHttpLoaderComponentsModule {
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { Subscription } from 'rxjs/Subscription';
import { Spinkit } from '../spinkits';
import { PendingInterceptorService } from '../pending-interceptor.service';
import { Spinkit } from '../../spinkits';
import { PendingInterceptorService } from '../../services/pending-interceptor.service';

@Component({
selector: 'spinner',
Expand Down
27 changes: 6 additions & 21 deletions src/ng-http-loader.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,20 @@
*/

import { NgModule } from '@angular/core';
import { SpinnerComponent } from './spinner/spinner.component';
import { CommonModule } from '@angular/common';
import { PendingInterceptorService, PendingInterceptorServiceFactoryProvider } from './pending-interceptor.service';
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
import { SPINKIT_COMPONENTS } from './spinkits';

const PendingInterceptorServiceExistingProvider = {
provide: HTTP_INTERCEPTORS,
useExisting: PendingInterceptorService,
multi: true
};
import { NgHttpLoaderComponentsModule } from './components/ng-http-loader-components.module';
import { NgHttpLoaderServicesModule } from './services/ng-http-loader-services.module';

@NgModule({
declarations: [
SpinnerComponent,
SPINKIT_COMPONENTS,
],
imports: [
CommonModule,
HttpClientModule,
NgHttpLoaderComponentsModule,
NgHttpLoaderServicesModule,
],
exports: [
SpinnerComponent,
SPINKIT_COMPONENTS,
NgHttpLoaderComponentsModule,
NgHttpLoaderServicesModule,
],
providers: [
PendingInterceptorServiceExistingProvider,
PendingInterceptorServiceFactoryProvider,
]
})
export class NgHttpLoaderModule {
}
22 changes: 22 additions & 0 deletions src/services/ng-http-loader-services.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { PendingInterceptorService, PendingInterceptorServiceFactoryProvider } from './pending-interceptor.service';

const PendingInterceptorServiceExistingProvider = {
provide: HTTP_INTERCEPTORS,
useExisting: PendingInterceptorService,
multi: true
};

@NgModule({
imports: [
CommonModule
],
providers: [
PendingInterceptorServiceExistingProvider,
PendingInterceptorServiceFactoryProvider,
],
})
export class NgHttpLoaderServicesModule {
}
File renamed without changes.
17 changes: 8 additions & 9 deletions src/spinkits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

import { SkCubeGridComponent } from './sk-cube-grid/sk-cube-grid.component';
import { SkChasingDotsComponent } from './sk-chasing-dots/sk-chasing-dots.component';
import { SkDoubleBounceComponent } from './sk-double-bounce/sk-double-bounce.component';
import { SkRotatingPlaneComponent } from './sk-rotating-plane/sk-rotating-plane.component';
import { SkSpinnerPulseComponent } from './sk-spinner-pulse/sk-spinner-pulse.component';
import { SkThreeBounceComponent } from './sk-three-bounce/sk-three-bounce.component';
import { SkWanderingCubesComponent } from './sk-wandering-cubes/sk-wandering-cubes.component';
import { SkWaveComponent } from './sk-wave/sk-wave.component';
import { SkCubeGridComponent } from './components/sk-cube-grid/sk-cube-grid.component';
import { SkChasingDotsComponent } from './components/sk-chasing-dots/sk-chasing-dots.component';
import { SkDoubleBounceComponent } from './components/sk-double-bounce/sk-double-bounce.component';
import { SkRotatingPlaneComponent } from './components/sk-rotating-plane/sk-rotating-plane.component';
import { SkSpinnerPulseComponent } from './components/sk-spinner-pulse/sk-spinner-pulse.component';
import { SkThreeBounceComponent } from './components/sk-three-bounce/sk-three-bounce.component';
import { SkWanderingCubesComponent } from './components/sk-wandering-cubes/sk-wandering-cubes.component';
import { SkWaveComponent } from './components/sk-wave/sk-wave.component';

export const Spinkit = {
skChasingDots: 'sk-chasing-dots',
Expand All @@ -27,7 +27,6 @@ export const Spinkit = {
skWave: 'sk-wave',
};


export const SPINKIT_COMPONENTS = [
SkCubeGridComponent,
SkChasingDotsComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SkChasingDotsComponent } from '../../src/sk-chasing-dots/sk-chasing-dots.component';
import { SkChasingDotsComponent } from '../../../src/components/sk-chasing-dots/sk-chasing-dots.component';


describe('SkChasingDotsComponent', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SkCubeGridComponent } from '../../src/sk-cube-grid/sk-cube-grid.component';
import { SkCubeGridComponent } from '../../../src/components/sk-cube-grid/sk-cube-grid.component';


describe('SkCubeGridComponent', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SkDoubleBounceComponent } from '../../src/sk-double-bounce/sk-double-bounce.component';
import { SkDoubleBounceComponent } from '../../../src/components/sk-double-bounce/sk-double-bounce.component';


describe('SkDoubleBounceComponent', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SkRotatingPlaneComponent } from '../../src/sk-rotating-plane/sk-rotating-plane.component';
import { SkRotatingPlaneComponent } from '../../../src/components/sk-rotating-plane/sk-rotating-plane.component';


describe('SkRotatingPlaneComponent', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SkSpinnerPulseComponent } from '../../src/sk-spinner-pulse/sk-spinner-pulse.component';
import { SkSpinnerPulseComponent } from '../../../src/components/sk-spinner-pulse/sk-spinner-pulse.component';


describe('SkSpinnerPulseComponent', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SkThreeBounceComponent } from '../../src/sk-three-bounce/sk-three-bounce.component';
import { SkThreeBounceComponent } from '../../../src/components/sk-three-bounce/sk-three-bounce.component';


describe('SkThreeBounceComponent', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SkWanderingCubesComponent } from '../../src/sk-wandering-cubes/sk-wandering-cubes.component';
import { SkWanderingCubesComponent } from '../../../src/components/sk-wandering-cubes/sk-wandering-cubes.component';


describe('SkWanderingCubesComponent', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SkWaveComponent } from '../../src/sk-wave/sk-wave.component';
import { SkWaveComponent } from '../../../src/components/sk-wave/sk-wave.component';


describe('SkWaveComponent', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,24 @@
*/

import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing';
import { SpinnerComponent } from '../../src/spinner/spinner.component';
import { SpinnerComponent } from '../../../src/components/spinner/spinner.component';
import { By } from '@angular/platform-browser';
import { Spinkit, SPINKIT_COMPONENTS } from '../../src/spinkits';
import { Spinkit, SPINKIT_COMPONENTS } from '../../../src/spinkits';
import { Observable } from 'rxjs/Observable';
import { PendingInterceptorService } from '../../src/pending-interceptor.service';
import { HTTP_INTERCEPTORS, HttpClient } from '@angular/common/http';
import { PendingInterceptorService } from '../../../src/services/pending-interceptor.service';
import { HttpClient } from '@angular/common/http';
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { NgHttpLoaderServicesModule } from '../../../src/services/ng-http-loader-services.module';
import 'rxjs/add/observable/forkJoin';

describe('SpinnerComponent', () => {
let component: SpinnerComponent;
let fixture: ComponentFixture<SpinnerComponent>;

const PendingInterceptorServiceExistingProvider = {
provide: HTTP_INTERCEPTORS,
useExisting: PendingInterceptorService,
multi: true
};

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [SpinnerComponent, SPINKIT_COMPONENTS],
providers: [
PendingInterceptorService,
PendingInterceptorServiceExistingProvider,
],
imports: [HttpClientTestingModule]
imports: [NgHttpLoaderServicesModule, HttpClientTestingModule]
})
.compileComponents();
}));
Expand Down
Loading

0 comments on commit 1c455a6

Please sign in to comment.