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 11name : Сode-push CI
22
3- on :
4- pull_request :
3+ on :
4+ pull_request :
55 branches :
66 - master
77
@@ -15,10 +15,10 @@ jobs:
1515 - name : Setup NodeJs
1616 uses : actions/setup-node@v1
1717 with :
18- node-version : ' 14.x'
18+ node-version : " 14.x"
1919 - name : Setup dependencies
2020 run : npm run setup
2121 - name : Build
22- run : npm run build
23- - name : Run tests
22+ run : npm run build
23+ - name : Run tests
2424 run : npm run test
Original file line number Diff line number Diff line change 1010 "prebuild" : " npm run clean" ,
1111 "build" : " tsc && npm run content" ,
1212 "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" ,
1415 "test" : " npm run build && mocha --recursive bin/test" ,
1516 "test:debugger" : " mocha --recursive --inspect-brk=0.0.0.0 bin/test" ,
1617 "content" : " shx cp {README.md,package.json,.npmignore} bin"
You can’t perform that action at this time.
0 commit comments