mirror of
https://github.com/Instadapp/trustwallet-assets.git
synced 2024-07-29 22:37:31 +00:00
440bc104de
* Run image compression on very push to master * Add contract in lowercase for test * Add daily updater * Add formatter on every pull,push to branches * Remove dublicates * Fix run syntax * Fix syntax * Run image compression only when push to master * Run formater on all PR, exept master * Add npm cache * Add branches * Try fix rename issue on ci * Add trailing slash * remove trailing * Move uses in step * remove dash from uses * Run each npm run individually * remove name * remove checksum * rename to jpg * Add AMATEN (AMA) lowercase * debug * Run checksum after formating * USet lates checkout and commit to branch innsted deatached head * Checkout to branch in checkout * Fix version * Add formating * Add formating Co-authored-by: kolya182 <kolya182@users.noreply.github.com>
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import {
|
|
ethSidechains,
|
|
readDirSync,
|
|
getChainAssetsPath,
|
|
getChainAssetFilesList,
|
|
isChecksum,
|
|
toChecksum,
|
|
getFileName,
|
|
getFileExt,
|
|
getMoveCommandFromTo,
|
|
execRename,
|
|
logoName,
|
|
logoExtension,
|
|
logo,
|
|
getChainAssetPath
|
|
} from "../src/test/helpers"
|
|
|
|
ethSidechains.forEach(chain => {
|
|
const assetsPath = getChainAssetsPath(chain)
|
|
|
|
readDirSync(assetsPath).forEach(address => {
|
|
getChainAssetFilesList(chain, address).forEach(file => {
|
|
if (getFileName(file) == logoName && getFileExt(file) !== logoExtension) {
|
|
console.log(`Renaming incorrect asset logo extension ${file} ...`)
|
|
renameAndMove(getChainAssetPath(chain, address), file, logo)
|
|
}
|
|
})
|
|
checksumAssetsFolder(assetsPath, address)
|
|
})
|
|
})
|
|
|
|
export function checksumAssetsFolder(assetsFolderPath: string, addr: string) {
|
|
if (!isChecksum(addr)) {
|
|
renameAndMove(assetsFolderPath, addr, toChecksum(addr))
|
|
}
|
|
}
|
|
|
|
export function renameAndMove(path: string, oldName: string, newName: string) {
|
|
console.log(` Renaming file or folder at path ${path}: ${oldName} => ${newName}`)
|
|
execRename(path, getMoveCommandFromTo(oldName, newName))
|
|
}
|
|
|