Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit c6815bf

Browse files
authored
fear: bumped ts version and added check for .d.ts files (#828)
* fix: added CI check for build files * fix: fixed node version in worklflows * chore: revert code-push-ci.yml
1 parent d8b0718 commit c6815bf

File tree

3 files changed

+52
-6
lines changed

3 files changed

+52
-6
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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'))

.github/workflows/code-push-ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: С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

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
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"

0 commit comments

Comments
 (0)