@@ -8,12 +8,11 @@ import {
8
8
Tree
9
9
} from '@angular-devkit/schematics' ;
10
10
import { FileSystemHost } from '@angular-devkit/schematics/tools' ;
11
- import { Observable } from 'rxjs/Observable ' ;
11
+ import { of as observableOf } from 'rxjs/observable/of ' ;
12
12
import * as path from 'path' ;
13
13
import chalk from 'chalk' ;
14
14
import { CliConfig } from '../models/config' ;
15
- import 'rxjs/add/operator/concatMap' ;
16
- import 'rxjs/add/operator/map' ;
15
+ import { concat , concatMap , ignoreElements , map } from 'rxjs/operators' ;
17
16
import { getCollection , getSchematic } from '../utilities/schematics' ;
18
17
19
18
const { green, red, yellow } = chalk ;
@@ -58,7 +57,7 @@ export default Task.extend({
58
57
const opts = { ...taskOptions , ...preppedOptions } ;
59
58
60
59
const tree = emptyHost ? new EmptyTree ( ) : new FileSystemTree ( new FileSystemHost ( workingDir ) ) ;
61
- const host = Observable . of ( tree ) ;
60
+ const host = observableOf ( tree ) ;
62
61
63
62
const dryRunSink = new DryRunSink ( workingDir , opts . force ) ;
64
63
const fsSink = new FileSystemSink ( workingDir , opts . force ) ;
@@ -111,22 +110,26 @@ export default Task.extend({
111
110
} ) ;
112
111
113
112
return new Promise ( ( resolve , reject ) => {
114
- schematic . call ( opts , host )
115
- . map ( ( tree : Tree ) => Tree . optimize ( tree ) )
116
- . concatMap ( ( tree : Tree ) => {
117
- return dryRunSink . commit ( tree ) . ignoreElements ( ) . concat ( Observable . of ( tree ) ) ;
118
- } )
119
- . concatMap ( ( tree : Tree ) => {
113
+ schematic . call ( opts , host ) . pipe (
114
+ map ( ( tree : Tree ) => Tree . optimize ( tree ) ) ,
115
+ concatMap ( ( tree : Tree ) => {
116
+ return dryRunSink . commit ( tree ) . pipe (
117
+ ignoreElements ( ) ,
118
+ concat ( observableOf ( tree ) ) ) ;
119
+ } ) ,
120
+ concatMap ( ( tree : Tree ) => {
120
121
if ( ! error ) {
121
122
// Output the logging queue.
122
123
loggingQueue . forEach ( log => ui . writeLine ( ` ${ log . color ( log . keyword ) } ${ log . message } ` ) ) ;
123
124
}
124
125
125
126
if ( opts . dryRun || error ) {
126
- return Observable . of ( tree ) ;
127
+ return observableOf ( tree ) ;
127
128
}
128
- return fsSink . commit ( tree ) . ignoreElements ( ) . concat ( Observable . of ( tree ) ) ;
129
- } )
129
+ return fsSink . commit ( tree ) . pipe (
130
+ ignoreElements ( ) ,
131
+ concat ( observableOf ( tree ) ) ) ;
132
+ } ) )
130
133
. subscribe ( {
131
134
error ( err ) {
132
135
ui . writeLine ( red ( `Error: ${ err . message } ` ) ) ;
0 commit comments