@@ -15,7 +15,6 @@ import {
15
15
} from '@angular-devkit/core' ;
16
16
import {
17
17
Rule ,
18
- SchematicContext ,
19
18
SchematicsException ,
20
19
Tree ,
21
20
apply ,
@@ -26,7 +25,6 @@ import {
26
25
template ,
27
26
url ,
28
27
} from '@angular-devkit/schematics' ;
29
- import { Observable } from 'rxjs' ;
30
28
import { Readable , Writable } from 'stream' ;
31
29
import { Schema as PwaOptions } from './schema' ;
32
30
@@ -85,7 +83,7 @@ function updateIndexFile(path: string): Rule {
85
83
rewriter . emitEndTag ( endTag ) ;
86
84
} ) ;
87
85
88
- return new Observable < Tree > ( obs => {
86
+ return new Promise < void > ( resolve => {
89
87
const input = new Readable ( {
90
88
encoding : 'utf8' ,
91
89
read ( ) : void {
@@ -104,8 +102,7 @@ function updateIndexFile(path: string): Rule {
104
102
const full = Buffer . concat ( chunks ) ;
105
103
host . overwrite ( path , full . toString ( ) ) ;
106
104
callback ( ) ;
107
- obs . next ( host ) ;
108
- obs . complete ( ) ;
105
+ resolve ( ) ;
109
106
} ,
110
107
} ) ;
111
108
@@ -115,7 +112,7 @@ function updateIndexFile(path: string): Rule {
115
112
}
116
113
117
114
export default function ( options : PwaOptions ) : Rule {
118
- return ( host : Tree , context : SchematicContext ) => {
115
+ return ( host : Tree ) => {
119
116
if ( ! options . title ) {
120
117
options . title = options . project ;
121
118
}
@@ -210,6 +207,6 @@ export default function (options: PwaOptions): Rule {
210
207
mergeWith ( rootTemplateSource ) ,
211
208
mergeWith ( assetsTemplateSource ) ,
212
209
...[ ...indexFiles ] . map ( path => updateIndexFile ( path ) ) ,
213
- ] ) ( host , context ) ;
210
+ ] ) ;
214
211
} ;
215
212
}
0 commit comments