This repository was archived by the owner on May 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +52
-6
lines changed Expand file tree Collapse file tree 3 files changed +52
-6
lines changed Original file line number Diff line number Diff line change
1
+ import fs from "fs" ;
2
+ import path from "path" ;
3
+
4
+ type ResultType = {
5
+ js : Record < string , boolean >
6
+ ts : Record < string , boolean >
7
+ }
8
+
9
+ const result : ResultType = { js :{ } , ts :{ } }
10
+
11
+ const readThroughDirectory = ( directory : string ) : void => {
12
+ const __directoryPath = directory
13
+ const files = fs . readdirSync ( __directoryPath ) ;
14
+ files . forEach ( ( file ) => {
15
+ const filePath = path . join ( __directoryPath , file ) ;
16
+ const stats = fs . statSync ( filePath ) ;
17
+ if ( stats . isDirectory ( ) ) {
18
+ readThroughDirectory ( filePath ) ;
19
+ return
20
+ }
21
+
22
+ if ( filePath . endsWith ( '.js' ) ) {
23
+ const name = filePath . split ( '.' )
24
+ name . pop ( )
25
+ result . js [ name . join ( '.' ) ] = true
26
+ }
27
+
28
+ if ( filePath . endsWith ( '.d.ts' ) ) {
29
+ const name = filePath . split ( '.' )
30
+ name . pop ( )
31
+ name . pop ( )
32
+ result . ts [ name . join ( '.' ) ] = true
33
+ }
34
+
35
+ } ) ;
36
+
37
+ Object . keys ( result . js ) . forEach ( file => {
38
+ if ( ! result . ts [ file ] ) {
39
+ throw new Error ( `Declaration File Missing for ${ file } .js` )
40
+ }
41
+ } )
42
+
43
+ } ;
44
+
45
+ readThroughDirectory ( path . join ( process . env . INIT_CWD ?? '' , './bin' ) )
Original file line number Diff line number Diff line change 1
1
name : Сode-push CI
2
2
3
- on :
4
- pull_request :
3
+ on :
4
+ pull_request :
5
5
branches :
6
6
- master
7
7
@@ -15,10 +15,10 @@ jobs:
15
15
- name : Setup NodeJs
16
16
uses : actions/setup-node@v1
17
17
with :
18
- node-version : ' 14.x'
18
+ node-version : " 14.x"
19
19
- name : Setup dependencies
20
20
run : npm run setup
21
21
- name : Build
22
- run : npm run build
23
- - name : Run tests
22
+ run : npm run build
23
+ - name : Run tests
24
24
run : npm run test
Original file line number Diff line number Diff line change 10
10
"prebuild" : " npm run clean" ,
11
11
"build" : " tsc && npm run content" ,
12
12
"prebuild:release" : " npm run clean" ,
13
- "build:release" : " tsc -p ./tsconfig-release.json && npm run content" ,
13
+ "build:release" : " tsc -p ./tsconfig-release.json && npm run check:release && npm run content" ,
14
+ "check:release" : " npx ts-node .github/scripts/check-for-declaration.ts" ,
14
15
"test" : " npm run build && mocha --recursive bin/test" ,
15
16
"test:debugger" : " mocha --recursive --inspect-brk=0.0.0.0 bin/test" ,
16
17
"content" : " shx cp {README.md,package.json,.npmignore} bin"
You can’t perform that action at this time.
0 commit comments