File tree Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change 33
33
"@vue/compiler-core" : " ^3.0.5" ,
34
34
"@vue/compiler-dom" : " ^3.0.5" ,
35
35
"debug" : " ^4.1.1" ,
36
+ "fs-extra" : " ^10.0.0" ,
36
37
"globby" : " ^11.0.2" ,
37
38
"jscodeshift" : " ^0.11.0" ,
38
39
"lru-cache" : " ^6.0.0" ,
47
48
"@types/debug" : " ^4.1.5" ,
48
49
"@types/eslint-scope" : " ^3.7.0" ,
49
50
"@types/eslint-visitor-keys" : " ^1.0.0" ,
51
+ "@types/fs-extra" : " ^9.0.12" ,
50
52
"@types/jest" : " ^26.0.3" ,
51
53
"@types/lodash" : " ^4.14.170" ,
52
54
"@types/node" : " ^12.12.47" ,
56
58
"eslint" : " ^7.29.0" ,
57
59
"jest" : " ^26.1.0" ,
58
60
"npm-run-all" : " ^4.1.5" ,
61
+ "prettier" : " ^2.3.2" ,
59
62
"ts-jest" : " ^26.1.1" ,
60
63
"typescript" : " ^4.1.3"
61
64
},
Original file line number Diff line number Diff line change 1
- import * as fs from 'fs'
2
1
import * as globby from 'globby'
3
- import * as prettier from 'prettier'
4
2
import createDebug from 'debug'
3
+ import * as fsExtra from 'fs-extra'
5
4
6
5
const debug = createDebug ( 'vue-codemod:rule' )
7
6
@@ -60,18 +59,11 @@ export function transform(): boolean {
60
59
return false
61
60
}
62
61
63
- let packageObj : any = JSON . parse ( fs . readFileSync ( resolvedPaths [ 0 ] ) . toString ( ) )
62
+ let packageObj : JSON = fsExtra . readJsonSync ( resolvedPaths [ 0 ] )
64
63
65
64
packageObj = process ( packageObj )
66
65
67
- let formatted = prettier . format (
68
- JSON . stringify ( packageObj ) ,
69
- Object . assign (
70
- { parser : 'json' } ,
71
- packageObj ?. prettier ? packageObj ?. prettier : { }
72
- )
73
- )
74
- fs . writeFileSync ( resolvedPaths [ 0 ] , formatted )
66
+ fsExtra . writeJsonSync ( resolvedPaths [ 0 ] , packageObj , { spaces : 2 } )
75
67
return true
76
68
}
77
69
/**
You can’t perform that action at this time.
0 commit comments