File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @rc-component/father-plugin" ,
3
- "version" : " 2.0.2 " ,
3
+ "version" : " 2.0.3 " ,
4
4
"description" : " The father plugin for all react-component projects" ,
5
5
"keywords" : [],
6
6
"repository" : " https://github.com/react-component/father-plugin.git" ,
34
34
" prettier --parser=typescript --write"
35
35
]
36
36
},
37
+ "dependencies" : {
38
+ "fs-extra" : " ^11.3.0"
39
+ },
37
40
"devDependencies" : {
38
41
"@commitlint/cli" : " ^17.1.2" ,
39
42
"@commitlint/config-conventional" : " ^17.1.0" ,
Original file line number Diff line number Diff line change 1
1
import { exec , execSync } from 'child_process' ;
2
2
import type { IApi } from 'father' ;
3
+ import fs from 'fs-extra' ;
4
+ import path from 'path' ;
5
+
6
+ const cwd = process . cwd ( ) ;
3
7
4
8
// 检查是否已安装 npm 包
5
9
function checkNpmPackageInstalled ( packageName : string ) {
@@ -17,6 +21,13 @@ export default (api: IApi) => {
17
21
return ;
18
22
}
19
23
24
+ // Break if current project not install `@rc-component/np`
25
+ const packageJson = await fs . readJson ( path . join ( cwd , 'package.json' ) ) ;
26
+ if ( ! packageJson . devDependencies [ '@rc-component/np' ] ) {
27
+ console . log ( 'Please install `@rc-component/np` instead of `np`.' ) ;
28
+ process . exit ( 1 ) ;
29
+ }
30
+
20
31
const inputFolder =
21
32
api ?. config ?. esm ?. input || api ?. config ?. esm ?. input || 'src/' ;
22
33
@@ -26,7 +37,7 @@ export default (api: IApi) => {
26
37
// Requires compatibility with Windows environment
27
38
`npx eslint ${ inputFolder } --ext .tsx,.ts --rule "@typescript-eslint/consistent-type-exports: error"` ,
28
39
{
29
- cwd : process . cwd ( ) ,
40
+ cwd,
30
41
env : process . env ,
31
42
stdio : [ process . stdin , process . stdout , process . stderr ] ,
32
43
encoding : 'utf-8' ,
You can’t perform that action at this time.
0 commit comments