@@ -8,12 +8,11 @@ import {
88 Tree
99} from '@angular-devkit/schematics' ;
1010import { FileSystemHost } from '@angular-devkit/schematics/tools' ;
11- import { Observable } from 'rxjs/Observable ' ;
11+ import { of as observableOf } from 'rxjs/observable/of ' ;
1212import * as path from 'path' ;
1313import chalk from 'chalk' ;
1414import { 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' ;
1716import { getCollection , getSchematic } from '../utilities/schematics' ;
1817
1918const { green, red, yellow } = chalk ;
@@ -58,7 +57,7 @@ export default Task.extend({
5857 const opts = { ...taskOptions , ...preppedOptions } ;
5958
6059 const tree = emptyHost ? new EmptyTree ( ) : new FileSystemTree ( new FileSystemHost ( workingDir ) ) ;
61- const host = Observable . of ( tree ) ;
60+ const host = observableOf ( tree ) ;
6261
6362 const dryRunSink = new DryRunSink ( workingDir , opts . force ) ;
6463 const fsSink = new FileSystemSink ( workingDir , opts . force ) ;
@@ -111,22 +110,26 @@ export default Task.extend({
111110 } ) ;
112111
113112 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 ) => {
120121 if ( ! error ) {
121122 // Output the logging queue.
122123 loggingQueue . forEach ( log => ui . writeLine ( ` ${ log . color ( log . keyword ) } ${ log . message } ` ) ) ;
123124 }
124125
125126 if ( opts . dryRun || error ) {
126- return Observable . of ( tree ) ;
127+ return observableOf ( tree ) ;
127128 }
128- return fsSink . commit ( tree ) . ignoreElements ( ) . concat ( Observable . of ( tree ) ) ;
129- } )
129+ return fsSink . commit ( tree ) . pipe (
130+ ignoreElements ( ) ,
131+ concat ( observableOf ( tree ) ) ) ;
132+ } ) )
130133 . subscribe ( {
131134 error ( err ) {
132135 ui . writeLine ( red ( `Error: ${ err . message } ` ) ) ;
0 commit comments