@@ -4,41 +4,36 @@ import { pri } from '../node';
4
4
import { logFatal , logInfo , logSuccess } from './log' ;
5
5
6
6
export function typeChecker ( ) {
7
- const stashFileCnt = + execSync ( 'git diff --cached --numstat --diff-filter=ACM | wc -l' ) . toString ( 'utf8' ) ;
7
+ const stashFileCnt = + execSync ( 'git diff --cached --numstat --diff-filter=ACM | wc -l' ) . toString ( 'utf8' ) ;
8
8
9
- if ( stashFileCnt > 0 ) {
10
- let debugFiles = '' ;
9
+ if ( stashFileCnt > 0 ) {
10
+ let debugFiles = '' ;
11
11
12
- try {
13
- debugFiles = execSync (
14
- "grep -in '@DEBUG' --include *.ts --include *.tsx --include *.js --include *.scss --include *.css $(git diff --cached --name-only --diff-filter=ACM) /dev/null" ,
15
- {
16
- shell : 'bash' ,
17
- stdio : [ 0 , 1 ] ,
18
- } ,
19
- ) . toString ( 'utf8' ) ;
20
- // eslint-disable-next-line no-empty
21
- } catch ( e ) { }
12
+ try {
13
+ debugFiles = execSync (
14
+ "grep -in '@DEBUG' --include *.ts --include *.tsx --include *.js --include *.scss --include *.css $(git diff --cached --name-only --diff-filter=ACM) /dev/null" ,
15
+ {
16
+ shell : 'bash' ,
17
+ stdio : [ 0 , 1 ] ,
18
+ } ,
19
+ ) . toString ( 'utf8' ) ;
20
+ // eslint-disable-next-line no-empty
21
+ } catch ( e ) { }
22
22
23
- if ( debugFiles ) {
24
- logFatal ( '@DEBUG identifier exists, the commit is terminated' ) ;
25
- process . exit ( 1 ) ;
23
+ if ( debugFiles ) {
24
+ logFatal ( '@DEBUG identifier exists, the commit is terminated' ) ;
25
+ process . exit ( 1 ) ;
26
+ }
26
27
}
27
- }
28
28
29
- const tsChangedFilesCnt = + execSync ( "git diff --cached --numstat --diff-filter=ACM | grep -F '.ts' | wc -l" ) . toString (
30
- 'utf8' ,
31
- ) ;
32
- if ( tsChangedFilesCnt ) {
33
29
logInfo ( 'Checking TypeScript type, please wait' ) ;
34
30
try {
35
- execSync ( `${ pri . projectRootPath } /node_modules/.bin/tsc -p . || exit 1` , {
36
- stdio : [ 0 , 1 , 2 ] ,
37
- } ) ;
31
+ execSync ( `${ pri . projectRootPath } /node_modules/.bin/tsc -p . || exit 1` , {
32
+ stdio : [ 0 , 1 , 2 ] ,
33
+ } ) ;
38
34
} catch ( e ) {
39
- logFatal ( 'Type checks error!' ) ;
40
- process . exit ( 1 ) ;
35
+ logFatal ( 'Type checks error!' ) ;
36
+ process . exit ( 1 ) ;
41
37
}
42
38
logSuccess ( 'Type checks passed!' ) ;
43
- }
44
39
}
0 commit comments