File tree Expand file tree Collapse file tree 3 files changed +37
-9
lines changed Expand file tree Collapse file tree 3 files changed +37
-9
lines changed Original file line number Diff line number Diff line change
1
+ const fs = require ( 'fs' ) ;
2
+ const path = require ( 'path' ) ;
3
+
4
+ // Load package.json
5
+ const packageJsonPath = path . join ( __dirname , 'package.json' ) ;
6
+ const packageJson = require ( packageJsonPath ) ;
7
+
8
+ // Get the "types" field from package.json
9
+ const typesFilePath = packageJson . types ;
10
+
11
+ if ( ! typesFilePath ) {
12
+ console . error ( 'The "types" field is not defined in package.json.' ) ;
13
+ process . exit ( 1 ) ;
14
+ }
15
+
16
+ // Resolve the full path to the types file
17
+ const typesFileFullPath = path . resolve ( __dirname , typesFilePath ) ;
18
+
19
+ // Check if the file exists
20
+ fs . access ( typesFileFullPath , fs . constants . F_OK , ( err ) => {
21
+ if ( err ) {
22
+ console . error ( `The types file '${ typesFileFullPath } ' does not exist.` ) ;
23
+ process . exit ( 1 ) ;
24
+ } else {
25
+ console . log ( `The types file '${ typesFileFullPath } ' exists.` ) ;
26
+ }
27
+ } ) ;
Original file line number Diff line number Diff line change @@ -2,10 +2,10 @@ pre-commit:
2
2
parallel : true
3
3
commands :
4
4
lint :
5
- files : git diff --name-only @{push}
5
+ files : git diff --cached -- name-only
6
6
glob : " *.{js,ts,jsx,tsx}"
7
7
run : npx eslint {files}
8
8
types :
9
- files : git diff --name-only @{push}
10
- glob : " *.{js, ts, jsx, tsx}"
11
- run : npx tsc --noEmit
9
+ files : git diff --cached -- name-only
10
+ glob : " *.{ts,tsx}"
11
+ run : npx tsc --noEmit
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @eppo/react-native-sdk" ,
3
- "version" : " 3.0.0 " ,
3
+ "version" : " 3.0.1 " ,
4
4
"description" : " Eppo React Native SDK" ,
5
5
"main" : " lib/commonjs/index" ,
6
6
"module" : " lib/module/index" ,
7
- "types" : " lib/typescript/src/ index.d.ts" ,
7
+ "types" : " lib/typescript/index.d.ts" ,
8
8
"react-native" : " src/index" ,
9
9
"source" : " src/index" ,
10
10
"files" : [
31
31
"test" : " jest" ,
32
32
"typecheck" : " tsc --noEmit" ,
33
33
"lint" : " eslint \" **/*.{js,ts,tsx}\" " ,
34
- "prepack" : " bob build && cp -r package.json lib" ,
34
+ "prepack" : " bob build && cp -r package.json lib && yarn check-types " ,
35
35
"example" : " yarn --cwd example" ,
36
- "bootstrap" : " yarn example && yarn install"
36
+ "bootstrap" : " yarn example && yarn install" ,
37
+ "check-types" : " node ./check-types.js"
37
38
},
38
39
"keywords" : [
39
40
" react-native" ,
146
147
]
147
148
]
148
149
}
149
- }
150
+ }
You can’t perform that action at this time.
0 commit comments