Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fear: bumped ts version and added check for .d.ts files #828

Merged
merged 3 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/scripts/check-for-declaration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import fs from "fs";
import path from "path";

type ResultType = {
js : Record<string , boolean>
ts : Record<string , boolean>
}

const result: ResultType = {js:{} , ts:{}}

const readThroughDirectory = (directory: string): void => {
const __directoryPath = directory
const files = fs.readdirSync(__directoryPath);
files.forEach((file) => {
const filePath = path.join(__directoryPath, file);
const stats = fs.statSync(filePath);
if (stats.isDirectory()) {
readThroughDirectory(filePath);
return
}

if(filePath.endsWith('.js')){
const name = filePath.split('.')
name.pop()
result.js[name.join('.')] = true
}

if(filePath.endsWith('.d.ts')){
const name = filePath.split('.')
name.pop()
name.pop()
result.ts[name.join('.')] = true
}

});

Object.keys(result.js).forEach(file => {
if(!result.ts[file]){
throw new Error(`Declaration File Missing for ${file}.js`)
}
})

};

readThroughDirectory(path.join(process.env.INIT_CWD ?? '', './bin'))
10 changes: 5 additions & 5 deletions .github/workflows/code-push-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Сode-push CI

on:
pull_request:
on:
pull_request:
branches:
- master

Expand All @@ -15,10 +15,10 @@ jobs:
- name: Setup NodeJs
uses: actions/setup-node@v1
with:
node-version: '14.x'
node-version: "14.x"
- name: Setup dependencies
run: npm run setup
- name: Build
run: npm run build
- name: Run tests
run: npm run build
- name: Run tests
run: npm run test
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"prebuild": "npm run clean",
"build": "tsc && npm run content",
"prebuild:release": "npm run clean",
"build:release": "tsc -p ./tsconfig-release.json && npm run content",
"build:release": "tsc -p ./tsconfig-release.json && npm run check:release && npm run content",
"check:release" : "npx ts-node .github/scripts/check-for-declaration.ts",
"test": "npm run build && mocha --recursive bin/test",
"test:debugger": "mocha --recursive --inspect-brk=0.0.0.0 bin/test",
"content": "shx cp {README.md,package.json,.npmignore} bin"
Expand Down
Loading