mirror of
https://github.com/Instadapp/trustwallet-assets.git
synced 2024-07-29 22:37:31 +00:00
294d8bcb5d
* rename to sanityFix * Infra for consistency checks and Fixes. * Whitelist check moved to consistency check only. Co-authored-by: Catenocrypt <catenocrypt@users.noreply.github.com>
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { chainsPath, pricingFolderPath } from "../common/repo-structure";
|
|
import { findFiles } from "../common/filesystem";
|
|
import { ActionInterface, CheckStepInterface } from "./interface";
|
|
import { isValidJSON } from "../common/json";
|
|
import * as bluebird from "bluebird";
|
|
|
|
export class JsonAction implements ActionInterface {
|
|
getName(): string { return "Json files"; }
|
|
|
|
getSanityChecks(): CheckStepInterface[] {
|
|
return [
|
|
{
|
|
getName: () => { return "Check all JSON files to have valid content"},
|
|
check: async () => {
|
|
var error: string = "";
|
|
const files = [
|
|
...findFiles(chainsPath, 'json'),
|
|
...findFiles(pricingFolderPath, 'json')
|
|
];
|
|
|
|
await bluebird.each(files, async file => {
|
|
if (!isValidJSON(file)) {
|
|
error += `${file} path contains invalid JSON\n`;
|
|
}
|
|
});
|
|
return error;
|
|
}
|
|
},
|
|
];
|
|
}
|
|
|
|
getConsistencyChecks = null;
|
|
|
|
sanityFix = null;
|
|
|
|
consistencyFix = null;
|
|
|
|
update = null;
|
|
}
|