File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
packages/angular/cli/src/utilities Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 77 */
88
99import { json , workspaces } from '@angular-devkit/core' ;
10- import { existsSync , readFileSync , statSync , writeFileSync } from 'fs' ;
10+ import { existsSync , promises as fs , writeFileSync } from 'fs' ;
1111import * as os from 'os' ;
1212import * as path from 'path' ;
1313import { PackageManager } from '../../lib/config/workspace-schema' ;
@@ -20,22 +20,26 @@ function isJsonObject(value: json.JsonValue | undefined): value is json.JsonObje
2020
2121function createWorkspaceHost ( ) : workspaces . WorkspaceHost {
2222 return {
23- async readFile ( path ) {
24- return readFileSync ( path , 'utf-8' ) ;
23+ readFile ( path ) {
24+ return fs . readFile ( path , 'utf-8' ) ;
2525 } ,
2626 async writeFile ( path , data ) {
27- writeFileSync ( path , data ) ;
27+ await fs . writeFile ( path , data ) ;
2828 } ,
2929 async isDirectory ( path ) {
3030 try {
31- return statSync ( path ) . isDirectory ( ) ;
31+ const stats = await fs . stat ( path ) ;
32+
33+ return stats . isDirectory ( ) ;
3234 } catch {
3335 return false ;
3436 }
3537 } ,
3638 async isFile ( path ) {
3739 try {
38- return statSync ( path ) . isFile ( ) ;
40+ const stats = await fs . stat ( path ) ;
41+
42+ return stats . isFile ( ) ;
3943 } catch {
4044 return false ;
4145 }
You can’t perform that action at this time.
0 commit comments