mirror of
https://github.com/Instadapp/trustwallet-assets.git
synced 2024-07-29 22:37:31 +00:00
Check for existence of info.json files (warning only). (#3991)
Co-authored-by: Catenocrypt <catenocrypt@users.noreply.github.com>
This commit is contained in:
parent
4b59de04e1
commit
92adaaf07e
|
@ -8,6 +8,8 @@ import {
|
||||||
getChainLogoPath,
|
getChainLogoPath,
|
||||||
getChainAssetsPath,
|
getChainAssetsPath,
|
||||||
getChainAssetPath,
|
getChainAssetPath,
|
||||||
|
getChainAssetLogoPath,
|
||||||
|
getChainAssetInfoPath,
|
||||||
assetFolderAllowedFiles,
|
assetFolderAllowedFiles,
|
||||||
getChainFolderFilesList,
|
getChainFolderFilesList,
|
||||||
chainFolderAllowedFiles,
|
chainFolderAllowedFiles,
|
||||||
|
@ -71,6 +73,42 @@ export class FoldersFiles implements ActionInterface {
|
||||||
return [errors, []];
|
return [errors, []];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
getName: () => { return "Asset folders contain logo"},
|
||||||
|
check: async () => {
|
||||||
|
var errors: string[] = [];
|
||||||
|
foundChains.forEach(chain => {
|
||||||
|
const assetsPath = getChainAssetsPath(chain);
|
||||||
|
if (isPathExistsSync(assetsPath)) {
|
||||||
|
readDirSync(assetsPath).forEach(address => {
|
||||||
|
const logoFullPath = getChainAssetLogoPath(chain, address);
|
||||||
|
if (!isPathExistsSync(logoFullPath)) {
|
||||||
|
errors.push(`Missing logo file for asset '${chain}/${address}' -- ${logoFullPath}`);
|
||||||
|
}
|
||||||
|
}) ;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return [errors, []];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
getName: () => { return "Asset folders contain info.json"},
|
||||||
|
check: async () => {
|
||||||
|
var warnings: string[] = [];
|
||||||
|
foundChains.forEach(chain => {
|
||||||
|
const assetsPath = getChainAssetsPath(chain);
|
||||||
|
if (isPathExistsSync(assetsPath)) {
|
||||||
|
readDirSync(assetsPath).forEach(address => {
|
||||||
|
const infoFullPath = getChainAssetInfoPath(chain, address);
|
||||||
|
if (!isPathExistsSync(infoFullPath)) {
|
||||||
|
warnings.push(`Missing info file for asset '${chain}/${address}' -- ${infoFullPath}`);
|
||||||
|
}
|
||||||
|
}) ;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return [[], warnings];
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
getName: () => { return "Asset folders contain only predefined set of files"},
|
getName: () => { return "Asset folders contain only predefined set of files"},
|
||||||
check: async () => {
|
check: async () => {
|
||||||
|
@ -79,7 +117,7 @@ export class FoldersFiles implements ActionInterface {
|
||||||
const assetsPath = getChainAssetsPath(chain);
|
const assetsPath = getChainAssetsPath(chain);
|
||||||
if (isPathExistsSync(assetsPath)) {
|
if (isPathExistsSync(assetsPath)) {
|
||||||
readDirSync(assetsPath).forEach(address => {
|
readDirSync(assetsPath).forEach(address => {
|
||||||
const assetFiles = getChainAssetPath(chain, address)
|
const assetFiles = getChainAssetPath(chain, address);
|
||||||
readDirSync(assetFiles).forEach(assetFolderFile => {
|
readDirSync(assetFiles).forEach(assetFolderFile => {
|
||||||
if (!(assetFolderAllowedFiles.indexOf(assetFolderFile) >= 0)) {
|
if (!(assetFolderAllowedFiles.indexOf(assetFolderFile) >= 0)) {
|
||||||
errors.push(`File '${assetFolderFile}' not allowed at this path: ${assetsPath}`);
|
errors.push(`File '${assetFolderFile}' not allowed at this path: ${assetsPath}`);
|
||||||
|
@ -90,7 +128,7 @@ export class FoldersFiles implements ActionInterface {
|
||||||
});
|
});
|
||||||
return [errors, []];
|
return [errors, []];
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ async function checkStepList(steps: CheckStepInterface[]): Promise<[string[], st
|
||||||
console.log(` ${chalk.yellow('!')} '${warn}'`);
|
console.log(` ${chalk.yellow('!')} '${warn}'`);
|
||||||
warningsAll.push(warn);
|
warningsAll.push(warn);
|
||||||
} else if (cnt == maxErrosFromOneCheck) {
|
} else if (cnt == maxErrosFromOneCheck) {
|
||||||
console.log(` ${chalk.red('X')} ${warnings.length} warnings in total, omitting rest ...`);
|
console.log(` ${chalk.yellow('!')} ${warnings.length} warnings in total, omitting rest ...`);
|
||||||
}
|
}
|
||||||
cnt++;
|
cnt++;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user