File tree Expand file tree Collapse file tree 4 files changed +29
-27
lines changed
angular_devkit/core/src/json/schema Expand file tree Collapse file tree 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 {
3939 private schematicName = 'ng-new' ;
4040
4141 private initialized = false ;
42- public initialize ( options : any ) {
42+ public async initialize ( options : any ) {
4343 if ( this . initialized ) {
44- return Promise . resolve ( ) ;
44+ return ;
4545 }
46- super . initialize ( options ) ;
46+
47+ await super . initialize ( options ) ;
48+
4749 this . initialized = true ;
4850
4951 const collectionName = this . parseCollectionName ( options ) ;
5052
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 ) ;
6061 }
6162
6263 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 {
1414 let value : T ;
1515 let set = false ;
1616
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 ) ) ;
2426
2527 if ( ! set ) {
2628 throw new Error ( 'Async observable.' ) ;
Original file line number Diff line number Diff line change @@ -902,12 +902,10 @@ export class AngularCompilerPlugin {
902902 }
903903
904904 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 ) ;
911909 }
912910 }
913911
@@ -916,8 +914,8 @@ export class AngularCompilerPlugin {
916914 const i18nOutFilePath = path . resolve ( this . _basePath , this . _compilerOptions . i18nOutFile ) ;
917915 const i18nOutFileContent = this . _compilerHost . readFile ( i18nOutFilePath ) ;
918916 if ( i18nOutFileContent ) {
919- _recursiveMkDir ( path . dirname ( i18nOutFilePath ) )
920- . then ( ( ) => fs . writeFileSync ( i18nOutFilePath , i18nOutFileContent ) ) ;
917+ _recursiveMkDir ( path . dirname ( i18nOutFilePath ) ) ;
918+ fs . writeFileSync ( i18nOutFilePath , i18nOutFileContent ) ;
921919 }
922920 }
923921 }
Original file line number Diff line number Diff line change 99 "non-null-operator" : true ,
1010 "no-global-tslint-disable" : true ,
1111 "single-eof-line" : true ,
12+ "no-floating-promises" : true ,
1213
1314
1415 "no-implicit-dependencies" : true ,
You can’t perform that action at this time.
0 commit comments