Skip to content

Commit 17f5543

Browse files
author
Victor
committed
feat(upgrade): updated all dependencies
1 parent a96cd2a commit 17f5543

File tree

8 files changed

+5439
-1474
lines changed

8 files changed

+5439
-1474
lines changed

example/app/stock-inventory/containers/stock-inventory/stock-inventory.component.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ import { FormBuilder, FormGroup, FormArray, Validators, AbstractControl } from '
33

44
import { StockValidators } from './stock-inventory.validators';
55

6-
import { Observable } from 'rxjs/Observable';
7-
import 'rxjs/add/observable/forkJoin';
8-
import 'rxjs/add/operator/map';
6+
import { Observable, forkJoin } from 'rxjs';
7+
import { map } from 'rxjs/operators';
98

109
import { StockInventoryService } from '../../services/stock-inventory.service';
1110

@@ -39,7 +38,7 @@ import { Product, Item } from '../../models/product.interface';
3938
</div>
4039
4140
<div class="stock-inventory__buttons">
42-
<button
41+
<button
4342
type="submit"
4443
[disabled]="form.invalid">
4544
Order stock
@@ -82,8 +81,7 @@ export class StockInventoryComponent implements OnInit {
8281
const cart = this.stockService.getCartItems();
8382
const products = this.stockService.getProducts();
8483

85-
Observable
86-
.forkJoin(cart, products)
84+
forkJoin(cart, products)
8785
.subscribe(([cart, products]: [Item[], Product[]]) => {
8886

8987
const myMap = products
@@ -103,8 +101,9 @@ export class StockInventoryComponent implements OnInit {
103101

104102
validateBranch(control: AbstractControl) {
105103
return this.stockService
106-
.checkBranchId(control.value)
107-
.map((response: boolean) => response ? null : { unknownBranch: true });
104+
.checkBranchId(control.value).pipe(
105+
map((response: boolean) => response ? null : { unknownBranch: true })
106+
)
108107
}
109108

110109
calculateTotal(value: Item[]) {
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Injectable } from '@angular/core';
22
import { Http, Response, URLSearchParams } from '@angular/http';
33

4-
import { Observable } from 'rxjs/Observable';
5-
import 'rxjs/add/observable/of';
4+
import { Observable } from 'rxjs';
5+
import { of } from 'rxjs';
66

77
import { Product, Item } from '../models/product.interface';
88

@@ -13,14 +13,14 @@ export class StockInventoryService {
1313
) {}
1414

1515
getCartItems(): Observable<Item[]> {
16-
return Observable.of([
16+
return of([
1717
{ "product_id": 1, "quantity": 10 },
1818
{ "product_id": 3, "quantity": 50 }
1919
]);
2020
}
2121

2222
getProducts(): Observable<Product[]> {
23-
return Observable.of([
23+
return of([
2424
{ "id": 1, "price": 2800, "name": "MacBook Pro" },
2525
{ "id": 2, "price": 50, "name": "USB-C Adaptor" },
2626
{ "id": 3, "price": 400, "name": "iPod" },
@@ -30,6 +30,6 @@ export class StockInventoryService {
3030
}
3131

3232
checkBranchId(id: string): Observable<boolean> {
33-
return Observable.of(true);
33+
return of(true);
3434
}
3535
}

package.json

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -22,47 +22,47 @@
2222
"test:watch": "karma start"
2323
},
2424
"devDependencies": {
25-
"@angular/compiler": "4.1.0",
26-
"@angular/compiler-cli": "4.1.0",
27-
"@types/jasmine": "2.5.46",
28-
"@types/karma": "0.13.34",
29-
"@types/node": "^7.0.12",
25+
"@angular/compiler": "6.0.3",
26+
"@angular/compiler-cli": "6.0.3",
27+
"@types/jasmine": "2.8.7",
28+
"@types/karma": "1.7.3",
29+
"@types/node": "^10.1.2",
3030
"angular2-template-loader": "0.6.2",
31-
"awesome-typescript-loader": "3.1.2",
32-
"file-loader": "0.11.1",
33-
"html-loader": "0.4.5",
34-
"jasmine-core": "2.5.2",
35-
"karma": "1.5.0",
36-
"karma-chrome-launcher": "2.0.0",
37-
"karma-jasmine": "1.1.0",
31+
"awesome-typescript-loader": "5.0.0",
32+
"file-loader": "1.1.11",
33+
"html-loader": "0.5.5",
34+
"jasmine-core": "3.1.0",
35+
"karma": "2.0.2",
36+
"karma-chrome-launcher": "2.2.0",
37+
"karma-jasmine": "1.1.2",
3838
"karma-sourcemap-loader": "0.3.7",
39-
"karma-spec-reporter": "0.0.28",
40-
"karma-webpack": "2.0.2",
41-
"node-sass": "4.5.2",
42-
"nodemon": "1.11.0",
39+
"karma-spec-reporter": "0.0.32",
40+
"karma-webpack": "3.0.0",
41+
"node-sass": "4.9.0",
42+
"nodemon": "1.17.5",
4343
"raw-loader": "0.5.1",
44-
"rimraf": "2.6.1",
45-
"rollup": "0.41.6",
46-
"rxjs": "5.3.0",
47-
"sass-loader": "6.0.3",
48-
"typescript": "2.3.1",
49-
"webpack": "2.4.1",
50-
"webpack-dev-server": "2.4.5",
51-
"zone.js": "0.8.9"
44+
"rimraf": "2.6.2",
45+
"rollup": "0.59.2",
46+
"sass-loader": "7.0.1",
47+
"typescript": "2.7.2",
48+
"uglifyjs-webpack-plugin": "^1.2.5",
49+
"webpack": "4.8.3",
50+
"webpack-cli": "^2.1.4",
51+
"webpack-dev-server": "3.1.4"
5252
},
5353
"dependencies": {
54-
"@angular/animations": "4.1.0",
55-
"@angular/common": "4.1.0",
56-
"@angular/core": "4.1.0",
57-
"@angular/forms": "4.1.0",
58-
"@angular/http": "4.1.0",
59-
"@angular/platform-browser": "4.1.0",
60-
"@angular/platform-browser-dynamic": "4.1.0",
61-
"@angular/router": "4.1.0",
62-
"core-js": "2.4.1",
63-
"reflect-metadata": "0.1.10",
64-
"rxjs": "5.3.0",
65-
"tslib": "1.6.1",
66-
"zone.js": "0.8.9"
54+
"@angular/animations": "6.0.3",
55+
"@angular/common": "6.0.3",
56+
"@angular/core": "6.0.3",
57+
"@angular/forms": "6.0.3",
58+
"@angular/http": "6.0.3",
59+
"@angular/platform-browser": "6.0.3",
60+
"@angular/platform-browser-dynamic": "6.0.3",
61+
"@angular/router": "6.0.3",
62+
"core-js": "2.5.6",
63+
"reflect-metadata": "0.1.12",
64+
"rxjs": "6.2.0",
65+
"tslib": "1.9.1",
66+
"zone.js": "0.8.26"
6767
}
6868
}

src/ngxerror.directive.ts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import { Directive, Input, OnInit, OnDestroy, DoCheck, Inject, HostBinding, forwardRef } from '@angular/core';
22

3-
import { Observable } from 'rxjs/Observable';
4-
import { Subject } from 'rxjs/Subject';
5-
import { Subscription } from 'rxjs/Subscription';
6-
import 'rxjs/add/operator/filter';
7-
import 'rxjs/add/operator/map';
8-
import 'rxjs/add/operator/distinctUntilChanged';
9-
import 'rxjs/add/observable/combineLatest';
3+
import { Observable, Subject, Subscription, combineLatest } from 'rxjs';
4+
5+
import { distinctUntilChanged, filter, map } from 'rxjs/operators';
6+
7+
108

119
import { NgxErrorsDirective } from './ngxerrors.directive';
1210

@@ -47,17 +45,18 @@ export class NgxErrorDirective implements OnInit, OnDestroy, DoCheck {
4745
ngOnInit() {
4846

4947
this._states = new Subject<string[]>();
50-
this.states = this._states.asObservable().distinctUntilChanged();
48+
this.states = this._states.asObservable().pipe(distinctUntilChanged());
5149

52-
const errors = this.ngxErrors.subject
53-
.filter(Boolean)
54-
.filter(obj => !!~this.errorNames.indexOf(obj.errorName));
50+
const errors = this.ngxErrors.subject.pipe(
51+
filter(Boolean),
52+
filter(obj => !!~this.errorNames.indexOf(obj.errorName))
53+
);
5554

56-
const states = this.states
57-
.map(states => this.rules.every(rule => !!~states.indexOf(rule)));
55+
const states = this.states.pipe(
56+
map(states => this.rules.every(rule => !!~states.indexOf(rule)))
57+
)
5858

59-
this.subscription = Observable.combineLatest(states, errors)
60-
.subscribe(([states, errors]) => {
59+
this.subscription = combineLatest(states, errors).subscribe(([states, errors]) => {
6160
this.hidden = !(states && errors.control.hasError(errors.errorName));
6261
});
6362

src/ngxerrors.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Directive, Input, OnChanges, OnDestroy, AfterViewInit } from '@angular/core';
22
import { FormGroupDirective, AbstractControl } from '@angular/forms';
33

4-
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
4+
import { BehaviorSubject } from 'rxjs';
55

66
import { ErrorDetails, ErrorOptions } from './ngxerrors';
77

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
"type": "git"
1313
},
1414
"peerDependencies": {
15-
"@angular/forms": "^2.3.1 || ^5.0.0"
15+
"@angular/forms": "^6.0.3"
1616
}
1717
}

webpack.config.js

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
const path = require('path');
22
const webpack = require('webpack');
3-
const typescript = require('typescript');
3+
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
44

55
const plugins = [
66
new webpack.DefinePlugin({
77
'process.env': {
8-
'NODE_ENV': JSON.stringify(process.env.NODE_ENV)
8+
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
99
}
10-
}),
11-
new webpack.optimize.CommonsChunkPlugin({
12-
name: 'vendor',
13-
minChunks: (module) => module.context && /node_modules/.test(module.context)
1410
})
1511
];
1612

@@ -19,36 +15,20 @@ if (process.env.NODE_ENV === 'production') {
1915
new webpack.LoaderOptionsPlugin({
2016
minimize: true,
2117
debug: false
22-
}),
23-
new webpack.optimize.UglifyJsPlugin({
24-
sourceMap: true,
25-
beautify: false,
26-
mangle: {
27-
screw_ie8: true
28-
},
29-
compress: {
30-
unused: true,
31-
dead_code: true,
32-
drop_debugger: true,
33-
conditionals: true,
34-
evaluate: true,
35-
drop_console: true,
36-
sequences: true,
37-
booleans: true,
38-
screw_ie8: true,
39-
warnings: false
40-
},
41-
comments: false
4218
})
4319
);
4420
} else {
4521
plugins.push(
4622
new webpack.NamedModulesPlugin(),
47-
new webpack.ContextReplacementPlugin(/angular(\\|\/)core(\\|\/)@angular/, path.resolve(__dirname, './notfound'))
23+
new webpack.ContextReplacementPlugin(
24+
/@angular(\\|\/)core(\\|\/)fesm5/,
25+
path.resolve(__dirname, './notfound')
26+
)
4827
);
4928
}
5029

5130
module.exports = {
31+
mode: 'production',
5232
cache: true,
5333
context: __dirname,
5434
devServer: {
@@ -74,7 +54,7 @@ module.exports = {
7454
},
7555
output: {
7656
filename: '[name].js',
77-
chunkFilename: '[name]-chunk.js',
57+
chunkFilename: '[name].js',
7858
publicPath: '/build/',
7959
path: path.resolve(__dirname, 'example/build')
8060
},
@@ -102,11 +82,43 @@ module.exports = {
10282
{
10383
test: /\.(jpe?g|png|gif|svg)$/i,
10484
loader: 'file-loader'
105-
},
85+
}
10686
]
10787
},
10888
resolve: {
10989
extensions: ['.ts', '.js']
11090
},
91+
stats: {
92+
colors: false,
93+
hash: true,
94+
timings: true,
95+
assets: true,
96+
chunks: true,
97+
chunkModules: true,
98+
modules: true,
99+
children: true
100+
},
101+
optimization: {
102+
minimizer: [
103+
new UglifyJsPlugin({
104+
sourceMap: true,
105+
uglifyOptions: {
106+
compress: {
107+
inline: false
108+
}
109+
}
110+
})
111+
],
112+
splitChunks: {
113+
cacheGroups: {
114+
vendor: {
115+
chunks: 'all',
116+
name: 'vendor',
117+
test: /[\\/]node_modules[\\/]/,
118+
enforce: true
119+
}
120+
}
121+
}
122+
},
111123
plugins
112124
};

0 commit comments

Comments
 (0)