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 7
7
*/
8
8
9
9
import { json , workspaces } from '@angular-devkit/core' ;
10
- import { existsSync , readFileSync , statSync , writeFileSync } from 'fs' ;
10
+ import { existsSync , promises as fs , writeFileSync } from 'fs' ;
11
11
import * as os from 'os' ;
12
12
import * as path from 'path' ;
13
13
import { PackageManager } from '../../lib/config/workspace-schema' ;
@@ -20,22 +20,26 @@ function isJsonObject(value: json.JsonValue | undefined): value is json.JsonObje
20
20
21
21
function createWorkspaceHost ( ) : workspaces . WorkspaceHost {
22
22
return {
23
- async readFile ( path ) {
24
- return readFileSync ( path , 'utf-8' ) ;
23
+ readFile ( path ) {
24
+ return fs . readFile ( path , 'utf-8' ) ;
25
25
} ,
26
26
async writeFile ( path , data ) {
27
- writeFileSync ( path , data ) ;
27
+ await fs . writeFile ( path , data ) ;
28
28
} ,
29
29
async isDirectory ( path ) {
30
30
try {
31
- return statSync ( path ) . isDirectory ( ) ;
31
+ const stats = await fs . stat ( path ) ;
32
+
33
+ return stats . isDirectory ( ) ;
32
34
} catch {
33
35
return false ;
34
36
}
35
37
} ,
36
38
async isFile ( path ) {
37
39
try {
38
- return statSync ( path ) . isFile ( ) ;
40
+ const stats = await fs . stat ( path ) ;
41
+
42
+ return stats . isFile ( ) ;
39
43
} catch {
40
44
return false ;
41
45
}
You can’t perform that action at this time.
0 commit comments