File tree 1 file changed +9
-4
lines changed
packages/create-plugin/templates/common/.config/webpack 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -21,17 +21,22 @@ export function isWSL() {
21
21
}
22
22
}
23
23
24
+ function loadJson ( path : string ) {
25
+ const rawJson = fs . readFileSync ( path , 'utf8' ) ;
26
+ return JSON . parse ( rawJson ) ;
27
+ }
28
+
24
29
export function getPackageJson ( ) {
25
- return require ( path . resolve ( process . cwd ( ) , 'package.json' ) ) ;
30
+ return loadJson ( path . resolve ( process . cwd ( ) , 'package.json' ) ) ;
26
31
}
27
32
28
33
export function getPluginJson ( ) {
29
- return require ( path . resolve ( process . cwd ( ) , `${ SOURCE_DIR } /plugin.json` ) ) ;
34
+ return loadJson ( path . resolve ( process . cwd ( ) , `${ SOURCE_DIR } /plugin.json` ) ) ;
30
35
}
31
36
32
37
export function getCPConfigVersion ( ) {
33
- const cprcJson = path . resolve ( __dirname , '../ ' , '.cprc.json' ) ;
34
- return fs . existsSync ( cprcJson ) ? require ( cprcJson ) . version : { version : 'unknown' } ;
38
+ const cprcJson = path . resolve ( process . cwd ( ) , './.config ' , '.cprc.json' ) ;
39
+ return fs . existsSync ( cprcJson ) ? loadJson ( cprcJson ) . version : { version : 'unknown' } ;
35
40
}
36
41
37
42
export function hasReadme ( ) {
You can’t perform that action at this time.
0 commit comments