trustwallet-assets/script/remove_empthy_folder.ts
2020-05-17 18:20:58 -07:00

27 lines
753 B
TypeScript

import {
getChainAssetPath,
getChainAssetsPath,
isPathDir,
isPathDirEmpthy,
readDirSync,
removeDir,
getAllChainsList,
} from "../src/test/helpers"
getAllChainsList().forEach(async chain => {
const chainAssetsPath = getChainAssetsPath(chain)
if (isPathDir(chainAssetsPath)) {
readDirSync(chainAssetsPath).forEach(async (asset) => {
const assetPath = getChainAssetPath(chain, asset);
const isDir = await isPathDir(assetPath);
const isPathEmpthy = await isPathDirEmpthy(assetPath);
if (isDir && isPathEmpthy) {
removeDir(assetPath)
console.log(`Removed empty folder at path ${assetPath}`);
}
})
}
})