File tree 4 files changed +29
-27
lines changed
angular_devkit/core/src/json/schema
4 files changed +29
-27
lines changed Original file line number Diff line number Diff line change @@ -39,24 +39,25 @@ export default class NewCommand extends SchematicCommand {
39
39
private schematicName = 'ng-new' ;
40
40
41
41
private initialized = false ;
42
- public initialize ( options : any ) {
42
+ public async initialize ( options : any ) {
43
43
if ( this . initialized ) {
44
- return Promise . resolve ( ) ;
44
+ return ;
45
45
}
46
- super . initialize ( options ) ;
46
+
47
+ await super . initialize ( options ) ;
48
+
47
49
this . initialized = true ;
48
50
49
51
const collectionName = this . parseCollectionName ( options ) ;
50
52
51
- return this . getOptions ( {
52
- schematicName : this . schematicName ,
53
- collectionName,
54
- } )
55
- . then ( ( schematicOptions ) => {
56
- this . options = this . options . concat ( schematicOptions . options ) ;
57
- const args = schematicOptions . arguments . map ( arg => arg . name ) ;
58
- this . arguments = this . arguments . concat ( args ) ;
59
- } ) ;
53
+ const schematicOptions = await this . getOptions ( {
54
+ schematicName : this . schematicName ,
55
+ collectionName,
56
+ } ) ;
57
+
58
+ this . options = this . options . concat ( schematicOptions . options ) ;
59
+ const args = schematicOptions . arguments . map ( arg => arg . name ) ;
60
+ this . arguments = this . arguments . concat ( args ) ;
60
61
}
61
62
62
63
public async run ( options : any ) {
Original file line number Diff line number Diff line change @@ -14,13 +14,15 @@ function syncObs<T>(obs: Observable<T>): T {
14
14
let value : T ;
15
15
let set = false ;
16
16
17
- obs . forEach ( x => {
18
- if ( set ) {
19
- throw new Error ( 'Multiple value.' ) ;
20
- }
21
- value = x ;
22
- set = true ;
23
- } ) ;
17
+ obs
18
+ . forEach ( x => {
19
+ if ( set ) {
20
+ throw new Error ( 'Multiple value.' ) ;
21
+ }
22
+ value = x ;
23
+ set = true ;
24
+ } )
25
+ . catch ( err => fail ( err ) ) ;
24
26
25
27
if ( ! set ) {
26
28
throw new Error ( 'Async observable.' ) ;
Original file line number Diff line number Diff line change @@ -902,12 +902,10 @@ export class AngularCompilerPlugin {
902
902
}
903
903
904
904
writeI18nOutFile ( ) {
905
- function _recursiveMkDir ( p : string ) : Promise < void > {
906
- if ( fs . existsSync ( p ) ) {
907
- return Promise . resolve ( ) ;
908
- } else {
909
- return _recursiveMkDir ( path . dirname ( p ) )
910
- . then ( ( ) => fs . mkdirSync ( p ) ) ;
905
+ function _recursiveMkDir ( p : string ) {
906
+ if ( ! fs . existsSync ( p ) ) {
907
+ _recursiveMkDir ( path . dirname ( p ) ) ;
908
+ fs . mkdirSync ( p ) ;
911
909
}
912
910
}
913
911
@@ -916,8 +914,8 @@ export class AngularCompilerPlugin {
916
914
const i18nOutFilePath = path . resolve ( this . _basePath , this . _compilerOptions . i18nOutFile ) ;
917
915
const i18nOutFileContent = this . _compilerHost . readFile ( i18nOutFilePath ) ;
918
916
if ( i18nOutFileContent ) {
919
- _recursiveMkDir ( path . dirname ( i18nOutFilePath ) )
920
- . then ( ( ) => fs . writeFileSync ( i18nOutFilePath , i18nOutFileContent ) ) ;
917
+ _recursiveMkDir ( path . dirname ( i18nOutFilePath ) ) ;
918
+ fs . writeFileSync ( i18nOutFilePath , i18nOutFileContent ) ;
921
919
}
922
920
}
923
921
}
Original file line number Diff line number Diff line change 9
9
"non-null-operator" : true ,
10
10
"no-global-tslint-disable" : true ,
11
11
"single-eof-line" : true ,
12
+ "no-floating-promises" : true ,
12
13
13
14
14
15
"no-implicit-dependencies" : true ,
You can’t perform that action at this time.
0 commit comments