forked from airgap-it/airgap-wallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpatch-coinlib.js
30 lines (24 loc) · 829 Bytes
/
patch-coinlib.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// remove types from coinlib local dependencies to avoid incompatibility errors
const fs = require('fs')
const path = require('path')
const rootdir = ''
const coreDependencies = path.join(rootdir, 'node_modules/@airgap/coinlib-core/dependencies/src')
const dependencies = [coreDependencies]
function removeTypes(path) {
const isDirectory = fs.lstatSync(path).isDirectory()
if (!isDirectory) {
return
}
const files = fs.readdirSync(path)
for (const file of files) {
const absoluteFilePath = `${path}/${file}`
if (file.endsWith('.d.ts')) {
fs.rmSync(absoluteFilePath)
console.log('Removed: ', absoluteFilePath)
} else {
removeTypes(absoluteFilePath)
}
}
}
console.log('patch-coinlib.js: Removing types from local dependencies')
dependencies.forEach((dir) => removeTypes(dir))