* Add FSXC

* Add new case and move file to ethereum folder

Co-authored-by: Mykola <kolya182@gmail.com>
This commit is contained in:
theFlashX 2020-06-16 11:05:18 +08:00 committed by GitHub
parent 65d171baf9
commit 8b5f0a2413
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 9 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -19,6 +19,7 @@ import {
readDirSync,
rootDirAllowedFiles,
toChecksum,
isDirContainLogo
} from "../src/test/helpers"
ethSidechains.forEach(chain => {
@ -53,19 +54,29 @@ getRootDirFilesList().forEach(async file => {
}
});
// Moves blockchains/0xXX...XX.png => assets/blockchains/ethereum/0xXX...XX/logo.png
readDirSync(chainsFolderPath).forEach(async chainFile => {
const chainPath = getChainPath(chainFile)
readDirSync(chainsFolderPath).forEach(async chainDir => {
const chainPath = getChainPath(chainDir)
const isDir = isPathDir(chainPath)
const ethereumAssetsPath = getChainAssetsPath(Ethereum)
// Moves blockchains/0xXX...XX.png => assets/blockchains/ethereum/0xXX...XX/logo.png
if (!isDir) {
const checksum = toChecksum(getFileName(chainFile))
const chainAssetsPath = getChainAssetsPath(Ethereum)
if (isChecksum(checksum) && getFileExt(chainFile).toLocaleLowerCase() === logoExtension) {
await makeDirIfDoestExist(chainAssetsPath, checksum)
const newPath = `${chainAssetsPath}/${checksum}/${logo}`
const checksum = toChecksum(getFileName(chainDir))
if (isChecksum(checksum) && getFileExt(chainDir).toLocaleLowerCase() === logoExtension) {
await makeDirIfDoestExist(ethereumAssetsPath, checksum)
const newPath = `${ethereumAssetsPath}/${checksum}/${logo}`
fs.renameSync(chainPath, newPath)
}
}
// Moves blockchains/0xXX...XX/logo.png => assets/blockchains/ethereum/0xXX...XX/logo.png
if (isDir && isDirContainLogo(chainPath)) {
const checksum = toChecksum(getFileName(chainDir))
await makeDirIfDoestExist(ethereumAssetsPath, checksum)
const newPath = `${ethereumAssetsPath}/${checksum}`
fs.renameSync(chainPath, newPath)
}
})

View File

@ -92,6 +92,7 @@ export const getRootDirFilesList = (): string[] => readDirSync(root)
export const readDirSync = (path: string): string[] => fs.readdirSync(path)
export const makeDirSync = (path: string) => fs.mkdirSync(path)
export const isPathExistsSync = (path: string): boolean => fs.existsSync(path)
export const isDirContainLogo = (path: string): boolean => fs.existsSync(`${path}/${logo}`)
export const isChainWhitelistExistSync = (chain: string): boolean => isPathExistsSync(getChainWhitelistPath(chain))
export const isChainBlacklistExistSync = (chain: string): boolean => isPathExistsSync(getChainBlacklistPath(chain))
export const isChainInfoExistSync = (chain: string): boolean => isPathExistsSync(getChainInfoPath(chain))