Skip to content

Commit 32ff534

Browse files
authored
Merge pull request #72 from mpalourdio/ng-packagr
Fixes #35 #61 #67
2 parents 68f97ed + 65a1692 commit 32ff534

File tree

62 files changed

+673
-1378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+673
-1378
lines changed

.npmignore

Lines changed: 0 additions & 24 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## v2.0.0
4+
5+
The module bundling now uses [ng-packagr](https://github.com/dherges/ng-packagr).
6+
From now, you must use ``import { xxxxxxx } from 'ng-http-loader'`` without referencing the full path.
7+
8+
Also, ``NgHttpLoaderServicesModule`` && ``NgHttpLoaderComponentsModule`` have been removed and merged back to ``NgHttpLoaderModule``.
9+
The ``injectables`` now take advantage of the new [Tree Shakable Providers features](https://blog.angular.io/version-6-of-angular-now-available-cc56b0efa7a4).
10+
The integration in much cleaner, particularly with lazy loaded modules, and avoids the static ``forRoot()`` boilerplate.
11+
312
## v1.0.3
413

514
Some compiler options have been reverted, so the compilation target is ``es5`` like before v1.0.2.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2017 mpalourdio
3+
Copyright (c) 2018 mpalourdio
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of
66
this software and associated documentation files (the "Software"), to deal in

README.md

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Use the fork, Luke. PR without tests will likely not be merged.
1717
To install this library, run:
1818

1919
```bash
20-
$ npm install ng-http-loader --save
20+
$ npm install ng-http-loader --save / yarn add ng-http-loader
2121
```
2222

2323
## What does it do ?
@@ -32,12 +32,11 @@ If you want to use Angular 5, use versions **``0.4.0``** and above.
3232

3333
The latest compatible version with angular 5 is version **``0.9.1``**.
3434

35-
From version **``1.0.0``**, the module is angular 6 / RxJS 6 compatible only.
35+
Versions **``1.0.0+``** and **``2.0.0+``** are angular 6 / RxJS 6 compatible only.
3636

3737
If you experience errors like below, **please double check the version you use.**
3838

39-
``ERROR in Error: Metadata version mismatch for module [...]/angular/node_modules/ng-http-loader/ng-http-loader
40-
.module.d.ts, found version x, expected y, resolving symbol AppModule in [...]/angular/src/app.module.ts``
39+
``ERROR in Error: Metadata version mismatch for module [...]/angular/node_modules/ng-http-loader/ng-http-loader.module.d.ts, found version x, expected y [...]``
4140

4241
## Requirements - HttpClientModule
4342

@@ -55,7 +54,7 @@ import { NgModule } from '@angular/core';
5554
[...]
5655
import { AppComponent } from './app.component';
5756
import { HttpClientModule } from '@angular/common/http'; <============
58-
import { NgHttpLoaderModule } from 'ng-http-loader/ng-http-loader.module'; <============
57+
import { NgHttpLoaderModule } from 'ng-http-loader'; <============
5958

6059
@NgModule({
6160
declarations: [
@@ -72,33 +71,6 @@ import { NgHttpLoaderModule } from 'ng-http-loader/ng-http-loader.module'; <====
7271
export class AppModule { }
7372
```
7473

75-
or (splitted modules mode for more convenience)
76-
77-
```typescript
78-
import { BrowserModule } from '@angular/platform-browser';
79-
import { NgModule } from '@angular/core';
80-
[...]
81-
import { AppComponent } from './app.component';
82-
import { HttpClientModule } from '@angular/common/http'; <============
83-
import { NgHttpLoaderComponentsModule } from 'ng-http-loader/components/ng-http-loader-components.module'; <============
84-
import { NgHttpLoaderServicesModule } from 'ng-http-loader/services/ng-http-loader-services.module'; <============
85-
86-
@NgModule({
87-
declarations: [
88-
AppComponent
89-
],
90-
imports: [
91-
BrowserModule,
92-
HttpClientModule, <============ (Perform http requests with this module)
93-
NgHttpLoaderServicesModule, <============
94-
NgHttpLoaderComponentsModule, <============
95-
],
96-
providers: [],
97-
bootstrap: [AppComponent]
98-
})
99-
export class AppModule { }
100-
```
101-
10274
In your app.component.html, simply add :
10375
```xml
10476
<spinner></spinner>
@@ -119,7 +91,7 @@ You can customize the **background-color**, the **spinner type** and the **debou
11991
**_To use this syntax, you must reference the ``Spinkit`` const as a public property in your app.component.ts_**:
12092

12193
```typescript
122-
import { Spinkit } from 'ng-http-loader/spinkits'; <============
94+
import { Spinkit } from 'ng-http-loader'; <============
12395

12496
@Component({
12597
selector: 'app-root',
@@ -131,7 +103,7 @@ export class AppComponent {
131103
[...]
132104
}
133105
```
134-
The different spinners available are referenced in [this class](src/spinkits.ts).
106+
The different spinners available are referenced in [this class](src/lib/spinkits.ts).
135107

136108

137109
**_Otherwise, you can simply reference the chosen spinner as a simple string_**:
@@ -170,7 +142,7 @@ Sometimes, when manually showing the spinner, an http request could be performed
170142
**For this reason, when calling ``SpinnerVisibilityService#show()``, it prevents the http interceptor from being triggered unless you explicitly call ``SpinnerVisibilityService#hide()``.**
171143

172144
```typescript
173-
import { SpinnerVisibilityService } from 'ng-http-loader/services/spinner-visibility.service';
145+
import { SpinnerVisibilityService } from 'ng-http-loader';
174146

175147
@Component({
176148
selector: 'my-component',
@@ -193,8 +165,9 @@ export class MyComponent {
193165

194166
## Misc
195167

196-
Each Spinkit component defined in [SPINKIT_COMPONENTS](src/spinkits.ts#L30) can be used independently.
168+
Each Spinkit component defined in [SPINKIT_COMPONENTS](src/lib/spinkits.ts#L30) can be used independently.
197169

198170
## Credits
199171

200-
[Tobias Ahlin](https://github.com/tobiasahlin), the awesome creator of [SpinKit](https://github.com/tobiasahlin/SpinKit).
172+
[Tobias Ahlin](https://github.com/tobiasahlin), the awesome creator of [SpinKit](https://github.com/tobiasahlin/SpinKit).
173+
[David Herges](https://github.com/dherges), the awesome developer of [ng-packagr](https://github.com/dherges/ng-packagr).

angular.json

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,34 @@
88
"sourceRoot": "src",
99
"projectType": "library",
1010
"architect": {
11+
"build": {
12+
"builder": "@angular-devkit/build-ng-packagr:build",
13+
"options": {
14+
"tsConfig": "./tsconfig.lib.json",
15+
"project": "./ng-package.json"
16+
}
17+
},
1118
"test": {
1219
"builder": "@angular-devkit/build-angular:karma",
1320
"options": {
14-
"main": "./test.ts",
21+
"main": "./src/test.ts",
1522
"karmaConfig": "./karma.conf.js",
1623
"polyfills": "./polyfills.ts",
1724
"tsConfig": "./tsconfig.spec.json",
1825
"watch": false
1926
}
27+
},
28+
"lint": {
29+
"builder": "@angular-devkit/build-angular:tslint",
30+
"options": {
31+
"tsConfig": [
32+
"./tsconfig.lib.json",
33+
"./tsconfig.spec.json"
34+
],
35+
"exclude": [
36+
"**/node_modules/**"
37+
]
38+
}
2039
}
2140
}
2241
}

gulpfile.js

Lines changed: 0 additions & 71 deletions
This file was deleted.

main.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

ng-package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "./node_modules/ng-packagr/ng-package.schema.json",
3+
"dest": "./dist",
4+
"lib": {
5+
"entryFile": "./src/public_api.ts"
6+
}
7+
}

package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{
22
"name": "ng-http-loader",
3-
"version": "1.0.3",
3+
"version": "2.0.0",
44
"scripts": {
5-
"prepare-deploy": "gulp inline-templates && gulp clean-dist && ngc -p tsconfig.ngc.json && gulp clean-tmp && gulp copy-all",
6-
"test": "ng test"
5+
"ng": "ng",
6+
"build": "ng build",
7+
"test": "ng test",
8+
"lint": "ng lint"
79
},
810
"repository": {
911
"type": "git",
@@ -36,6 +38,7 @@
3638
},
3739
"devDependencies": {
3840
"@angular-devkit/build-angular": "~0.6.0",
41+
"@angular-devkit/build-ng-packagr": "~0.6.0",
3942
"@angular/cli": "^6.0.0",
4043
"@angular/common": "^6.0.0",
4144
"@angular/compiler": "^6.0.0",
@@ -49,9 +52,6 @@
4952
"@types/node": "~8.9.4",
5053
"codelyzer": "~4.2.1",
5154
"core-js": "^2.5.4",
52-
"gulp": "^3.9.1",
53-
"gulp-clean": "^0.3.2",
54-
"gulp-inline-ng2-template": "^4.0.0",
5555
"jasmine-core": "~2.99.1",
5656
"jasmine-spec-reporter": "~4.2.1",
5757
"karma": "~2.0.0",
@@ -60,10 +60,12 @@
6060
"karma-jasmine": "~1.1.1",
6161
"karma-jasmine-html-reporter": "^0.2.2",
6262
"karma-phantomjs-launcher": "^1.0.4",
63+
"ng-packagr": "^3.0.0-rc.5",
6364
"phantomjs-prebuilt": "^2.1.14",
64-
"protractor": "~5.3.0",
6565
"rxjs": "^6.0.0",
6666
"ts-node": "~5.0.1",
67+
"tsickle": ">=0.25.5",
68+
"tslib": "^1.9.0",
6769
"tslint": "~5.9.1",
6870
"typescript": "~2.7.2",
6971
"zone.js": "^0.8.26"

0 commit comments

Comments
 (0)