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
This commit is contained in:
Родитель
d8b071852f
Коммит
c6815bf340
|
@ -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'))
|
|
@ -15,7 +15,7 @@ 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
|
||||
|
|
|
@ -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"
|
||||
|
|
Загрузка…
Ссылка в новой задаче